net: icmp: introduce function icmpv6_param_prob_reason()
authorMenglong Dong <imagedong@tencent.com>
Wed, 13 Apr 2022 08:15:56 +0000 (16:15 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Apr 2022 12:09:57 +0000 (13:09 +0100)
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 <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>
include/linux/icmpv6.h
net/ipv6/icmp.c

index 9055cb380ee2411b438e9b4fab90fa9e8362cf17..db0f4fcfdaf4f138d75dc6c4073cb286364f2923 100644 (file)
@@ -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;
@@ -91,6 +92,12 @@ extern void                          icmpv6_flow_init(struct sock *sk,
                                                         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);
+}
+
 static inline bool icmpv6_is_err(int type)
 {
        switch (type) {
index 01c8003c9fc94534c6ec72808061f8b7e0295de1..61770220774ee09b8f780290776ec45353c75c9a 100644 (file)
@@ -629,12 +629,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