> 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