[Bug 1220] Reverse path filtering using "fib" needs better documentation
bugzilla-daemon at netfilter.org
bugzilla-daemon at netfilter.org
Mon Feb 5 17:12:47 CET 2018
https://bugzilla.netfilter.org/show_bug.cgi?id=1220
--- Comment #1 from Florian Westphal <fw at strlen.de> ---
(In reply to Felix Dreissig from comment #0)
> Reverse path filtering means dropping a packet if connections to its source
> IP wouldn't use the same interface the packet arrived on. The nftables wiki
> states [1] that this can be implemented like:
>
> nft add rule x prerouting fib saddr . iif oif eq 0 drop
>
> Slides by Florian Westphal [2] suggest to use:
>
> nft add rule ... fib saddr . oif oif = 0 drop
>
> But this fails with "Invalid argument" even when replacing "=" by "==" or
> "eq".
Yes, the slides were created while FIB was work-in-progress.
> `fib saddr . iif oif eq 0` achieves the desired goal (except for bugs like
> the one I'm going to report next), but I'm having a hard time figuring out
> why:
> As far as I understand, `fib saddr . iif` looks up routing information based
> on source address and input interface. `oif` then selects the output
> interface from the looked up information.
> Most other examples compare that result with an interface name, which is
> pretty straight-forward. But I can't tell why and when `oif` would return 0
> and why this can be used for reverse path filtering.
Indeed, this is not documented properly.
oif is 0 when no route was found.
When 'saddr . iif' is used, the kernel is supposed to also
check that oif == iif; i.e. it return iif (oif and iif are the same and
thereforce reply would leave via iif/oif), or 0 (no route or route via
different interface).
Does that make sense to you?
I'll try to add something to nft man page to cover this.
--
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20180205/4a318cec/attachment.html>
More information about the netfilter-buglog
mailing list