tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: tap(4) interface management



On Wed, 13 May 2009, David Young wrote:

> On Wed, May 13, 2009 at 03:03:37PM +0100, Iain Hibbert wrote:
> > +/* rtmsg sockaddr alignment from src/sys/net/rtsock.c */
> > +#define ROUNDUP(a) \
> > +   ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
>
> FWIW, <net/route.h> defines this as RT_ROUNDUP().

Awesome!  (but that wasn't there a few short weeks ago :)

> > Common subdirectories: /usr/src/sys/net/agr/CVS and agr/CVS
> > --- /usr/src/sys/net/if.c   2009-02-24 10:05:47.000000000 +0000
> > +++ if.c    2009-04-06 17:12:15.000000000 +0100
> > @@ -1481,8 +1481,12 @@ ifioctl_common(struct ifnet *ifp, u_long
> >                     if_up(ifp);
> >                     splx(s);
> >             }
> > -           ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) |
> > -                   (ifr->ifr_flags &~ IFF_CANTCHANGE);
> > +           if (((ifr->ifr_flags ^ ifp->if_flags) & ~IFF_CANTCHANGE)) {
> > +                   ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE)
> > +                       | (ifr->ifr_flags & ~IFF_CANTCHANGE);
> > +
> > +                   rt_ifmsg(ifp);
> > +           }
> >             break;
> >     case SIOCGIFFLAGS:
> >             ifr = data;
>
> if_up() and if_down() call rt_ifmsg(), too, so that if IFF_UP changes,
> you will get two routing messages instead of one.

It never has in practice (that I've noticed) but I guess it could depend
on the interface? Any IFF_UP change has already happened at this stage, so
unless some other ~CANTCHANGE flags were modified by the up/down code it
won't be triggered.

Also, I didn't check that if_flags is changed from other code paths so it
could be that its not the whole story.

iain


Home | Main Index | Thread Index | Old Index