From patchwork Tue Nov 15 15:14:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lebrun X-Patchwork-Id: 695060 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tJ9qC2QHMz9t0m for ; Wed, 16 Nov 2016 02:12:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uclouvain.be header.i=@uclouvain.be header.b="wnb58Pi1"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936330AbcKOPMT (ORCPT ); Tue, 15 Nov 2016 10:12:19 -0500 Received: from smtp.sgsi.ucl.ac.be ([130.104.5.67]:42101 "EHLO smtp6.sgsi.ucl.ac.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932406AbcKOPMQ (ORCPT ); Tue, 15 Nov 2016 10:12:16 -0500 Received: from mailboxes.uclouvain.be (mailboxes.uclouvain.be [130.104.6.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp6.sgsi.ucl.ac.be (Postfix) with ESMTPS id 896CD67D9CD; Tue, 15 Nov 2016 16:12:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.9.2 smtp6.sgsi.ucl.ac.be 896CD67D9CD DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=uclouvain.be; s=selucl; t=1479222727; bh=scybwFJvy/Q3ogtGQa6D9K+6PLal7dzVeBuxaY2K+sE=; h=From:To:CC:Subject:Date; b=wnb58Pi1gGExdzMyASKl+rHb9CLRNU9gMRMiL88ED8Wg30UR7baowwZkQwBWeCfzP k7W889o9aXzibL5ks1h8HQ4E9UdfCcpEAqn7YjQgQjZKlxAo68GTjHXjxnox4qdhSc A7JEHntBVxVEFD/z0rP18VktcZV8/XcP9QClOrUw= X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.99.2 at smtp-6 Received: from localhost.localdomain (130.104.228.78) by ucl-mbx04.OASIS.UCLOUVAIN.BE (10.10.10.24) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 15 Nov 2016 16:12:07 +0100 From: David Lebrun To: CC: , , , David Lebrun Subject: [PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support Date: Tue, 15 Nov 2016 16:14:04 +0100 Message-ID: <1479222844-20301-1-git-send-email-david.lebrun@uclouvain.be> X-Mailer: git-send-email 2.7.3 MIME-Version: 1.0 X-Originating-IP: [130.104.228.78] X-ClientProxiedBy: UCL-CAS03.OASIS.UCLOUVAIN.BE (10.10.10.43) To ucl-mbx04.OASIS.UCLOUVAIN.BE (10.10.10.24) X-SGSI-Information: X-SGSI-MailScanner-ID: 896CD67D9CD.A690D X-SGSI-MailScanner: Found to be clean X-SGSI-SpamCheck: n'est pas un polluriel, SpamAssassin (not cached, score=-5.895, requis 5, autolearn=not spam, ALL_TRUSTED -2.00, BAYES_00 -1.90, DKIM_SIGNED 0.10, DKIM_VALID -0.10, DKIM_VALID_AU -0.10, MISSING_FROM 1.00, RP_MATCHES_RCVD -2.90, URIBL_BLOCKED 0.00) X-SGSI-From: david.lebrun@uclouvain.be X-SGSI-Spam-Status: No Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 6c8702c60b88 ("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 Suggested-by: Roopa Prabhu Signed-off-by: David Lebrun --- net/ipv6/Kconfig | 13 ++++++++++++- net/ipv6/Makefile | 5 +++-- net/ipv6/seg6.c | 8 ++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index 0f00811..ec1267e 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig @@ -289,9 +289,20 @@ config IPV6_PIMSM_V2 Support for IPv6 PIM multicast routing protocol PIM-SMv2. If unsure, say N. +config IPV6_SEG6_LWTUNNEL + bool "IPv6: Segment Routing Header encapsulation support" + depends on IPV6 + select LWTUNNEL + ---help--- + Support for encapsulation of packets within an outer IPv6 + header and a Segment Routing Header using the lightweight + tunnels mechanism. + + If unsure, say N. + config IPV6_SEG6_INLINE bool "IPv6: direct Segment Routing Header insertion " - depends on IPV6 + depends on IPV6_SEG6_LWTUNNEL ---help--- Support for direct insertion of the Segment Routing Header, also known as inline mode. Be aware that direct insertion of diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index 129cad2..a9e9fec 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile @@ -9,7 +9,7 @@ ipv6-objs := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \ route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \ raw.o icmp.o mcast.o reassembly.o tcp_ipv6.o ping.o \ exthdrs.o datagram.o ip6_flowlabel.o inet6_connection_sock.o \ - udp_offload.o seg6.o seg6_iptunnel.o + udp_offload.o seg6.o ipv6-offload := ip6_offload.o tcpv6_offload.o exthdrs_offload.o @@ -23,6 +23,8 @@ ipv6-$(CONFIG_IPV6_MULTIPLE_TABLES) += fib6_rules.o ipv6-$(CONFIG_PROC_FS) += proc.o ipv6-$(CONFIG_SYN_COOKIES) += syncookies.o ipv6-$(CONFIG_NETLABEL) += calipso.o +ipv6-$(CONFIG_IPV6_SEG6_LWTUNNEL) += seg6_iptunnel.o +ipv6-$(CONFIG_IPV6_SEG6_HMAC) += seg6_hmac.o ipv6-objs += $(ipv6-y) @@ -44,7 +46,6 @@ obj-$(CONFIG_IPV6_SIT) += sit.o obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o obj-$(CONFIG_IPV6_GRE) += ip6_gre.o obj-$(CONFIG_IPV6_FOU) += fou6.o -obj-$(CONFIG_IPV6_SEG6_HMAC) += seg6_hmac.o obj-y += addrconf_core.o exthdrs_core.o ip6_checksum.o ip6_icmp.o obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6-offload) diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c index 50f6e06..b172d85 100644 --- a/net/ipv6/seg6.c +++ b/net/ipv6/seg6.c @@ -451,9 +451,11 @@ int __init seg6_init(void) if (err) goto out_unregister_genl; +#ifdef CONFIG_IPV6_SEG6_LWTUNNEL err = seg6_iptunnel_init(); if (err) goto out_unregister_pernet; +#endif #ifdef CONFIG_IPV6_SEG6_HMAC err = seg6_hmac_init(); @@ -467,10 +469,14 @@ int __init seg6_init(void) return err; #ifdef CONFIG_IPV6_SEG6_HMAC out_unregister_iptun: +#ifdef CONFIG_IPV6_SEG6_LWTUNNEL seg6_iptunnel_exit(); #endif +#endif +#ifdef CONFIG_IPV6_SEG6_LWTUNNEL out_unregister_pernet: unregister_pernet_subsys(&ip6_segments_ops); +#endif out_unregister_genl: genl_unregister_family(&seg6_genl_family); goto out; @@ -481,7 +487,9 @@ void seg6_exit(void) #ifdef CONFIG_IPV6_SEG6_HMAC seg6_hmac_exit(); #endif +#ifdef CONFIG_IPV6_SEG6_LWTUNNEL seg6_iptunnel_exit(); +#endif unregister_pernet_subsys(&ip6_segments_ops); genl_unregister_family(&seg6_genl_family); }