Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Oct 2013 13:11:38 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= <des@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r256768 - head/sbin/ifconfig
Message-ID:  <CAJ-Vmo=Av3eg64nK5QUVNJTO7z6=goD0XtXgmLcFT4fS7TnWFA@mail.gmail.com>
In-Reply-To: <201310190959.r9J9xBI1036988@svn.freebsd.org>
References:  <201310190959.r9J9xBI1036988@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
... 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=F8rgrav <des@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
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- 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) >=3D IFNAMSIZ)
>                 errx(1, "setifgroup: group name too long");
> -       if (ioctl(s, SIOCAIFGROUP, (caddr_t)&ifgr) =3D=3D -1)
> +       if (ioctl(s, SIOCAIFGROUP, (caddr_t)&ifgr) =3D=3D -1 && errno !=
=3D
> EEXIST)
>                 err(1," SIOCAIFGROUP");
>  }
>
> @@ -75,7 +75,7 @@ unsetifgroup(const char *group_name, int
>
>         if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >=3D IFNAMSIZ)
>                 errx(1, "unsetifgroup: group name too long");
> -       if (ioctl(s, SIOCDIFGROUP, (caddr_t)&ifgr) =3D=3D -1)
> +       if (ioctl(s, SIOCDIFGROUP, (caddr_t)&ifgr) =3D=3D -1 && errno !=
=3D
> ENOENT)
>                 err(1, "SIOCDIFGROUP");
>  }
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=Av3eg64nK5QUVNJTO7z6=goD0XtXgmLcFT4fS7TnWFA>