re(4) needs promisc to work properly

Bill Paul wpaul at FreeBSD.ORG
Fri Dec 1 08:52:31 PST 2006


> Hello Bill,
> 
> * Bill Paul <wpaul at FreeBSD.ORG> wrote:
> > > - Switching from and to promiscuous mode takes 7 seconds. All packets
> > >   are dropped in the mean time.
> > 
> > The SIOCSIFFLAGS handler in re_ioctl() currently just takes a shortcut
> > of calling re_init(). While this does eventually end up changing the RX
> > filter settings accordingly, it takes a while because re_init() also shuts
> > down and re-initializes the whole chip (including resetting the link).
> > 
> > This is relatively easy to fix though. The IFF_PROMISC flag can be
> > singled out and handled separately. (A few other drivers already do this.)
> 
> I wrote a small patch that moves all rxcfg code in re_init_locked() to a
> separate function. This way, we can just call that function instead of
> re_init_locked when reaching SIOCSIFFLAGS. I tested it by reverting your
> patch and ping6'ing the box. When I run tcpdump, the box doesn't freeze
> and enters promiscuous mode (suddenly the ping6 starts to work then).
> 
> What do you think about this patch?

I'm a little concerned about the fact that now SIOCSIFFLAGS can never
cause re_init_locked() to be called. There are some cases where it
does need to be called (like when the IFF_UP flag is first set to
turn the interface on).

I usually do it like in the vge(4) driver: if it's just the IFF_PROMISC
bit that's being toggled, then I only toggle the promisc mode bit in
the RX config register.

-Bill


More information about the freebsd-net mailing list