svn commit: r256768 - head/sbin/ifconfig

Adrian Chadd adrian at freebsd.org
Sat Oct 19 20:11:39 UTC 2013


... erm, this could break many existing scripts that stupidly(!) just try
adding an interface to a group to see if it's already there.

Is the ifconfig error behavour in this instance documented anywhere?



-adrian



On 19 October 2013 02:59, Dag-Erling Smørgrav <des at freebsd.org> wrote:

> 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");
>  }
>
>


More information about the svn-src-head mailing list