summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <fmancera@suse.de>2026-10-04 03:41:44 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2026-10-18 02:35:03 +0200
commitd7c4b903f349c1e910e377c9e306b1a789ba03a8 (patch)
treee98663c093e25586e08345496215c4a14eff1de2 /include/linux/timerqueue.h
parent540aab0e415d12b29f8a94fe5bb31c6dced24fd6 (diff)
netfilter: nft_exthdr: avoid 60 bytes stack buffer in TCP option mangling
nft_exthdr_tcp_set_eval() and nft_exthdr_tcp_strip_eval() fetched the TCP header and options through nft_tcp_header_pointer(), which calls skb_header_pointer() a second time for the full tcphdr_len into a 60 bytes stack buffer. Since commit 28427f368f0e ("netfilter: nft_exthdr: Fix non-linear header modification") both functions then call skb_ensure_writable() and re-read the header from skb->data, so the buffer was never used. Only the 20 bytes fixed header is needed to learn tcphdr_len, so fetch just that, validate the length as before, and let skb_ensure_writable() pull the rest. This also drops the 60 bytes stack buffer from both functions. Comparison of performance in mpps: op linear/non-linear before after delta ================================================================== set, non-linear 4.193 4.348 +3.7% mpps strip, non-linear 4.184 4.434 +6.0% mpps set, linear 5.302 5.427 +2.4% mpps strip, linear 5.452 5.527 +1.4% mpss Comparison of performance in ns/expression: op linear/non-linear before after delta ================================================================== set, non-linear 34.6 25.3 -9.4 ns strip, non-linear 35.2 20.8 -14.3 ns set, linear 23.6 19.7 -3.9 ns strip, linear 22.9 19.8 -3.1 ns ./scripts/bloat-o-meter exthdr_before.o exthdr_after.o add/remove: 0/1 grow/shrink: 3/0 up/down: 233/-207 (26) Function old new delta nft_exthdr_tcp_eval 792 946 +154 nft_exthdr_tcp_strip_eval 825 891 +66 nft_exthdr_tcp_set_eval 602 615 +13 nft_tcp_header_pointer.part.constprop 207 - -207 Total: Before=6527, After=6553, chg +0.40% This also allow the compiler to inline nft_tcp_header_pointer inside nft_exthdr_tcp_eval() which could yield some minimal performance gain. This patch also updates the logic to drop malformed packets, before this patch NFT_BREAK was used as a verdict instead. Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions