From owner-svn-src-all@FreeBSD.ORG Sat Oct 19 09:59:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9269FD92; Sat, 19 Oct 2013 09:59:11 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F82F21F2; Sat, 19 Oct 2013 09:59:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9J9xBJq036989; Sat, 19 Oct 2013 09:59:11 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9J9xBI1036988; Sat, 19 Oct 2013 09:59:11 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201310190959.r9J9xBI1036988@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sat, 19 Oct 2013 09:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256768 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Oct 2013 09:59:11 -0000 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"); }