Programming interface MAC filter without enabling PROMISC on an interface from user space.

Bruce M. Simpson bms at FreeBSD.org
Mon Jan 14 08:08:20 PST 2008


Tom Judge wrote:
> Hi,
>
> I have just started experimenting with OpenLLDP and come across a 
> little bit of a nasty.  When it opens the interface, it puts it into 
> PROMISC mode,  which I don't really want to happen.  Is there any way 
> to add the LLDP MAC address (01-80-C2-00-00-0E) to the interface mac 
> filter from user space, so that the interface does not have to be set 
> to PROMISC?

There *is* an API for this but it's not integrated into pcap or bpf; see 
SIOCADDMULTI and SIOCDELMULTI. There are some issues with doing that 
portably, Windows and Linux do things somewhat differently in this space.

Really we could do with a KPI for this so that the references are 
properly refcounted. If you have other link layer multicast listeners 
it's not guaranteed that the stack will correctly restore the hash 
filters at the driver level if it has to enable ALLMULTI mode.

You almost certainly don't want to set PROMISC if you are ever going to 
do any kind of IP forwarding, although I believe I fixed that historic 
bug whereby the IP layer kept seeing its own packets about a year ago.

later
BMS


More information about the freebsd-net mailing list