tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

npf again: L2 filtering completely broken?



I'm in the process of migrating from ipfilter to npf and I have
noticed that the layer 2 filtering...doesn't seem to filter, and
the reason for that is what looks like a fairly obvious bug.

However I'm also a little sick so there's a chance I'm being stupid.

Anyway, digging into the problem led me to sys/net/npf/npf_os.c's
get_etherpfil_head, which loops over all interfaces to register
the L2 hooks:

| IFNET_WRITER_FOREACH(ifp) {
|         error = register_etherpfil_hook(npf, ifp, i);
|         if (!error)
|                 break;
|         i++;
| }

That loop breaks on success, not on error.  So only the first
interface (I guess lo0?) actually gets anything that allows it to
filter on layer 2, and all other interfaces just pass the traffic.
Hope nobody relied on this.

I've tested the behavior with the '!' gone and it seems to honor
the L2 rules afterwards.


Home | Main Index | Thread Index | Old Index