<html>
<head>
<base href="https://bugzilla.netfilter.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Reverse path filtering using "fib" needs better documentation"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1220#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Reverse path filtering using "fib" needs better documentation"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1220">bug 1220</a>
from <span class="vcard"><a class="email" href="mailto:fw@strlen.de" title="Florian Westphal <fw@strlen.de>"> <span class="fn">Florian Westphal</span></a>
</span></b>
<pre>(In reply to Felix Dreissig from <a href="show_bug.cgi?id=1220#c0">comment #0</a>)
<span class="quote">> 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".</span >
Yes, the slides were created while FIB was work-in-progress.
<span class="quote">> `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.</span >
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>