Skip to content

netfilter: nft_meta: add support for slave device matching

Florian Westphal netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9netfilter: nft_meta: move time handling to helpernet/netfilter/nft_meta.c+22 -60 replies
2/9netfilter: nft_meta: move pkttype handling to helpernet/netfilter/nft_meta.c+51 -390 replies
3/9netfilter: nft_meta: move sk uid/git handling to helpernet/netfilter/nft_meta.c+36 -290 replies
4/9netfilter: nft_meta: move cgroup handling to helpernet/netfilter/nft_meta.c+15 -50 replies
5/9netfilter: nft_meta: move interface kind handling to helpernet/netfilter/nft_meta.c+25 -60 replies
6/9netfilter: nft_meta: move all interface related keys to helpernet/netfilter/nft_meta.c+70 -250 replies
7/9netfilter: nft_meta: place prandom handling in a helpernet/netfilter/nft_meta.c+9 -40 replies
8/9netfilter: nft_meta: place rtclassid handling in a helpernet/netfilter/nft_meta.c+16 -60 replies
9/9netfilter: nft_meta: add support for slave device ifindex matchinginclude/uapi/linux/netfilter/nf_tables.h net/netfilter/nft_meta.c+73 -73 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH nf-next 0/9] netfilter: nft_meta: add support for slave device matching

Martin Willi recently proposed addition of new xt_slavedev module to allow matching the real interface within a VRF domain.

This adds an nft equivalent:

meta sdif "realdev" accept
meta sdifname "realdev" accept

In case packet had no vrf slave, sdif stores 0 or "" name, just like 'oif/oifname' would on input.

sdif(name) is restricted to the ipv4/ipv6 input and forward hooks, as it depends on ip(6) stack parsing/storing info in skb->cb[].

Because meta main eval function is now exceeding more than 200 LOC, the first patches are diet work to debloat the function by using helpers where appropriate.

Last patch adds the sdif/sdifname functionality.

Function                                     old     new   delta
nft_meta_get_eval_pkttype_lo                   -     588    +588
nft_meta_get_eval_time                         -     404    +404
nft_meta_get_eval_skugid                       -     397    +397
nft_meta_get_eval_cgroup                       -     234    +234
nft_meta_get_eval_sif                          -     148    +148
nft_meta_get_eval_kind                         -     138    +138
nft_meta_get_eval_sifname                      -      91     +91
nft_meta_get_validate                        111     169     +58
nft_prandom_u32                                -      20     +20

nft_meta_get_eval 2904 1261 -1643
Total: Before=6076, After=6511, chg +7.16%