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

TOMOYO Linux Cross Reference
Linux/include/net/seg6.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-or-later */
  2 /*
  3  *  SR-IPv6 implementation
  4  *
  5  *  Author:
  6  *  David Lebrun <david.lebrun@uclouvain.be>
  7  */
  8 
  9 #ifndef _NET_SEG6_H
 10 #define _NET_SEG6_H
 11 
 12 #include <linux/net.h>
 13 #include <linux/ipv6.h>
 14 #include <linux/seg6.h>
 15 #include <linux/rhashtable-types.h>
 16 
 17 static inline void update_csum_diff4(struct sk_buff *skb, __be32 from,
 18                                      __be32 to)
 19 {
 20         __be32 diff[] = { ~from, to };
 21 
 22         skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum);
 23 }
 24 
 25 static inline void update_csum_diff16(struct sk_buff *skb, __be32 *from,
 26                                       __be32 *to)
 27 {
 28         __be32 diff[] = {
 29                 ~from[0], ~from[1], ~from[2], ~from[3],
 30                 to[0], to[1], to[2], to[3],
 31         };
 32 
 33         skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum);
 34 }
 35 
 36 struct seg6_pernet_data {
 37         struct mutex lock;
 38         struct in6_addr __rcu *tun_src;
 39 #ifdef CONFIG_IPV6_SEG6_HMAC
 40         struct rhashtable hmac_infos;
 41 #endif
 42 };
 43 
 44 static inline struct seg6_pernet_data *seg6_pernet(struct net *net)
 45 {
 46 #if IS_ENABLED(CONFIG_IPV6)
 47         return net->ipv6.seg6_data;
 48 #else
 49         return NULL;
 50 #endif
 51 }
 52 
 53 extern int seg6_init(void);
 54 extern void seg6_exit(void);
 55 #ifdef CONFIG_IPV6_SEG6_LWTUNNEL
 56 extern int seg6_iptunnel_init(void);
 57 extern void seg6_iptunnel_exit(void);
 58 extern int seg6_local_init(void);
 59 extern void seg6_local_exit(void);
 60 #else
 61 static inline int seg6_iptunnel_init(void) { return 0; }
 62 static inline void seg6_iptunnel_exit(void) {}
 63 static inline int seg6_local_init(void) { return 0; }
 64 static inline void seg6_local_exit(void) {}
 65 #endif
 66 
 67 extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len, bool reduced);
 68 extern struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags);
 69 extern void seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt);
 70 extern int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh,
 71                              int proto);
 72 extern int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh);
 73 extern int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
 74                                u32 tbl_id);
 75 
 76 /* If the packet which invoked an ICMP error contains an SRH return
 77  * the true destination address from within the SRH, otherwise use the
 78  * destination address in the IP header.
 79  */
 80 static inline const struct in6_addr *seg6_get_daddr(struct sk_buff *skb,
 81                                                     struct inet6_skb_parm *opt)
 82 {
 83         struct ipv6_sr_hdr *srh;
 84 
 85         if (opt->flags & IP6SKB_SEG6) {
 86                 srh = (struct ipv6_sr_hdr *)(skb->data + opt->srhoff);
 87                 return  &srh->segments[0];
 88         }
 89 
 90         return NULL;
 91 }
 92 
 93 
 94 #endif
 95 

~ [ 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