Skip to content

Commit 46738b1

Browse files
David Lebrundavem330
authored andcommitted
ipv6: sr: add option to control lwtunnel support
This patch adds a new option CONFIG_IPV6_SEG6_LWTUNNEL to enable/disable support of encapsulation with the lightweight tunnels. When this option is enabled, CONFIG_LWTUNNEL is automatically selected. Fix commit 6c8702c ("ipv6: sr: add support for SRH encapsulation and injection with lwtunnels") Without a proper option to control lwtunnel support for SR-IPv6, if CONFIG_LWTUNNEL=n then the IPv6 initialization fails as a consequence of seg6_iptunnel_init() failure with EOPNOTSUPP: NET: Registered protocol family 10 IPv6: Attempt to unregister permanent protocol 6 IPv6: Attempt to unregister permanent protocol 136 IPv6: Attempt to unregister permanent protocol 17 NET: Unregistered protocol family 10 Tested (compiling, booting, and loading ipv6 module when relevant) with possible combinations of CONFIG_IPV6={y,m,n}, CONFIG_IPV6_SEG6_LWTUNNEL={y,n} and CONFIG_LWTUNNEL={y,n}. Reported-by: Lorenzo Colitti <[email protected]> Suggested-by: Roopa Prabhu <[email protected]> Signed-off-by: David Lebrun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 21b23da commit 46738b1

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

net/ipv6/Kconfig

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,20 @@ config IPV6_PIMSM_V2
289289
Support for IPv6 PIM multicast routing protocol PIM-SMv2.
290290
If unsure, say N.
291291

292+
config IPV6_SEG6_LWTUNNEL
293+
bool "IPv6: Segment Routing Header encapsulation support"
294+
depends on IPV6
295+
select LWTUNNEL
296+
---help---
297+
Support for encapsulation of packets within an outer IPv6
298+
header and a Segment Routing Header using the lightweight
299+
tunnels mechanism.
300+
301+
If unsure, say N.
302+
292303
config IPV6_SEG6_INLINE
293304
bool "IPv6: direct Segment Routing Header insertion "
294-
depends on IPV6
305+
depends on IPV6_SEG6_LWTUNNEL
295306
---help---
296307
Support for direct insertion of the Segment Routing Header,
297308
also known as inline mode. Be aware that direct insertion of

net/ipv6/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ipv6-objs := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \
99
route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \
1010
raw.o icmp.o mcast.o reassembly.o tcp_ipv6.o ping.o \
1111
exthdrs.o datagram.o ip6_flowlabel.o inet6_connection_sock.o \
12-
udp_offload.o seg6.o seg6_iptunnel.o
12+
udp_offload.o seg6.o
1313

1414
ipv6-offload := ip6_offload.o tcpv6_offload.o exthdrs_offload.o
1515

@@ -23,6 +23,8 @@ ipv6-$(CONFIG_IPV6_MULTIPLE_TABLES) += fib6_rules.o
2323
ipv6-$(CONFIG_PROC_FS) += proc.o
2424
ipv6-$(CONFIG_SYN_COOKIES) += syncookies.o
2525
ipv6-$(CONFIG_NETLABEL) += calipso.o
26+
ipv6-$(CONFIG_IPV6_SEG6_LWTUNNEL) += seg6_iptunnel.o
27+
ipv6-$(CONFIG_IPV6_SEG6_HMAC) += seg6_hmac.o
2628

2729
ipv6-objs += $(ipv6-y)
2830

@@ -44,7 +46,6 @@ obj-$(CONFIG_IPV6_SIT) += sit.o
4446
obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o
4547
obj-$(CONFIG_IPV6_GRE) += ip6_gre.o
4648
obj-$(CONFIG_IPV6_FOU) += fou6.o
47-
obj-$(CONFIG_IPV6_SEG6_HMAC) += seg6_hmac.o
4849

4950
obj-y += addrconf_core.o exthdrs_core.o ip6_checksum.o ip6_icmp.o
5051
obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6-offload)

net/ipv6/seg6.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,11 @@ int __init seg6_init(void)
451451
if (err)
452452
goto out_unregister_genl;
453453

454+
#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
454455
err = seg6_iptunnel_init();
455456
if (err)
456457
goto out_unregister_pernet;
458+
#endif
457459

458460
#ifdef CONFIG_IPV6_SEG6_HMAC
459461
err = seg6_hmac_init();
@@ -467,10 +469,14 @@ int __init seg6_init(void)
467469
return err;
468470
#ifdef CONFIG_IPV6_SEG6_HMAC
469471
out_unregister_iptun:
472+
#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
470473
seg6_iptunnel_exit();
471474
#endif
475+
#endif
476+
#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
472477
out_unregister_pernet:
473478
unregister_pernet_subsys(&ip6_segments_ops);
479+
#endif
474480
out_unregister_genl:
475481
genl_unregister_family(&seg6_genl_family);
476482
goto out;
@@ -481,7 +487,9 @@ void seg6_exit(void)
481487
#ifdef CONFIG_IPV6_SEG6_HMAC
482488
seg6_hmac_exit();
483489
#endif
490+
#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
484491
seg6_iptunnel_exit();
492+
#endif
485493
unregister_pernet_subsys(&ip6_segments_ops);
486494
genl_unregister_family(&seg6_genl_family);
487495
}

0 commit comments

Comments
 (0)