Re: [PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support

2016-11-23 Thread Alexei Starovoitov
On Wed, Nov 23, 2016 at 10:28:29AM +0100, David Lebrun wrote:
> On 11/23/2016 08:34 AM, Roopa Prabhu wrote:
> > I can't seem to reproduce the problem you are seeing. still trying..
> > I don't have CONFIG_LWTUNNEL set nor any of the other SEG6 configs.
> > My CONFIG_IPV6 is on and compiled as a module. I have also tried disabling 
> > it.
> > If you can send me the config, I can try again. Looking back at the patches,
> > I do see a few things below ..but they may not fix your problem directly.
> > 
> > Though I had none of the ipv6 segment routing configs turned on,
> > I do see the "Segment Routing with IPv6" msg at bootup.
> > Was looking at david's patches again, and a few things (I had missed seeing 
> > the last version):
> > 
> > In my review comment I was hinting at CONFIG_IPV6_SEG6 to cover all of ipv6 
> > segment routing,
> > including the lwtunnel bits.
> > 
> > something like below:
> > 
> > config IPV6_SEG6
> > bool "IPv6: Segment Routing Header encapsulation support"
> > depends on LWTUNNEL && IPV6
> > 
> > DavidL, do you see a problem doing it this way ?. with this 'seg6.o' will 
> > be part of CONFIG_IPV6_SEG6 and not
> > get initialized unless it is enabled..which seems like the right thing to 
> > do.
> 
> Can't reproduce the bug either, with CONFIG_IPV6=y, LWTUNNEL=n and all
> SEG6 disabled. Alexei, your .config and dmesg log could help.

I didn't save that .config and did bisect of the other bug that
messed up my .confg. Now I cannot reproduce it. Sorry for the noise.
Still weird though that ping prefers ipv6 address now.
$ ping localhost
PING localhost(localhost.localdomain (::1)) 56 data bytes
64 bytes from localhost.localdomain (::1): icmp_seq=1 ttl=64 time=0.043 ms



Re: [PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support

2016-11-23 Thread Roopa Prabhu
On 11/23/16, 1:28 AM, David Lebrun wrote:
> On 11/23/2016 08:34 AM, Roopa Prabhu wrote:
>> I can't seem to reproduce the problem you are seeing. still trying..
>> I don't have CONFIG_LWTUNNEL set nor any of the other SEG6 configs.
>> My CONFIG_IPV6 is on and compiled as a module. I have also tried disabling 
>> it.
>> If you can send me the config, I can try again. Looking back at the patches,
>> I do see a few things below ..but they may not fix your problem directly.
>>
>> Though I had none of the ipv6 segment routing configs turned on,
>> I do see the "Segment Routing with IPv6" msg at bootup.
>> Was looking at david's patches again, and a few things (I had missed seeing 
>> the last version):
>>
>> In my review comment I was hinting at CONFIG_IPV6_SEG6 to cover all of ipv6 
>> segment routing,
>> including the lwtunnel bits.
>>
>> something like below:
>>
>> config IPV6_SEG6
>> bool "IPv6: Segment Routing Header encapsulation support"
>> depends on LWTUNNEL && IPV6
>>
>> DavidL, do you see a problem doing it this way ?. with this 'seg6.o' will be 
>> part of CONFIG_IPV6_SEG6 and not
>> get initialized unless it is enabled..which seems like the right thing to do.
> Can't reproduce the bug either, with CONFIG_IPV6=y, LWTUNNEL=n and all
> SEG6 disabled. Alexei, your .config and dmesg log could help.
>
> Roopa, the reason why seg6.o is compiled by default is that it provides
> an interface to control HMAC structures, and that HMAC does not depends
> on lwtunnels and can be used in the extension header processing (which
> is compiled by default). I could indeed add another option to
> conditionnally compile seg6.o if HMAC is enabled etc, and I actually had
> something like that in the very first versions of the patch, but I
> received comments that too much options is not a good thing (and I agree
> with that).

okay then. I agree with not having too many option. I had just thought that it
could live with the existing CONFIG_IPV6_SEG6_LWTUNNEL if it was renamed.
had not  looked at the HMAC dependency.



Re: [PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support

2016-11-23 Thread David Lebrun
On 11/23/2016 08:34 AM, Roopa Prabhu wrote:
> I can't seem to reproduce the problem you are seeing. still trying..
> I don't have CONFIG_LWTUNNEL set nor any of the other SEG6 configs.
> My CONFIG_IPV6 is on and compiled as a module. I have also tried disabling it.
> If you can send me the config, I can try again. Looking back at the patches,
> I do see a few things below ..but they may not fix your problem directly.
> 
> Though I had none of the ipv6 segment routing configs turned on,
> I do see the "Segment Routing with IPv6" msg at bootup.
> Was looking at david's patches again, and a few things (I had missed seeing 
> the last version):
> 
> In my review comment I was hinting at CONFIG_IPV6_SEG6 to cover all of ipv6 
> segment routing,
> including the lwtunnel bits.
> 
> something like below:
> 
> config IPV6_SEG6
> bool "IPv6: Segment Routing Header encapsulation support"
> depends on LWTUNNEL && IPV6
> 
> DavidL, do you see a problem doing it this way ?. with this 'seg6.o' will be 
> part of CONFIG_IPV6_SEG6 and not
> get initialized unless it is enabled..which seems like the right thing to do.

Can't reproduce the bug either, with CONFIG_IPV6=y, LWTUNNEL=n and all
SEG6 disabled. Alexei, your .config and dmesg log could help.

Roopa, the reason why seg6.o is compiled by default is that it provides
an interface to control HMAC structures, and that HMAC does not depends
on lwtunnels and can be used in the extension header processing (which
is compiled by default). I could indeed add another option to
conditionnally compile seg6.o if HMAC is enabled etc, and I actually had
something like that in the very first versions of the patch, but I
received comments that too much options is not a good thing (and I agree
with that).

Anyway, I do not see how seg6.o could possibly generate such a bug given
the only thing it does is register a genetlink family and pernet ops
that allocate/deallocate a struct. Genetlink is compiled by default with
NET and register_pernet_subsys does not fail even when namespaces
support is disabled.

David



signature.asc
Description: OpenPGP digital signature


Re: [PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support

2016-11-22 Thread Roopa Prabhu
On 11/22/16, 4:16 PM, Alexei Starovoitov wrote:
> On Wed, Nov 16, 2016 at 8:32 AM, David Miller  wrote:
>> From: David Lebrun 
>> Date: Tue, 15 Nov 2016 16:14:04 +0100
>>
>>> 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 
>> Applied.
> ipv6 seems to be still broken in the latest net-next
> when CONFIG_LWTUNNEL is not set:
> # ping 127.0.0.1
> ping: socket: Address family not supported by protocol
> # ping -4 127.0.0.1
> PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
> 64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.067 
> ms
>
> it works with CONFIG_LWTUNNEL=y
>
> Roopa, David, please take a look.
>
I can't seem to reproduce the problem you are seeing. still trying..
I don't have CONFIG_LWTUNNEL set nor any of the other SEG6 configs.
My CONFIG_IPV6 is on and compiled as a module. I have also tried disabling it.
If you can send me the config, I can try again. Looking back at the patches,
I do see a few things below ..but they may not fix your problem directly.

Though I had none of the ipv6 segment routing configs turned on,
I do see the "Segment Routing with IPv6" msg at bootup.
Was looking at david's patches again, and a few things (I had missed seeing the 
last version):

In my review comment I was hinting at CONFIG_IPV6_SEG6 to cover all of ipv6 
segment routing,
including the lwtunnel bits.

something like below:

config IPV6_SEG6
bool "IPv6: Segment Routing Header encapsulation support"
depends on LWTUNNEL && IPV6

DavidL, do you see a problem doing it this way ?. with this 'seg6.o' will be 
part of CONFIG_IPV6_SEG6 and not
get initialized unless it is enabled..which seems like the right thing to do.

DaveM had suggested compiling LWTUNNEL in by default. I can submit a patch for 
that.
But it is not clear to me yet why the right depends will not fix it.

thanks.



Re: [PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support

2016-11-22 Thread Alexei Starovoitov
On Wed, Nov 16, 2016 at 8:32 AM, David Miller  wrote:
> From: David Lebrun 
> Date: Tue, 15 Nov 2016 16:14:04 +0100
>
>> 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 
>
> Applied.

ipv6 seems to be still broken in the latest net-next
when CONFIG_LWTUNNEL is not set:
# ping 127.0.0.1
ping: socket: Address family not supported by protocol
# ping -4 127.0.0.1
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.067 ms

it works with CONFIG_LWTUNNEL=y

Roopa, David, please take a look.

Thanks!


Re: [PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support

2016-11-16 Thread David Miller
From: David Lebrun 
Date: Tue, 15 Nov 2016 16:14:04 +0100

> 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 

Applied.


[PATCH net-next 1/1] ipv6: sr: add option to control lwtunnel support

2016-11-15 Thread David Lebrun
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);
 }
-- 
2.7.3