IPFW1->2 regression: "in/out/via any" ignored

Luigi Rizzo rizzo at icir.org
Thu Mar 23 14:57:40 UTC 2006


On Thu, Mar 23, 2006 at 04:47:17PM +0200, Dmitry Pryanishnikov wrote:
...
> > For locally generated packets i admit 'recv any' may be of some use,
> > and this is unsupported. There are probably workaround such as 'src-ip me'
> 
>   Oops! How can one know that feature which is documented from the beginning,
> which worked in ipfw1 - became 'unsupported' in ipfw2? It's clearly a 
> regression to me, given that I can't use ipfw1 with modern RELENGs.

it's a bug, never seen one before ? :)

> > which may be of some help here although this particular instruction
> > can be expensive as it has to scan the list of local addresses.
> 
>   I don't understand that part. Given that 'out recv ifx' still works, we have
> incoming interface name for every transit outgoing packet. I'm sure there is
> some indication in this field that clearly says: "packet _is_ 
> locally-generated". Isn't it?

yes, i am just saying that there is no code in the kernel and
in the userland compiler that interprets that info correctly.
I repeat - it's a bug. I'ts probably trivial to fix, but at the
moment i don't have the time to work on it.

If you want, the places to touch are:
sbin/ipfw/ipfw2.c the two places which parse TOK_RECV and O_RECV,
should be enabled to deal with  'any' as an interface name and encode
it somewhere in the instruction (see function fill_iface(), at the
moment 'any' is interpreted as NULL, it could become some magic
value e.g. 0x1 or the like)
sys/netinet/ip_fw2.c in function iface_match(), you should check
whether this magic value is present in the instruction and then
return 0 or 1 depending on whether or not the 'ifp' argument is non-null.

and this should be all you need to do (testing, of course :)

cheers
luigi

> Sincerely, Dmitry
> -- 
> Atlantis ISP, System Administrator
> e-mail:  dmitry at atlantis.dp.ua
> nic-hdl: LYNX-RIPE


More information about the freebsd-ipfw mailing list