Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Oct 2013 09:59:11 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r256768 - head/sbin/ifconfig
Message-ID:  <201310190959.r9J9xBI1036988@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Sat Oct 19 09:59:11 2013
New Revision: 256768
URL: http://svnweb.freebsd.org/changeset/base/256768

Log:
  Do not error out when adding an interface to a group to which it
  already belongs or removing it from a group to which it does not
  belong.  This makes it possible to include group memberships in
  ifconfig_foo0 in rc.conf without fear of breaking "service netif
  restart foo0".
  
  MFC after:	3 days

Modified:
  head/sbin/ifconfig/ifgroup.c

Modified: head/sbin/ifconfig/ifgroup.c
==============================================================================
--- head/sbin/ifconfig/ifgroup.c	Sat Oct 19 09:40:29 2013	(r256767)
+++ head/sbin/ifconfig/ifgroup.c	Sat Oct 19 09:59:11 2013	(r256768)
@@ -57,7 +57,7 @@ setifgroup(const char *group_name, int d
 
 	if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >= IFNAMSIZ)
 		errx(1, "setifgroup: group name too long");
-	if (ioctl(s, SIOCAIFGROUP, (caddr_t)&ifgr) == -1)
+	if (ioctl(s, SIOCAIFGROUP, (caddr_t)&ifgr) == -1 && errno != EEXIST)
 		err(1," SIOCAIFGROUP");
 }
 
@@ -75,7 +75,7 @@ unsetifgroup(const char *group_name, int
 
 	if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >= IFNAMSIZ)
 		errx(1, "unsetifgroup: group name too long");
-	if (ioctl(s, SIOCDIFGROUP, (caddr_t)&ifgr) == -1)
+	if (ioctl(s, SIOCDIFGROUP, (caddr_t)&ifgr) == -1 && errno != ENOENT)
 		err(1, "SIOCDIFGROUP");
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310190959.r9J9xBI1036988>