summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorPhilo Lu <lulie@linux.alibaba.com>2025-02-22 11:35:18 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-07 18:25:31 +0100
commit8ffd0390fc3f92b0e5f21074bfce465df5c4f090 (patch)
tree29db501270cbd9443f2a1feb279b2a4ed190b5f4 /net/core
parentb7091d6b3cb7f413703ebfa7651db048a3cb89e0 (diff)
downloadlinux-8ffd0390fc3f92b0e5f21074bfce465df5c4f090.tar.gz
linux-8ffd0390fc3f92b0e5f21074bfce465df5c4f090.tar.bz2
linux-8ffd0390fc3f92b0e5f21074bfce465df5c4f090.zip
ipvs: Always clear ipvs_property flag in skb_scrub_packet()
[ Upstream commit de2c211868b9424f9aa9b3432c4430825bafb41b ] We found an issue when using bpf_redirect with ipvs NAT mode after commit ff70202b2d1a ("dev_forward_skb: do not scrub skb mark within the same name space"). Particularly, we use bpf_redirect to return the skb directly back to the netif it comes from, i.e., xnet is false in skb_scrub_packet(), and then ipvs_property is preserved and SNAT is skipped in the rx path. ipvs_property has been already cleared when netns is changed in commit 2b5ec1a5f973 ("netfilter/ipvs: clear ipvs_property flag when SKB net namespace changed"). This patch just clears it in spite of netns. Fixes: 2b5ec1a5f973 ("netfilter/ipvs: clear ipvs_property flag when SKB net namespace changed") Signed-off-by: Philo Lu <lulie@linux.alibaba.com> Acked-by: Julian Anastasov <ja@ssi.bg> Link: https://patch.msgid.link/20250222033518.126087-1-lulie@linux.alibaba.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/skbuff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 61a950f13a91..f220306731da 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -6127,11 +6127,11 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet)
skb->offload_fwd_mark = 0;
skb->offload_l3_fwd_mark = 0;
#endif
+ ipvs_reset(skb);
if (!xnet)
return;
- ipvs_reset(skb);
skb->mark = 0;
skb_clear_tstamp(skb);
}