Skip to content

RFC netfilter reverse path filter matches

Florian Westphal netdev netfilter-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest5 patches 3 repliesIn review
  2. v1 RFC3 patches 8 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5net: ipv4: export fib_table_lookupnet/ipv4/fib_trie.c+1 -00 replies
2/5net: ipv4: move ip_rcv route error counter handling into helper functioninclude/net/ip.h net/ipv4/ip_input.c+13 -90 replies
3/5netfilter: add ipv4 reverse path filter matchinclude/linux/netfilter/xt_rpfilter.h net/ipv4/netfilter/Kconfig net/ipv4/netfilter/Makefile +1 more+197 -00 replies
4/5ipv6: add ip6_route_lookupinclude/net/ip6_route.h net/ipv6/route.c+9 -00 replies
5/5netfilter: add ipv6 reverse path filter matchnet/ipv6/netfilter/Kconfig net/ipv6/netfilter/Makefile net/ipv6/netfilter/ip6t_rpfilter.c+135 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH RFC v2 0/5] netfilter reverse path filter matches

Version 2 of the ipv4/v6 reverse path filter matches discussed during nfws 2011.

The ipv4 match (ipt_rpfilter) tries to do exactly what the current fib_validate_source does. The main problem with this is that we need to do an additional fib lookup to get the oif in the match. [ delaying until FORWARD is invoked is not possible because by
that point the stack might have already sent icmp errors ].

Patrick McHardy suggested to simply attach the result as the dst, so ipv4 input path doesn't have to do it again.

This works, but does have a few side effects wrt. route-by-mark and TPROXY, see patch changelog for details.

The ipv6 version does a pure 'reverse' lookup instead. This makes things a lot easier (e.g. when multiple route entries exist), but has the caveat that a real reply packet might be handled differently due to policy routing rules.

Userspace part is stored in my iptables repository on
http://git.breakpoint.cc/cgi-bin/gitweb.cgi?p=fw/iptables.git (branch 'rpfilter').

Kernel patches are located in the 'xt_rpfilter_5' branch on
http://git.breakpoint.cc/cgi-bin/gitweb.cgi?p=fw/nf-next.git
(patches will be sent as followup to this email).

[ in case you are wondering: the earlier xt_rpfilter version was
removed -- causes too many module dependency issues and most of the code cannot be shared anyway ].

Thanks,
Florian