Date: Fri, 28 Aug 1998 08:56:15 +0200 (MET DST) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: net@FreeBSD.ORG Subject: Proposal for (minimal) change to network drivers in promisc. mode Message-ID: <199808280656.IAA04891@labinfo.iet.unipi.it>
next in thread | raw e-mail | index | archive | help
In most (all ?) network card drivers, there are comments like the following (generally copied from one driver to the other...): /* * Note that the interface cannot be in promiscuous mode if * there are no BPF listeners. And if we are in promiscuous now, isn't that a strong assumption ? There could be more reasons to enable promiscuous mode on a machine (e.g. the bridging code i am writing now, and possibly others), and the savings in the code deriving from that assumption are really negligible: typically the code would go from if (sc->arpcom.ac_if.if_bpf) { bpf_mtap(&sc->arpcom.ac_if, m); if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) && pkt is not for us) drop pkt ; } to if (sc->arpcom.ac_if.if_bpf) bpf_mtap(&sc->arpcom.ac_if, m); if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) && pkt is not for us) drop pkt ; where the second 'if' is very cheap when not in promiscuous mode. Some drivers already decouple bpf and PROMISC handling in the way shown above, and i think this is all in the interest of clarity. For others the modifications would be trivial. At a first scan of the code i see the following: "de", "fe", "ie", "lnc" already fixed. "ed", "fxp", "ep", "wl", "zp": one-line fix as shown above Note: the ep" driver one seems to have a redundant expensive check for broadcast address "le", "ze" almost as simple as above "eg", "el", "ex", "tx" seem not to support multicast/promisc mode so this is less of a problem. What do you think, can i submit patches for at least a few of these drivers with the hope that they get committed ? luigi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808280656.IAA04891>