netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cannot set IPv6 address
@ 2016-11-16 15:22 Saeed Mahameed
  2016-11-16 15:29 ` Eric Dumazet
  2016-11-16 15:34 ` David Lebrun
  0 siblings, 2 replies; 5+ messages in thread
From: Saeed Mahameed @ 2016-11-16 15:22 UTC (permalink / raw)
  To: david.lebrun; +Cc: Linux Netdev List, Doron Tsur, Majd Dibbiny

Hi David,

The following commit introduced a new issue when setting IPv6 address
via the following command:

/sbin/ip -6 addr add 2001:0db8:0:f112::1/64 dev enp2s2
RTNETLINK answers: Operation not supported

Offending commit:

commit 6c8702c60b88651072460f3f4026c7dfe2521d12
Author: David Lebrun <david.lebrun@uclouvain.be>
Date:   Tue Nov 8 14:57:41 2016 +0100

    ipv6: sr: add support for SRH encapsulation and injection with lwtunnels

    This patch creates a new type of interfaceless lightweight tunnel (SEG6),
    enabling the encapsulation and injection of SRH within locally emitted
    packets and forwarded packets.

    >From a configuration viewpoint, a seg6 tunnel would be configured
as follows:

      ip -6 ro ad fc00::1/128 encap seg6 mode encap segs
fc42::1,fc42::2,fc42::3 dev eth0

    Any packet whose destination address is fc00::1 would thus be encapsulated
    within an outer IPv6 header containing the SRH with three
segments, and would
    actually be routed to the first segment of the list. If `mode inline' was
    specified instead of `mode encap', then the SRH would be directly inserted
    after the IPv6 header without outer encapsulation.

    The inline mode is only available if CONFIG_IPV6_SEG6_INLINE is
enabled. This
    feature was made configurable because direct header insertion may break
    several mechanisms such as PMTUD or IPSec AH.

    Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
    Signed-off-by: David S. Miller <davem@davemloft.net>


Can you check ? Are we missing something here ?

Thanks,
Saeed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cannot set IPv6 address
  2016-11-16 15:22 Cannot set IPv6 address Saeed Mahameed
@ 2016-11-16 15:29 ` Eric Dumazet
  2016-11-17  9:55   ` Saeed Mahameed
  2016-11-16 15:34 ` David Lebrun
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2016-11-16 15:29 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: david.lebrun, Linux Netdev List, Doron Tsur, Majd Dibbiny

On Wed, 2016-11-16 at 17:22 +0200, Saeed Mahameed wrote:
> Hi David,
> 
> The following commit introduced a new issue when setting IPv6 address
> via the following command:
> 
> /sbin/ip -6 addr add 2001:0db8:0:f112::1/64 dev enp2s2
> RTNETLINK answers: Operation not supported
> 
> Offending commit:
> 
> commit 6c8702c60b88651072460f3f4026c7dfe2521d12
> Author: David Lebrun <david.lebrun@uclouvain.be>
> Date:   Tue Nov 8 14:57:41 2016 +0100
> 
>     ipv6: sr: add support for SRH encapsulation and injection with lwtunnels
> 
>     This patch creates a new type of interfaceless lightweight tunnel (SEG6),
>     enabling the encapsulation and injection of SRH within locally emitted
>     packets and forwarded packets.
> 
>     >From a configuration viewpoint, a seg6 tunnel would be configured
> as follows:
> 
>       ip -6 ro ad fc00::1/128 encap seg6 mode encap segs
> fc42::1,fc42::2,fc42::3 dev eth0
> 
>     Any packet whose destination address is fc00::1 would thus be encapsulated
>     within an outer IPv6 header containing the SRH with three
> segments, and would
>     actually be routed to the first segment of the list. If `mode inline' was
>     specified instead of `mode encap', then the SRH would be directly inserted
>     after the IPv6 header without outer encapsulation.
> 
>     The inline mode is only available if CONFIG_IPV6_SEG6_INLINE is
> enabled. This
>     feature was made configurable because direct header insertion may break
>     several mechanisms such as PMTUD or IPSec AH.
> 
>     Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> 
> Can you check ? Are we missing something here ?

Sure, patch is under review. Please look at netdev archives and/or
ozlabs

https://patchwork.ozlabs.org/patch/695060/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cannot set IPv6 address
  2016-11-16 15:22 Cannot set IPv6 address Saeed Mahameed
  2016-11-16 15:29 ` Eric Dumazet
@ 2016-11-16 15:34 ` David Lebrun
  2016-11-17 10:01   ` Saeed Mahameed
  1 sibling, 1 reply; 5+ messages in thread
From: David Lebrun @ 2016-11-16 15:34 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: Linux Netdev List, Doron Tsur, Majd Dibbiny


[-- Attachment #1.1: Type: text/plain, Size: 955 bytes --]

On 11/16/2016 04:22 PM, Saeed Mahameed wrote:
> Hi David,
> 
> The following commit introduced a new issue when setting IPv6 address
> via the following command:
> 
> /sbin/ip -6 addr add 2001:0db8:0:f112::1/64 dev enp2s2
> RTNETLINK answers: Operation not supported
> 
> Offending commit:
> 
> commit 6c8702c60b88651072460f3f4026c7dfe2521d12

Saeed,

Do you have LWTUNNEL enabled ? This commit introduced a bug causing IPv6
initialization to fail if LWTUNNEL is disabled. The patch has been
submitted to the list and is pending approval from DaveM.

If you see something like

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

in you dmesg logs then it would confirm my theory.

Short fix: enable CONFIG_LWTUNNEL or apply patch in attachment

David

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-ipv6-sr-add-option-to-control-lwtunnel-support.patch --]
[-- Type: text/x-patch; name="0001-ipv6-sr-add-option-to-control-lwtunnel-support.patch", Size: 4643 bytes --]

From 51775d7223b6d5bd16cb5d09df9ba494fac8ffda Mon Sep 17 00:00:00 2001
From: David Lebrun <david.lebrun@uclouvain.be>
Date: Tue, 15 Nov 2016 14:57:52 +0100
Subject: [PATCH net-next 1/1] 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 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 <lorenzo@google.com>
Suggested-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
---
 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);
 }
-- 
2.7.3


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Cannot set IPv6 address
  2016-11-16 15:29 ` Eric Dumazet
@ 2016-11-17  9:55   ` Saeed Mahameed
  0 siblings, 0 replies; 5+ messages in thread
From: Saeed Mahameed @ 2016-11-17  9:55 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: david.lebrun, Linux Netdev List, Doron Tsur, Majd Dibbiny

On Wed, Nov 16, 2016 at 5:29 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2016-11-16 at 17:22 +0200, Saeed Mahameed wrote:
>> Hi David,
>>
>> The following commit introduced a new issue when setting IPv6 address
>> via the following command:
>>
>> /sbin/ip -6 addr add 2001:0db8:0:f112::1/64 dev enp2s2
>> RTNETLINK answers: Operation not supported
>>
>> Offending commit:
>>
>> commit 6c8702c60b88651072460f3f4026c7dfe2521d12
>> Author: David Lebrun <david.lebrun@uclouvain.be>
>> Date:   Tue Nov 8 14:57:41 2016 +0100
>>
>>     ipv6: sr: add support for SRH encapsulation and injection with lwtunnels
>>
>>     This patch creates a new type of interfaceless lightweight tunnel (SEG6),
>>     enabling the encapsulation and injection of SRH within locally emitted
>>     packets and forwarded packets.
>>
>>     >From a configuration viewpoint, a seg6 tunnel would be configured
>> as follows:
>>
>>       ip -6 ro ad fc00::1/128 encap seg6 mode encap segs
>> fc42::1,fc42::2,fc42::3 dev eth0
>>
>>     Any packet whose destination address is fc00::1 would thus be encapsulated
>>     within an outer IPv6 header containing the SRH with three
>> segments, and would
>>     actually be routed to the first segment of the list. If `mode inline' was
>>     specified instead of `mode encap', then the SRH would be directly inserted
>>     after the IPv6 header without outer encapsulation.
>>
>>     The inline mode is only available if CONFIG_IPV6_SEG6_INLINE is
>> enabled. This
>>     feature was made configurable because direct header insertion may break
>>     several mechanisms such as PMTUD or IPSec AH.
>>
>>     Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
>>     Signed-off-by: David S. Miller <davem@davemloft.net>
>>
>>
>> Can you check ? Are we missing something here ?
>
> Sure, patch is under review. Please look at netdev archives and/or
> ozlabs
>
> https://patchwork.ozlabs.org/patch/695060/
>
>

Thank you Eric.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cannot set IPv6 address
  2016-11-16 15:34 ` David Lebrun
@ 2016-11-17 10:01   ` Saeed Mahameed
  0 siblings, 0 replies; 5+ messages in thread
From: Saeed Mahameed @ 2016-11-17 10:01 UTC (permalink / raw)
  To: David Lebrun; +Cc: Linux Netdev List, Doron Tsur, Majd Dibbiny

On Wed, Nov 16, 2016 at 5:34 PM, David Lebrun <david.lebrun@uclouvain.be> wrote:
> On 11/16/2016 04:22 PM, Saeed Mahameed wrote:
>> Hi David,
>>
>> The following commit introduced a new issue when setting IPv6 address
>> via the following command:
>>
>> /sbin/ip -6 addr add 2001:0db8:0:f112::1/64 dev enp2s2
>> RTNETLINK answers: Operation not supported
>>
>> Offending commit:
>>
>> commit 6c8702c60b88651072460f3f4026c7dfe2521d12
>
> Saeed,
>
> Do you have LWTUNNEL enabled ? This commit introduced a bug causing IPv6

Disabled.

> initialization to fail if LWTUNNEL is disabled. The patch has been
> submitted to the list and is pending approval from DaveM.
>
> If you see something like
>
> 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
>
> in you dmesg logs then it would confirm my theory.
>
> Short fix: enable CONFIG_LWTUNNEL or apply patch in attachment
>
> David

Looks like the fix was applied [1],
Thanks for the quick response.

[1] https://patchwork.ozlabs.org/patch/695060/.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-17 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-16 15:22 Cannot set IPv6 address Saeed Mahameed
2016-11-16 15:29 ` Eric Dumazet
2016-11-17  9:55   ` Saeed Mahameed
2016-11-16 15:34 ` David Lebrun
2016-11-17 10:01   ` Saeed Mahameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).