netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next 1/2] ip6_tunnel: put ip6tnl0 FB device into 'any' mode
@ 2014-10-21  8:19 Alexey Andriyanov
  2014-10-21  8:19 ` [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0 Alexey Andriyanov
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Andriyanov @ 2014-10-21  8:19 UTC (permalink / raw)
  To: Roman Gushchin, netdev; +Cc: Alexey Andriyanov, David Miller, Eric Dumazet

The fallback device is in ipv6 mode by default.
The mode can not be changed in runtime, so there
is no way to decapsulate ip4in6 packets coming from
various sources without creating the specific tunnel
ifaces for each peer.

Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexey Andriyanov <alan@al-an.info>
---
 net/ipv6/ip6_tunnel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9409887..a48f212 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1551,7 +1551,8 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
 	if (err)
 		return err;
 
-	t->parms.proto = IPPROTO_IPV6;
+	/* allow any registered unrelying proto for the FB device */
+	t->parms.proto = 0;
 	dev_hold(dev);
 
 	ip6_tnl_link_config(t);
-- 
1.9.1

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

* [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0
  2014-10-21  8:19 [net-next 1/2] ip6_tunnel: put ip6tnl0 FB device into 'any' mode Alexey Andriyanov
@ 2014-10-21  8:19 ` Alexey Andriyanov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Andriyanov @ 2014-10-21  8:19 UTC (permalink / raw)
  To: Roman Gushchin, netdev; +Cc: Alexey Andriyanov, David Miller, Eric Dumazet

The fallback device is in ipv6 mode by default.
The mode can not be changed in runtime, so there
is no way to decapsulate ip4in6 packets coming from
various sources without creating the specific tunnel
ifaces for each peer.

This allows to update the fallback tunnel device, but only
the mode could be changed.

Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexey Andriyanov <alan@al-an.info>
---
 net/ipv6/ip6_tunnel.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index a48f212..0e45ec9 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1285,6 +1285,14 @@ static int ip6_tnl_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p)
 	return err;
 }
 
+static int ip6_tnl0_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p)
+{
+	/* for default tnl0 device allow to change only the proto */
+	t->parms.proto = p->proto;
+	netdev_state_change(t->dev);
+	return 0;
+}
+
 static void
 ip6_tnl_parm_from_user(struct __ip6_tnl_parm *p, const struct ip6_tnl_parm *u)
 {
@@ -1384,7 +1392,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			break;
 		ip6_tnl_parm_from_user(&p1, &p);
 		t = ip6_tnl_locate(net, &p1, cmd == SIOCADDTUNNEL);
-		if (dev != ip6n->fb_tnl_dev && cmd == SIOCCHGTUNNEL) {
+		if (cmd == SIOCCHGTUNNEL) {
 			if (t != NULL) {
 				if (t->dev != dev) {
 					err = -EEXIST;
@@ -1392,8 +1400,10 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 				}
 			} else
 				t = netdev_priv(dev);
-
-			err = ip6_tnl_update(t, &p1);
+			if (dev == ip6n->fb_tnl_dev)
+				err = ip6_tnl0_update(t, &p1);
+			else
+				err = ip6_tnl_update(t, &p1);
 		}
 		if (t) {
 			err = 0;
-- 
1.9.1

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

* Re: [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0
  2014-10-21 15:13   ` Nicolas Dichtel
@ 2014-10-21 15:46     ` Alexey Andrianov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Andrianov @ 2014-10-21 15:46 UTC (permalink / raw)
  To: nicolas.dichtel, netdev; +Cc: David Miller, Eric Dumazet

No, you're right. My fault is I missed the cover letter explaining that 
both patches together are overkill. One should be enough. It could be 
the 1st, but it may cause some compatibility issues. So the maintainer 
could choose either the second or both.

And I'm really sorry for duplicate messages.

21.10.2014 19:13, Nicolas Dichtel wrote:
> Le 21/10/2014 10:11, Alexey Andriyanov a écrit :
>> The fallback device is in ipv6 mode by default.
> After patch 1/2, this is not true. Am I missing something?

-- 
Best regards,
Alexey

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

* Re: [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0
  2014-10-21  8:11 ` [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0 Alexey Andriyanov
@ 2014-10-21 15:13   ` Nicolas Dichtel
  2014-10-21 15:46     ` Alexey Andrianov
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Dichtel @ 2014-10-21 15:13 UTC (permalink / raw)
  To: Alexey Andriyanov, netdev; +Cc: David Miller, Eric Dumazet

Le 21/10/2014 10:11, Alexey Andriyanov a écrit :
> The fallback device is in ipv6 mode by default.
After patch 1/2, this is not true. Am I missing something?

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

* [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0
  2014-10-21  8:11 [net-next 1/2] ip6_tunnel: put ip6tnl0 FB device into 'any' mode Alexey Andriyanov
@ 2014-10-21  8:11 ` Alexey Andriyanov
  2014-10-21 15:13   ` Nicolas Dichtel
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Andriyanov @ 2014-10-21  8:11 UTC (permalink / raw)
  To: netdev; +Cc: Alexey Andriyanov, David Miller, Eric Dumazet

The fallback device is in ipv6 mode by default.
The mode can not be changed in runtime, so there
is no way to decapsulate ip4in6 packets coming from
various sources without creating the specific tunnel
ifaces for each peer.

This allows to update the fallback tunnel device, but only
the mode could be changed.

Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexey Andriyanov <alan@al-an.info>
---
 net/ipv6/ip6_tunnel.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index a48f212..0e45ec9 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1285,6 +1285,14 @@ static int ip6_tnl_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p)
 	return err;
 }
 
+static int ip6_tnl0_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p)
+{
+	/* for default tnl0 device allow to change only the proto */
+	t->parms.proto = p->proto;
+	netdev_state_change(t->dev);
+	return 0;
+}
+
 static void
 ip6_tnl_parm_from_user(struct __ip6_tnl_parm *p, const struct ip6_tnl_parm *u)
 {
@@ -1384,7 +1392,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			break;
 		ip6_tnl_parm_from_user(&p1, &p);
 		t = ip6_tnl_locate(net, &p1, cmd == SIOCADDTUNNEL);
-		if (dev != ip6n->fb_tnl_dev && cmd == SIOCCHGTUNNEL) {
+		if (cmd == SIOCCHGTUNNEL) {
 			if (t != NULL) {
 				if (t->dev != dev) {
 					err = -EEXIST;
@@ -1392,8 +1400,10 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 				}
 			} else
 				t = netdev_priv(dev);
-
-			err = ip6_tnl_update(t, &p1);
+			if (dev == ip6n->fb_tnl_dev)
+				err = ip6_tnl0_update(t, &p1);
+			else
+				err = ip6_tnl_update(t, &p1);
 		}
 		if (t) {
 			err = 0;
-- 
1.9.1

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

end of thread, other threads:[~2014-10-21 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-21  8:19 [net-next 1/2] ip6_tunnel: put ip6tnl0 FB device into 'any' mode Alexey Andriyanov
2014-10-21  8:19 ` [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0 Alexey Andriyanov
  -- strict thread matches above, loose matches on Subject: below --
2014-10-21  8:11 [net-next 1/2] ip6_tunnel: put ip6tnl0 FB device into 'any' mode Alexey Andriyanov
2014-10-21  8:11 ` [net-next 2/2] ip6_tunnel: allow to change mode for the ip6tnl0 Alexey Andriyanov
2014-10-21 15:13   ` Nicolas Dichtel
2014-10-21 15:46     ` Alexey Andrianov

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).