<html>
    <head>
      <base href="https://bugzilla.netfilter.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><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">1220</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Reverse path filtering using "fib" needs better documentation
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>nftables
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>minor
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P5
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>nft
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>pablo@netfilter.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>f30@f30.me
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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".

`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.

I therefore suggest to add better documentation covering that aspect.

[1] <a href="https://wiki.nftables.org/wiki-nftables/index.php/Routing_information#fib">https://wiki.nftables.org/wiki-nftables/index.php/Routing_information#fib</a>
[2] <a href="http://www.strlen.de/talks/netdev12_nft_fib.pdf">http://www.strlen.de/talks/netdev12_nft_fib.pdf</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>