cvs commit: src/sys/dev/re if_re.c

Ruslan Ermilov ru at
Sat Sep 17 03:16:05 PDT 2005


On Fri, Sep 16, 2005 at 11:06:08PM +0000, Bill Paul wrote:
> If you insist on sticking to the "no twiddling IFF_UP from inside
> the driver" rule, then I think the problem can be avoided by simply not
> being lazy in foo_ioctl() and actually having explicit code in SIOCSIFFLAGS
> case that turns promisc mode on and off on an IFF_PROMISC transition,
> and is careful not to do it unless IFF_RUNNING is set. It also
> needs to handle IFF_UP separately from IFF_PROMISC. I think the
> correct logic would look something like:
> 	if (IFF_UP was toggled up)
> 		foo_init(sc);
> 	else if (IFF_UP was toggled down)
> 		foo_stop(sc);
> 	if (IFF_PROMISC was toggled up && ifp->if_flags & IFF_RUNNING)
> 		foo_set_promisc(sc);
> 	else if (IFF_PROMISC was toggled down && ifp->if_flags & IFF_RUNNING)
> 		foo_clear_promisc(sc);
How about prototyping the "lazy" SIOCSIFFLAGS handler as follows:

	if (IFF_UP has toggled up)
		foo_init();	/* foo_init takes care of IFF_PROMISC etc. */
	else if (IFF_UP has toggled down)
	else if (IFF_DRV_RUNNING) {
		if (something interesting has toggled)

Non-lazy handlers can specifially process IFF_PROMISC|IFF_ALLMULTI toggles.

For comparison, the current "lazy" handler is as follows:

	if (IFF_UP)
	else if (!IFF_UP & IFF_DRV_RUNNING)

I.e., it doesn't remember the previous state.

Ruslan Ermilov
ru at
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the cvs-src mailing list