net: ipv6: add skb drop reasons to TLV parse
authorMenglong Dong <imagedong@tencent.com>
Wed, 13 Apr 2022 08:15:58 +0000 (16:15 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Apr 2022 12:09:57 +0000 (13:09 +0100)
commit7d9dbdfbfdc5e52131bea94a7318ee35b15a5f19
treeb209c774d48b131bd61a64559f7bfa6908286a1d
parentbba98083499f63f62419edf42022275d34a72470
net: ipv6: add skb drop reasons to TLV parse

Replace kfree_skb() used in TLV encoded option header parsing with
kfree_skb_reason(). Following functions are involved:

ip6_parse_tlv()
ipv6_hop_ra()
ipv6_hop_ioam()
ipv6_hop_jumbo()
ipv6_hop_calipso()
ipv6_dest_hao()

Most skb drops during this process are regarded as 'InHdrErrors',
as 'IPSTATS_MIB_INHDRERRORS' is used when ip6_parse_tlv() fails,
which make we use 'SKB_DROP_REASON_IP_INHDR' correspondingly.

However, 'IP_INHDR' is a relatively general reason. Therefore, we
can use other reasons with higher priority in some cases. For example,
'SKB_DROP_REASON_UNHANDLED_PROTO' is used for unknown TLV options.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Reviewed-by: Jiang Biao <benbjiang@tencent.com>
Reviewed-by: Hao Peng <flyingpeng@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/exthdrs.c