Skip to content

Commit

Permalink
seg6: Cleanup duplicates of skb_dst_drop calls
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Yuya Tajima <yuya.tajimaa@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yuya Tajima authored and David S. Miller committed May 17, 2023
1 parent 81cf1ad commit fa0583c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions net/ipv6/exthdrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
Expand Down
3 changes: 1 addition & 2 deletions net/ipv6/seg6_iptunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down

0 comments on commit fa0583c

Please sign in to comment.