Skip to content

RFC netfilter: add restrictions/validations for packet rewrites

Florian Westphal netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2netfilter: nfnetlink_queue: restrict writes to network headernet/netfilter/nfnetlink_queue.c+102 -10 replies
2/2netfilter: nftables: restrict linklayer and network header writesnet/netfilter/nft_payload.c+166 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC nf 0/2] netfilter: add restrictions/validations for packet rewrites

This is a followup to the recent patch that disabled packet manipulation via nfqueue or nft_payload in user namespaces.

This adds additional *restrictions*.
For nfqueue, do minimal header checks in case userspace provides payload replacement data.

For nft_payload, restrict the offset/length combinations.

Several of these checks could be done at rule insertion time (i.e. control plane).
Risk is that this may cause ruleset load failures for existing rulesets. With this change such writes are silently skipped and packet passes unchanged.

Restriction is added for link and network bases only.

Open questions:
- target tree: nf or nf-next?
- should there be an immediate followup ('patch 3') that reverts the userns restrictions again?
- should nft_payload reject those requests it can validate there from the control plane?

I would propose to target nf-next for now and leave the userns restrictions in place to see what relevant use-cases exist.

Florian Westphal (2):
netfilter: nfnetlink_queue: restrict writes to network header
netfilter: nftables: restrict linklayer and network header writes

 net/netfilter/nfnetlink_queue.c | 103 +++++++++++++++++++-
 net/netfilter/nft_payload.c     | 166 ++++++++++++++++++++++++++++++++
 2 files changed, 268 insertions(+), 1 deletion(-)
Signature · 1 line
2.53.0