~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/icmpv6.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_ICMPV6_H
  3 #define _LINUX_ICMPV6_H
  4 
  5 #include <linux/skbuff.h>
  6 #include <linux/ipv6.h>
  7 #include <uapi/linux/icmpv6.h>
  8 
  9 static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
 10 {
 11         return (struct icmp6hdr *)skb_transport_header(skb);
 12 }
 13 
 14 #include <linux/netdevice.h>
 15 
 16 #if IS_ENABLED(CONFIG_IPV6)
 17 
 18 typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 19                              const struct in6_addr *force_saddr,
 20                              const struct inet6_skb_parm *parm);
 21 void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 22                 const struct in6_addr *force_saddr,
 23                 const struct inet6_skb_parm *parm);
 24 #if IS_BUILTIN(CONFIG_IPV6)
 25 static inline void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 26                                  const struct inet6_skb_parm *parm)
 27 {
 28         icmp6_send(skb, type, code, info, NULL, parm);
 29 }
 30 static inline int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
 31 {
 32         BUILD_BUG_ON(fn != icmp6_send);
 33         return 0;
 34 }
 35 static inline int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn)
 36 {
 37         BUILD_BUG_ON(fn != icmp6_send);
 38         return 0;
 39 }
 40 #else
 41 extern void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 42                           const struct inet6_skb_parm *parm);
 43 extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
 44 extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
 45 #endif
 46 
 47 static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
 48 {
 49         __icmpv6_send(skb, type, code, info, IP6CB(skb));
 50 }
 51 
 52 int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
 53                                unsigned int data_len);
 54 
 55 #if IS_ENABLED(CONFIG_NF_NAT)
 56 void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);
 57 #else
 58 static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
 59 {
 60         struct inet6_skb_parm parm = { 0 };
 61         __icmpv6_send(skb_in, type, code, info, &parm);
 62 }
 63 #endif
 64 
 65 #else
 66 
 67 static inline void icmpv6_send(struct sk_buff *skb,
 68                                u8 type, u8 code, __u32 info)
 69 {
 70 }
 71 
 72 static inline void icmpv6_ndo_send(struct sk_buff *skb,
 73                                    u8 type, u8 code, __u32 info)
 74 {
 75 }
 76 #endif
 77 
 78 extern int                              icmpv6_init(void);
 79 extern int                              icmpv6_err_convert(u8 type, u8 code,
 80                                                            int *err);
 81 extern void                             icmpv6_cleanup(void);
 82 extern void                             icmpv6_param_prob_reason(struct sk_buff *skb,
 83                                                                  u8 code, int pos,
 84                                                                  enum skb_drop_reason reason);
 85 
 86 struct flowi6;
 87 struct in6_addr;
 88 
 89 void icmpv6_flow_init(const struct sock *sk, struct flowi6 *fl6, u8 type,
 90                       const struct in6_addr *saddr,
 91                       const struct in6_addr *daddr, int oif);
 92 
 93 static inline void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos)
 94 {
 95         icmpv6_param_prob_reason(skb, code, pos,
 96                                  SKB_DROP_REASON_NOT_SPECIFIED);
 97 }
 98 
 99 static inline bool icmpv6_is_err(int type)
100 {
101         switch (type) {
102         case ICMPV6_DEST_UNREACH:
103         case ICMPV6_PKT_TOOBIG:
104         case ICMPV6_TIME_EXCEED:
105         case ICMPV6_PARAMPROB:
106                 return true;
107         }
108 
109         return false;
110 }
111 
112 #endif
113 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php