Skip to contentSkip to conversation

ipvs: reload ip header after head reallocation

PATCH In review Florian Westphal 2 participants 2 messages Jul 8

Subsystems (3)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 ipvs: reload ip header after head reallocation

__ip_vs_get_out_rt() might realloc skb->head due to ttl decrement.

Fixes 8d8e20e2d7bb ("ipvs: Decrement ttl")
Assisted-by Claude:claude-sonnet-4-6

---
LLM assisted find, no real-world bug report behind this.

 net/netfilter/ipvs/ip_vs_xmit.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/netfilter/ipvs/ip_vs_xmit.c +2 -4
index ce542ed4b013..9fef4335da13 100644
@@ -736,13 +736,11 @@ int
 ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
 		  struct ip_vs_protocol *pp, struct ip_vs_iphdr *ipvsh)
 {
-	struct iphdr  *iph = ip_hdr(skb);
-
-	if (__ip_vs_get_out_rt(cp->ipvs, cp->af, skb, NULL, iph->daddr,
+	if (__ip_vs_get_out_rt(cp->ipvs, cp->af, skb, NULL, ip_hdr(skb)->daddr,
 			       IP_VS_RT_MODE_NON_LOCAL, NULL, ipvsh) < 0)
 		goto tx_error;
 
-	ip_send_check(iph);
+	ip_send_check(ip_hdr(skb));
 
 	/* Another hack: avoid icmp_send in ip_fragment */
 	skb->ignore_df = 1;
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 5 lines · Florian Westphal

__ip_vs_get_out_rt() might realloc skb->head due to ttl decrement.

Fixes 8d8e20e2d7bb ("ipvs: Decrement ttl")
Assisted-by Claude:claude-sonnet-4-6

Looks good to me, thanks!

Quoted 28 lines

---
LLM assisted find, no real-world bug report behind this.

 net/netfilter/ipvs/ip_vs_xmit.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/netfilter/ipvs/ip_vs_xmit.c +2 -4
index ce542ed4b013..9fef4335da13 100644
@@ -736,13 +736,11 @@ int
 ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
 		  struct ip_vs_protocol *pp, struct ip_vs_iphdr *ipvsh)
 {
-	struct iphdr  *iph = ip_hdr(skb);
-
-	if (__ip_vs_get_out_rt(cp->ipvs, cp->af, skb, NULL, iph->daddr,
+	if (__ip_vs_get_out_rt(cp->ipvs, cp->af, skb, NULL, ip_hdr(skb)->daddr,
 			       IP_VS_RT_MODE_NON_LOCAL, NULL, ipvsh) < 0)
 		goto tx_error;
 
-	ip_send_check(iph);
+	ip_send_check(ip_hdr(skb));
 
 	/* Another hack: avoid icmp_send in ip_fragment */
 	skb->ignore_df = 1;
Signature · 1 line
2.54.0

Regards

--
Julian Anastasov <[email protected]>