1 #ifndef _LINUX_ICMPV6_H
2 #define _LINUX_ICMPV6_H
4 #include <linux/skbuff.h>
5 #include <linux/ipv6.h>
6 #include <uapi/linux/icmpv6.h>
8 static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
10 return (struct icmp6hdr *)skb_transport_header(skb);
13 #include <linux/netdevice.h>
15 #if IS_ENABLED(CONFIG_IPV6)
17 typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
18 const struct in6_addr *force_saddr,
19 const struct inet6_skb_parm *parm);
20 void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
21 const struct in6_addr *force_saddr,
22 const struct inet6_skb_parm *parm);
23 #if IS_BUILTIN(CONFIG_IPV6)
24 static inline void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
25 const struct inet6_skb_parm *parm)
27 icmp6_send(skb, type, code, info, NULL, parm);
29 static inline int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
31 BUILD_BUG_ON(fn != icmp6_send);
34 static inline int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn)
36 BUILD_BUG_ON(fn != icmp6_send);
40 extern void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
41 const struct inet6_skb_parm *parm);
42 extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
43 extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
46 static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
48 __icmpv6_send(skb, type, code, info, IP6CB(skb));
51 int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
52 unsigned int data_len);
54 #if IS_ENABLED(CONFIG_NF_NAT)
55 void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);
57 static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
59 struct inet6_skb_parm parm = { 0 };
60 __icmpv6_send(skb_in, type, code, info, &parm);
66 static inline void icmpv6_send(struct sk_buff *skb,
67 u8 type, u8 code, __u32 info)
71 static inline void icmpv6_ndo_send(struct sk_buff *skb,
72 u8 type, u8 code, __u32 info)
77 extern int icmpv6_init(void);
78 extern int icmpv6_err_convert(u8 type, u8 code,
80 extern void icmpv6_cleanup(void);
81 extern void icmpv6_param_prob(struct sk_buff *skb,
86 extern void icmpv6_flow_init(struct sock *sk,
89 const struct in6_addr *saddr,
90 const struct in6_addr *daddr,