Skip to contentSkip to conversation

seg6: Cleanup duplicates of skb_dst_drop calls

PATCH Applied Yuya Tajima 3 participants 3 messages May 15, 2023 – May 17, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 seg6: Cleanup duplicates of skb_dst_drop calls

In processing IPv6 segment routing header (SRH), several functions call skb_dst_drop before ip6_route_input. However, ip6_route_input calls skb_dst_drop within it, so there is no need to call skb_dst_drop in advance.

---
 net/ipv6/exthdrs.c       | 3 ---
 net/ipv6/seg6_iptunnel.c | 3 +--
 2 files changed, 1 insertion(+), 5 deletions(-)
net/ipv6/exthdrs.c +0 -3
index a8d961d3a477..04c14fc4b14d 100644
@@ -458,8 +458,6 @@ static int ipv6_srh_rcv(struct sk_buff *skb)
 
 	ipv6_hdr(skb)->daddr = *addr;
 
-	skb_dst_drop(skb);
-
 	ip6_route_input(skb);
 
 	if (skb_dst(skb)->error) {
@@ -834,7 +832,6 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb)
 	*addr = ipv6_hdr(skb)->daddr;
 	ipv6_hdr(skb)->daddr = daddr;
 
-	skb_dst_drop(skb);
 	ip6_route_input(skb);
 	if (skb_dst(skb)->error) {
 		skb_push(skb, skb->data - skb_network_header(skb));
net/ipv6/seg6_iptunnel.c +1 -2
index 34db881204d2..03b877ff4558 100644
@@ -470,8 +470,6 @@ static int seg6_input_core(struct net *net, struct sock *sk,
 	dst = dst_cache_get(&slwt->cache);
 	preempt_enable();
 
-	skb_dst_drop(skb);
-
 	if (!dst) {
 		ip6_route_input(skb);
 		dst = skb_dst(skb);
@@ -482,6 +480,7 @@ static int seg6_input_core(struct net *net, struct sock *sk,
 			preempt_enable();
 		}
 	} else {
+		skb_dst_drop(skb);
 		skb_dst_set(skb, dst);
 	}
 
Signature · 1 line
2.34.1
#2 lore raw
In reply to Yuya Tajima
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 9 lines · On Mon, 15 May 2023 15:34:27 +0000 you wrote:

In processing IPv6 segment routing header (SRH), several functions call skb_dst_drop before ip6_route_input. However, ip6_route_input calls skb_dst_drop within it, so there is no need to call skb_dst_drop in advance.

---
 net/ipv6/exthdrs.c       | 3 ---
 net/ipv6/seg6_iptunnel.c | 3 +--
 2 files changed, 1 insertion(+), 5 deletions(-)

Here is the summary with links:
- [net-next] seg6: Cleanup duplicates of skb_dst_drop calls

    https://git.kernel.org/netdev/net-next/c/fa0583c20243

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html