Skip to content

add support for VLAN header filtering in bridge family

Florian Westphal netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 of 12 patches 2 repliesIn review

11 of 12 patches are in this archive. The cover letter announces 12.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12tests: use the src/nft binary instead of $PATH onetests/regression/nft-test.py+18 -170 replies
2/12tests: add 'awkward' prefix match expressiontests/regression/ip/ip.t tests/regression/ip/ip.t.payload tests/regression/ip/ip.t.payload.inet+17 -00 replies
3/12nft: allow stacking vlan header on top of ethernetinclude/proto.h src/evaluate.c src/netlink_delinearize.c +2 more+123 -100 replies
4/12payload: disable payload merge if offsets are not on byte boundarysrc/payload.c+4 -00 replies
5/12src: netlink_linearize: handle sub-byte lengthssrc/netlink_linearize.c+44 -10 replies
6/12src: netlink: don't truncate set key lengthssrc/netlink.c+2 -20 replies
7/12nft: fill in doff and fix ihl/version template entriessrc/proto.c+6 -40 replies
8/12netlink: cmp: shift rhs constant if lhs offset doesn't start on byte boundarysrc/netlink_linearize.c+10 -00 replies
9/12tests: add tests for ip version/hdrlength/tcp dofftests/regression/inet/tcp.t tests/regression/inet/tcp.t.payload.inet tests/regression/inet/tcp.t.payload.ip +4 more+78 -00 replies
10/12nft: support listing expressions that use non-byte header fieldsinclude/payload.h src/evaluate.c src/netlink_delinearize.c +1 more+160 -130 replies
11/12tests: vlan teststests/regression/bridge/vlan.t tests/regression/bridge/vlan.t.payload+223 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH nft 0/12] add support for VLAN header filtering in bridge family

This adds the following features:
- stacked headers: vlan sits on top of ethernet, so when vlan id 42 is requested, add a dependency on eth and also adjust payload offsets by the size of ethernet header.

- allow matching header fields of lengths and/or offsets that are not byte divisible, e.g. vlan id, vlan pcp, ip hdrlength, etc.

Missing/not working:

- concat support for vlan ids, e.f. this will not work:
vlan id . ip saddr { 1 . 1.2.3.4 }

- payload merging of fields that have lengths/sizes not divisible by 8.

IOW when asking for vlan id 42 vlan pcp 0 then we generate 2 payload instructions, 2 binops, 2 cmps.

Oddities:

bridge filter input ip saddr 1.2.3.4

... will never match in some cases.

'Problem' (or feature...?) is that nft adds dependency on 'ether type ip' so if all traffic is VLAN encapsulated this will not match.

[ can use 'vlan type ip ip saddr 1.2.3.4' to match eth-vlan-ip packets ].

There might be a lot of pitfalls that i've missed.

Unless there are objections I will push the first two patches soon.

The vlan patch set has seen minimal testing inside kvm on x86_64, using a (pending) kernel patch to nft_payload to transparently insert the missing/stripped vlan header into the register set.

I'd be happy to receive feedback on these patches, I'm sure that some things can be implemented in a more straightforward fashion.

Cheers,
Florian