Subject: Re: sys/dev/ic/an.c:an_ioctl, SIOCSIFFLAGS case
To: None <itojun@iijlab.net>
From: Atsushi Onoe <onoe@sm.sony.co.jp>
List: tech-net
Date: 05/28/2001 09:54:58
> in an driver, what is the intention of the following code?
> it seems odd to me that it takes & between new if_flags value and
> old value. i guess it should be ifp->if_flags only.
It may be written as follows, though I don't feel it is much better...
if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) ==
(IFF_UP | IFF_RUNNING) &&
(sc->an_if_flags & (IFF_UP | IFF_RUNNING)) ==
(IFF_UP | IFF_RUNNING)) {
Anyway I added a comment why IFF_PROMISC is handled separately here:
@@ -1040,6 +1040,12 @@
switch (command) {
case SIOCSIFFLAGS:
+ /*
+ * Handle special case for IFF_PROMISC. If only IFF_PROMISC
+ * flag is changed, do not call an_init() to avoid initiating
+ * reassociation to another access point. It is really
+ * helpful for tcpdump(8).
+ */
if ((ifp->if_flags & sc->an_if_flags &
(IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING)) {
if (ifp->if_flags & IFF_PROMISC &&
Regards,
Atsushi