Commit 1ad6d548 authored by Menglong Dong's avatar Menglong Dong Committed by David S. Miller

net: icmp: introduce function icmpv6_param_prob_reason()

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: 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 2edc1a38
...@@ -79,8 +79,9 @@ extern int icmpv6_init(void); ...@@ -79,8 +79,9 @@ extern int icmpv6_init(void);
extern int icmpv6_err_convert(u8 type, u8 code, extern int icmpv6_err_convert(u8 type, u8 code,
int *err); int *err);
extern void icmpv6_cleanup(void); extern void icmpv6_cleanup(void);
extern void icmpv6_param_prob(struct sk_buff *skb, extern void icmpv6_param_prob_reason(struct sk_buff *skb,
u8 code, int pos); u8 code, int pos,
enum skb_drop_reason reason);
struct flowi6; struct flowi6;
struct in6_addr; struct in6_addr;
...@@ -91,6 +92,12 @@ extern void icmpv6_flow_init(struct sock *sk, ...@@ -91,6 +92,12 @@ extern void icmpv6_flow_init(struct sock *sk,
const struct in6_addr *daddr, const struct in6_addr *daddr,
int oif); 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) static inline bool icmpv6_is_err(int type)
{ {
switch (type) { switch (type) {
......
...@@ -629,12 +629,13 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, ...@@ -629,12 +629,13 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
} }
EXPORT_SYMBOL(icmp6_send); 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)); 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 /* Generate icmpv6 with type/code ICMPV6_DEST_UNREACH/ICMPV6_ADDR_UNREACH
......
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