ipvs: fix places with wrong packet offsets
authorJulian Anastasov <ja@ssi.bg>
Wed, 22 Jul 2026 10:15:16 +0000 (13:15 +0300)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 23 Jul 2026 16:05:08 +0000 (18:05 +0200)
commit15cab31a3730e05f0767b922a7450e5d784b2607
treebad820e4927f1b235151149e565f0ba0a2a90598
parente876b75b9020a97bbdc79721e7fc749024891c65
ipvs: fix places with wrong packet offsets

The offsets we use to packet headers and payloads should be
based on skb->data. We even already respect non-zero
network offset in ip_vs_fill_iph_skb() but some places
do it wrongly and support only zero offset which is expected
for the IP layer where IPVS has hooks.

Change all places that instead of skb->data use offsets based
on the network header (skb_network_header, ip_hdr, etc) because
this doubles the network offset as noted by Sashiko.

For ip_vs_nat_icmp_v6() we can even rely on the IPv6 header
parsing done by the caller.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://sashiko.dev/#/patchset/20260710143733.29741-2-fw%40strlen.de
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/ip_vs.h
net/netfilter/ipvs/ip_vs_app.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/ipvs/ip_vs_proto_sctp.c
net/netfilter/ipvs/ip_vs_proto_tcp.c
net/netfilter/ipvs/ip_vs_proto_udp.c
net/netfilter/ipvs/ip_vs_xmit.c