File tree Expand file tree Collapse file tree 8 files changed +434
-0
lines changed Expand file tree Collapse file tree 8 files changed +434
-0
lines changed Original file line number Diff line number Diff line change 1111
1212#include  <linux/rpl.h> 
1313
14+ #if  IS_ENABLED (CONFIG_IPV6_RPL_LWTUNNEL )
15+ extern  int  rpl_init (void );
16+ extern  void  rpl_exit (void );
17+ #else 
18+ static  inline  int  rpl_init (void )
19+ {
20+ 	return  0 ;
21+ }
22+ 
23+ static  inline  void  rpl_exit (void ) {}
24+ #endif 
25+ 
1426/* Worst decompression memory usage ipv6 address (16) + pad 7 */ 
1527#define  IPV6_RPL_SRH_WORST_SWAP_SIZE  (sizeof(struct in6_addr) + 7)
1628
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ enum lwtunnel_encap_types {
1313	LWTUNNEL_ENCAP_SEG6 ,
1414	LWTUNNEL_ENCAP_BPF ,
1515	LWTUNNEL_ENCAP_SEG6_LOCAL ,
16+ 	LWTUNNEL_ENCAP_RPL ,
1617	__LWTUNNEL_ENCAP_MAX ,
1718};
1819
Original file line number Diff line number Diff line change 1+ /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 
2+ /* 
3+  *  IPv6 RPL-SR implementation 
4+  * 
5+  *  Author: 
6+  *  (C) 2020 Alexander Aring <[email protected] > 7+  */ 
8+ 
9+ #ifndef  _UAPI_LINUX_RPL_IPTUNNEL_H 
10+ #define  _UAPI_LINUX_RPL_IPTUNNEL_H 
11+ 
12+ enum  {
13+ 	RPL_IPTUNNEL_UNSPEC ,
14+ 	RPL_IPTUNNEL_SRH ,
15+ 	__RPL_IPTUNNEL_MAX ,
16+ };
17+ #define  RPL_IPTUNNEL_MAX  (__RPL_IPTUNNEL_MAX - 1)
18+ 
19+ #define  RPL_IPTUNNEL_SRH_SIZE (srh ) (((srh)->hdrlen + 1) << 3)
20+ 
21+ #endif 
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ static const char *lwtunnel_encap_str(enum lwtunnel_encap_types encap_type)
4141		return  "BPF" ;
4242	case  LWTUNNEL_ENCAP_SEG6_LOCAL :
4343		return  "SEG6LOCAL" ;
44+ 	case  LWTUNNEL_ENCAP_RPL :
45+ 		return  "RPL" ;
4446	case  LWTUNNEL_ENCAP_IP6 :
4547	case  LWTUNNEL_ENCAP_IP :
4648	case  LWTUNNEL_ENCAP_NONE :
Original file line number Diff line number Diff line change @@ -303,4 +303,14 @@ config IPV6_SEG6_BPF
303303	depends on IPV6_SEG6_LWTUNNEL
304304	depends on IPV6 = y
305305
306+ config IPV6_RPL_LWTUNNEL
307+ 	bool "IPv6: RPL Source Routing Header support"
308+ 	depends on IPV6
309+ 	select LWTUNNEL
310+ 	---help---
311+ 	  Support for RFC6554 RPL Source Routing Header using the lightweight
312+ 	  tunnels mechanism.
313+ 
314+ 	  If unsure, say N.
315+ 
306316endif # IPV6
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ ipv6-$(CONFIG_SYN_COOKIES) += syncookies.o
2626ipv6-$(CONFIG_NETLABEL)  += calipso.o
2727ipv6-$(CONFIG_IPV6_SEG6_LWTUNNEL)  += seg6_iptunnel.o seg6_local.o
2828ipv6-$(CONFIG_IPV6_SEG6_HMAC)  += seg6_hmac.o
29+ ipv6-$(CONFIG_IPV6_RPL_LWTUNNEL)  += rpl_iptunnel.o
2930
3031ipv6-objs  += $(ipv6-y ) 
3132
Original file line number Diff line number Diff line change 5959#endif 
6060#include  <net/calipso.h> 
6161#include  <net/seg6.h> 
62+ #include  <net/rpl.h> 
6263
6364#include  <linux/uaccess.h> 
6465#include  <linux/mroute6.h> 
@@ -1114,6 +1115,10 @@ static int __init inet6_init(void)
11141115	if  (err )
11151116		goto seg6_fail ;
11161117
1118+ 	err  =  rpl_init ();
1119+ 	if  (err )
1120+ 		goto rpl_fail ;
1121+ 
11171122	err  =  igmp6_late_init ();
11181123	if  (err )
11191124		goto igmp6_late_err ;
@@ -1136,6 +1141,8 @@ static int __init inet6_init(void)
11361141	igmp6_late_cleanup ();
11371142#endif 
11381143igmp6_late_err :
1144+ 	rpl_exit ();
1145+ rpl_fail :
11391146	seg6_exit ();
11401147seg6_fail :
11411148	calipso_exit ();
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments