On Fri, Apr 03, 2015 at 08:16:18AM -0700, Ben Pfaff wrote: > > On Fri, Apr 03, 2015 at 10:02:16PM +0800, Kevin Lo wrote: > > I'm attempting to install ovs 2.3.1 on FreeBSD and it appears to be broken > > after the commit 666afb55e84e9118812de81a75655ec9567b7a5b. > > Since FreeBSD uses two short integers to represent interface flags, > > we have to apply mask 0xffff to flags. > > > > Signed-off-by: Kevin Lo <ke...@freebsd.org> >
CC: Ed Maste <ema...@freebsd.org> > It's hard for me to see how your patch makes a difference. If > ifr->ifr_flags is 16-bits, then ifr->ifr_flags and (ifr->ifr_flags & > 0xffff) have the same value, and assigning to ifr->ifr_flags has the > same effect whether you mask off high bits or not. FreeBSD fills the int return value with ifr_flagshigh in the high 16 bits and ifr_flags in the low 16 bits rather than blindly promoting ifr_flags to an int, which will preserve the sign. FreeBSD places it into the lower 16 bits of the return value. > Also, the commit you name was in 2013, and we've had other > contributions from FreeBSD contributors since then > (namely Ed Maste <ema...@freebsd.org>) and it seems like he > would have noticed if it were totally busted. You mean this message: http://openvswitch.org/pipermail/dev/2013-May/027594.html If so, Ed replied that he reviewed the patch but didn't apply it to test. :-) > > diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c > > index f97a5c3..9ed2823 100644 > > --- a/lib/netdev-bsd.c > > +++ b/lib/netdev-bsd.c > > @@ -1785,7 +1785,7 @@ static int > > ifr_get_flags(const struct ifreq *ifr) > > { > > #ifdef HAVE_STRUCT_IFREQ_IFR_FLAGSHIGH > > - return (ifr->ifr_flagshigh << 16) | ifr->ifr_flags; > > + return (ifr->ifr_flagshigh << 16) | (ifr->ifr_flags & 0xffff); > > #else > > return ifr->ifr_flags; > > #endif > > @@ -1794,9 +1794,11 @@ ifr_get_flags(const struct ifreq *ifr) > > static void > > ifr_set_flags(struct ifreq *ifr, int flags) > > { > > - ifr->ifr_flags = flags; > > #ifdef HAVE_STRUCT_IFREQ_IFR_FLAGSHIGH > > + ifr->ifr_flags = flags & 0xffff; > > ifr->ifr_flagshigh = flags >> 16; > > +#else > > + ifr->ifr_flags = flags; > > #endif > > } > > > > _______________________________________________ > > dev mailing list > > dev@openvswitch.org > > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev