Commit 3ae42cc8 authored by Menglong Dong's avatar Menglong Dong Committed by David S. Miller

net: ipv6: add skb drop reasons to ip6_pkt_drop()

Replace kfree_skb() used in ip6_pkt_drop() with kfree_skb_reason().
No new reason is added.
Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
Reviewed-by: default avatarJiang Biao <benbjiang@tencent.com>
Reviewed-by: default avatarHao Peng <flyingpeng@tencent.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c4eb6641
...@@ -4482,6 +4482,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes) ...@@ -4482,6 +4482,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes)
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct net *net = dev_net(dst->dev); struct net *net = dev_net(dst->dev);
struct inet6_dev *idev; struct inet6_dev *idev;
SKB_DR(reason);
int type; int type;
if (netif_is_l3_master(skb->dev) || if (netif_is_l3_master(skb->dev) ||
...@@ -4494,11 +4495,14 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes) ...@@ -4494,11 +4495,14 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes)
case IPSTATS_MIB_INNOROUTES: case IPSTATS_MIB_INNOROUTES:
type = ipv6_addr_type(&ipv6_hdr(skb)->daddr); type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
if (type == IPV6_ADDR_ANY) { if (type == IPV6_ADDR_ANY) {
SKB_DR_SET(reason, IP_INADDRERRORS);
IP6_INC_STATS(net, idev, IPSTATS_MIB_INADDRERRORS); IP6_INC_STATS(net, idev, IPSTATS_MIB_INADDRERRORS);
break; break;
} }
SKB_DR_SET(reason, IP_INNOROUTES);
fallthrough; fallthrough;
case IPSTATS_MIB_OUTNOROUTES: case IPSTATS_MIB_OUTNOROUTES:
SKB_DR_OR(reason, IP_OUTNOROUTES);
IP6_INC_STATS(net, idev, ipstats_mib_noroutes); IP6_INC_STATS(net, idev, ipstats_mib_noroutes);
break; break;
} }
...@@ -4508,7 +4512,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes) ...@@ -4508,7 +4512,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes)
skb_dst_drop(skb); skb_dst_drop(skb);
icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0); icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0);
kfree_skb(skb); kfree_skb_reason(skb, reason);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment