From 4fc2182cfaea966decae8e64ea0afbb34f79beab Mon Sep 17 00:00:00 2001 From: Menglong Dong Date: Tue, 7 Jun 2022 11:05:54 +0800 Subject: [PATCH] net: icmp: introduce function icmpv6_param_prob_reason() [upstream commit 1ad6d548e2a452f21bcee4606ee4ec7afcde5f37] In order to add the skb drop reasons support to icmpv6_param_prob(), introduce the function icmpv6_param_prob_reason() and make icmpv6_param_prob() an inline call to it. This new function will be used in the following patches. Signed-off-by: Menglong Dong Reviewed-by: Jiang Biao Reviewed-by: Hao Peng Signed-off-by: David S. Miller --- include/linux/icmpv6.h | 12 ++++++++++-- net/ipv6/icmp.c | 7 ++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 0be0d68fb..779e88418 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -79,8 +79,9 @@ extern int icmpv6_init(void); extern int icmpv6_err_convert(u8 type, u8 code, int *err); extern void icmpv6_cleanup(void); -extern void icmpv6_param_prob(struct sk_buff *skb, - u8 code, int pos); +extern void icmpv6_param_prob_reason(struct sk_buff *skb, + u8 code, int pos, + enum skb_drop_reason reason); struct flowi6; struct in6_addr; @@ -90,4 +91,11 @@ extern void icmpv6_flow_init(struct sock *sk, const struct in6_addr *saddr, const struct in6_addr *daddr, int oif); + +static inline void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos) +{ + icmpv6_param_prob_reason(skb, code, pos, + SKB_DROP_REASON_NOT_SPECIFIED); +} + #endif diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 5c6129d50..2d232f1ff 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -602,12 +602,13 @@ out_bh_enable: } EXPORT_SYMBOL(icmp6_send); -/* Slightly more convenient version of icmp6_send. +/* Slightly more convenient version of icmp6_send with drop reasons. */ -void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos) +void icmpv6_param_prob_reason(struct sk_buff *skb, u8 code, int pos, + enum skb_drop_reason reason) { icmp6_send(skb, ICMPV6_PARAMPROB, code, pos, NULL, IP6CB(skb)); - kfree_skb(skb); + kfree_skb_reason(skb, reason); } /* Generate icmpv6 with type/code ICMPV6_DEST_UNREACH/ICMPV6_ADDR_UNREACH