* [PATCH] ipip, sit: copy parms.name after register_netdevice
@ 2011-12-06 9:25 Ted Feng
2011-12-06 17:32 ` Greg KH
0 siblings, 1 reply; 9+ messages in thread
From: Ted Feng @ 2011-12-06 9:25 UTC (permalink / raw)
To: Jiri Pirko, David S. Miller, Josh Boyer; +Cc: netdev, linux-kernel, stable
Same fix as 731abb9cb2 for ipip and sit tunnel.
Commit 1c5cae815d removed an explicit call to dev_alloc_name in
ipip_tunnel_locate
and ipip6_tunnel_locate, because register_netdevice will now create a
valid name.
However the tunnel keeps a copy of the name in the private parms structure.
This shows up if you do a simple tunnel add, followed by a tunnel show:
$ sudo ip tunnel add mode ipip remote 10.2.20.211
$ ip tunnel
tunl0: ip/ip remote any local any ttl inherit nopmtudisc
tunl%d: ip/ip remote 10.2.20.211 local any ttl inherit
$ sudo ip tunnel add mode sit remote 10.2.20.212
$ ip tunnel
sit0: ipv6/ip remote any local any ttl 64 nopmtudisc 6rd-prefix 2002::/16
sit%d: ioctl 89f8 failed: No such device
sit%d: ipv6/ip remote 10.2.20.212 local any ttl inherit
Signed-off-by: Ted Feng <artisdom@gmail.com>
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 065effd..0b2e732 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -285,6 +285,8 @@ static struct ip_tunnel *
ipip_tunnel_locate(struct net *net,
if (register_netdevice(dev) < 0)
goto failed_free;
+ strcpy(nt->parms.name, dev->name);
+
dev_hold(dev);
ipip_tunnel_link(ipn, nt);
return nt;
@@ -759,7 +761,6 @@ static int ipip_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel = netdev_priv(dev);
tunnel->dev = dev;
- strcpy(tunnel->parms.name, dev->name);
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
@@ -825,6 +826,7 @@ static void ipip_destroy_tunnels(struct ipip_net
*ipn, struct list_head *head)
static int __net_init ipip_init_net(struct net *net)
{
struct ipip_net *ipn = net_generic(net, ipip_net_id);
+ struct ip_tunnel *t;
int err;
ipn->tunnels[0] = ipn->tunnels_wc;
@@ -848,6 +850,9 @@ static int __net_init ipip_init_net(struct net *net)
if ((err = register_netdev(ipn->fb_tunnel_dev)))
goto err_reg_dev;
+ t = netdev_priv(ipn->fb_tunnel_dev);
+
+ strcpy(t->parms.name, ipn->fb_tunnel_dev->name);
return 0;
err_reg_dev:
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index a7a1860..96f3623 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -263,6 +263,8 @@ static struct ip_tunnel
*ipip6_tunnel_locate(struct net *net,
if (register_netdevice(dev) < 0)
goto failed_free;
+ strcpy(nt->parms.name, dev->name);
+
dev_hold(dev);
ipip6_tunnel_link(sitn, nt);
@@ -1144,7 +1146,6 @@ static int ipip6_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel = netdev_priv(dev);
tunnel->dev = dev;
- strcpy(tunnel->parms.name, dev->name);
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
@@ -1207,6 +1208,7 @@ static void __net_exit
sit_destroy_tunnels(struct sit_net *sitn, struct list_hea
static int __net_init sit_init_net(struct net *net)
{
struct sit_net *sitn = net_generic(net, sit_net_id);
+ struct ip_tunnel *t;
int err;
sitn->tunnels[0] = sitn->tunnels_wc;
@@ -1231,6 +1233,9 @@ static int __net_init sit_init_net(struct net *net)
if ((err = register_netdev(sitn->fb_tunnel_dev)))
goto err_reg_dev;
+ t = netdev_priv(sitn->fb_tunnel_dev);
+
+ strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
return 0;
err_reg_dev:
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-06 9:25 [PATCH] ipip, sit: copy parms.name after register_netdevice Ted Feng
@ 2011-12-06 17:32 ` Greg KH
2011-12-08 3:35 ` Ted Feng
0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2011-12-06 17:32 UTC (permalink / raw)
To: Ted Feng
Cc: Jiri Pirko, David S. Miller, Josh Boyer, netdev, linux-kernel,
stable
On Tue, Dec 06, 2011 at 05:25:24PM +0800, Ted Feng wrote:
> Same fix as 731abb9cb2 for ipip and sit tunnel.
> Commit 1c5cae815d removed an explicit call to dev_alloc_name in
> ipip_tunnel_locate
> and ipip6_tunnel_locate, because register_netdevice will now create a
> valid name.
> However the tunnel keeps a copy of the name in the private parms structure.
>
> This shows up if you do a simple tunnel add, followed by a tunnel show:
>
> $ sudo ip tunnel add mode ipip remote 10.2.20.211
> $ ip tunnel
> tunl0: ip/ip remote any local any ttl inherit nopmtudisc
> tunl%d: ip/ip remote 10.2.20.211 local any ttl inherit
> $ sudo ip tunnel add mode sit remote 10.2.20.212
> $ ip tunnel
> sit0: ipv6/ip remote any local any ttl 64 nopmtudisc 6rd-prefix 2002::/16
> sit%d: ioctl 89f8 failed: No such device
> sit%d: ipv6/ip remote 10.2.20.212 local any ttl inherit
>
> Signed-off-by: Ted Feng <artisdom@gmail.com>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read Documentation/stable_kernel_rules.txt
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-06 17:32 ` Greg KH
@ 2011-12-08 3:35 ` Ted Feng
2011-12-08 4:16 ` Stephen Hemminger
2011-12-08 4:56 ` David Miller
0 siblings, 2 replies; 9+ messages in thread
From: Ted Feng @ 2011-12-08 3:35 UTC (permalink / raw)
To: David S. Miller; +Cc: Jiri Pirko, Josh Boyer, netdev, linux-kernel
From: Ted Feng <artisdom@gmail.com>
Same fix as 731abb9cb2 for ipip and sit tunnel.
Commit 1c5cae815d removed an explicit call to dev_alloc_name in
ipip_tunnel_locate and ipip6_tunnel_locate, because register_netdevice
will now create a valid name. However the tunnel keeps a copy of the
name in the private parms structure.
This shows up if you do a simple tunnel add, followed by a tunnel show:
$ sudo ip tunnel add mode ipip remote 10.2.20.211
$ ip tunnel
tunl0: ip/ip remote any local any ttl inherit nopmtudisc
tunl%d: ip/ip remote 10.2.20.211 local any ttl inherit
$ sudo ip tunnel add mode sit remote 10.2.20.212
$ ip tunnel
sit0: ipv6/ip remote any local any ttl 64 nopmtudisc 6rd-prefix 2002::/16
sit%d: ioctl 89f8 failed: No such device
sit%d: ipv6/ip remote 10.2.20.212 local any ttl inherit
Fix this by copying the name back after register_netdevice has
successfully returned.
Cc: stable@vger.kernel.org
Signed-off-by: Ted Feng <artisdom@gmail.com>
---
net/ipv4/ipip.c | 7 ++++++-
net/ipv6/sit.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 065effd..0b2e732 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -285,6 +285,8 @@ static struct ip_tunnel *
ipip_tunnel_locate(struct net *net,
if (register_netdevice(dev) < 0)
goto failed_free;
+ strcpy(nt->parms.name, dev->name);
+
dev_hold(dev);
ipip_tunnel_link(ipn, nt);
return nt;
@@ -759,7 +761,6 @@ static int ipip_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel = netdev_priv(dev);
tunnel->dev = dev;
- strcpy(tunnel->parms.name, dev->name);
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
@@ -825,6 +826,7 @@ static void ipip_destroy_tunnels(struct ipip_net
*ipn, struct list_head *head)
static int __net_init ipip_init_net(struct net *net)
{
struct ipip_net *ipn = net_generic(net, ipip_net_id);
+ struct ip_tunnel *t;
int err;
ipn->tunnels[0] = ipn->tunnels_wc;
@@ -848,6 +850,9 @@ static int __net_init ipip_init_net(struct net *net)
if ((err = register_netdev(ipn->fb_tunnel_dev)))
goto err_reg_dev;
+ t = netdev_priv(ipn->fb_tunnel_dev);
+
+ strcpy(t->parms.name, ipn->fb_tunnel_dev->name);
return 0;
err_reg_dev:
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index a7a1860..96f3623 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -263,6 +263,8 @@ static struct ip_tunnel
*ipip6_tunnel_locate(struct net *net,
if (register_netdevice(dev) < 0)
goto failed_free;
+ strcpy(nt->parms.name, dev->name);
+
dev_hold(dev);
ipip6_tunnel_link(sitn, nt);
@@ -1144,7 +1146,6 @@ static int ipip6_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel = netdev_priv(dev);
tunnel->dev = dev;
- strcpy(tunnel->parms.name, dev->name);
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
@@ -1207,6 +1208,7 @@ static void __net_exit
sit_destroy_tunnels(struct sit_net *sitn, struct list_hea
static int __net_init sit_init_net(struct net *net)
{
struct sit_net *sitn = net_generic(net, sit_net_id);
+ struct ip_tunnel *t;
int err;
sitn->tunnels[0] = sitn->tunnels_wc;
@@ -1231,6 +1233,9 @@ static int __net_init sit_init_net(struct net *net)
if ((err = register_netdev(sitn->fb_tunnel_dev)))
goto err_reg_dev;
+ t = netdev_priv(sitn->fb_tunnel_dev);
+
+ strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
return 0;
err_reg_dev:
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-08 3:35 ` Ted Feng
@ 2011-12-08 4:16 ` Stephen Hemminger
2011-12-08 4:56 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2011-12-08 4:16 UTC (permalink / raw)
To: Ted Feng; +Cc: David S. Miller, Jiri Pirko, Josh Boyer, netdev, linux-kernel
On Thu, 8 Dec 2011 11:35:15 +0800
Ted Feng <artisdom@gmail.com> wrote:
> From: Ted Feng <artisdom@gmail.com>
> Same fix as 731abb9cb2 for ipip and sit tunnel.
> Commit 1c5cae815d removed an explicit call to dev_alloc_name in
> ipip_tunnel_locate and ipip6_tunnel_locate, because register_netdevice
> will now create a valid name. However the tunnel keeps a copy of the
> name in the private parms structure.
>
> This shows up if you do a simple tunnel add, followed by a tunnel show:
>
Ok, but keeping a private copy is not a good idea, since tunnel
can be renamed.
ip li set dev tun0 name tunnel-of-love
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-08 3:35 ` Ted Feng
2011-12-08 4:16 ` Stephen Hemminger
@ 2011-12-08 4:56 ` David Miller
2011-12-08 10:46 ` Ted Feng
1 sibling, 1 reply; 9+ messages in thread
From: David Miller @ 2011-12-08 4:56 UTC (permalink / raw)
To: artisdom; +Cc: jpirko, jwboyer, netdev, linux-kernel
From: Ted Feng <artisdom@gmail.com>
Date: Thu, 8 Dec 2011 11:35:15 +0800
> @@ -285,6 +285,8 @@ static struct ip_tunnel *
> ipip_tunnel_locate(struct net *net,
Your patches are corrupted by your email client and unusable.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-08 4:56 ` David Miller
@ 2011-12-08 10:46 ` Ted Feng
2011-12-10 14:29 ` Ted Feng
2011-12-12 23:51 ` David Miller
0 siblings, 2 replies; 9+ messages in thread
From: Ted Feng @ 2011-12-08 10:46 UTC (permalink / raw)
To: David Miller; +Cc: jpirko, jwboyer, netdev, linux-kernel
From: Ted Feng <artisdom@gmail.com>
Same fix as 731abb9cb2 for ipip and sit tunnel.
Commit 1c5cae815d removed an explicit call to dev_alloc_name in
ipip_tunnel_locate and ipip6_tunnel_locate, because register_netdevice
will now create a valid name, however the tunnel keeps a copy of the
name in the private parms structure. Fix this by copying the name back
after register_netdevice has successfully returned.
This shows up if you do a simple tunnel add, followed by a tunnel show:
$ sudo ip tunnel add mode ipip remote 10.2.20.211
$ ip tunnel
tunl0: ip/ip remote any local any ttl inherit nopmtudisc
tunl%d: ip/ip remote 10.2.20.211 local any ttl inherit
$ sudo ip tunnel add mode sit remote 10.2.20.212
$ ip tunnel
sit0: ipv6/ip remote any local any ttl 64 nopmtudisc 6rd-prefix 2002::/16
sit%d: ioctl 89f8 failed: No such device
sit%d: ipv6/ip remote 10.2.20.212 local any ttl inherit
Cc: stable@vger.kernel.org
Signed-off-by: Ted Feng <artisdom@gmail.com>
---
net/ipv4/ipip.c | 7 ++++++-
net/ipv6/sit.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 065effd..0b2e732 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -285,6 +285,8 @@ static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
if (register_netdevice(dev) < 0)
goto failed_free;
+ strcpy(nt->parms.name, dev->name);
+
dev_hold(dev);
ipip_tunnel_link(ipn, nt);
return nt;
@@ -759,7 +761,6 @@ static int ipip_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel = netdev_priv(dev);
tunnel->dev = dev;
- strcpy(tunnel->parms.name, dev->name);
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
@@ -825,6 +826,7 @@ static void ipip_destroy_tunnels(struct ipip_net *ipn, struct list_head *head)
static int __net_init ipip_init_net(struct net *net)
{
struct ipip_net *ipn = net_generic(net, ipip_net_id);
+ struct ip_tunnel *t;
int err;
ipn->tunnels[0] = ipn->tunnels_wc;
@@ -848,6 +850,9 @@ static int __net_init ipip_init_net(struct net *net)
if ((err = register_netdev(ipn->fb_tunnel_dev)))
goto err_reg_dev;
+ t = netdev_priv(ipn->fb_tunnel_dev);
+
+ strcpy(t->parms.name, ipn->fb_tunnel_dev->name);
return 0;
err_reg_dev:
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index a7a1860..96f3623 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -263,6 +263,8 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
if (register_netdevice(dev) < 0)
goto failed_free;
+ strcpy(nt->parms.name, dev->name);
+
dev_hold(dev);
ipip6_tunnel_link(sitn, nt);
@@ -1144,7 +1146,6 @@ static int ipip6_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel = netdev_priv(dev);
tunnel->dev = dev;
- strcpy(tunnel->parms.name, dev->name);
memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
@@ -1207,6 +1208,7 @@ static void __net_exit sit_destroy_tunnels(struct sit_net *sitn, struct list_hea
static int __net_init sit_init_net(struct net *net)
{
struct sit_net *sitn = net_generic(net, sit_net_id);
+ struct ip_tunnel *t;
int err;
sitn->tunnels[0] = sitn->tunnels_wc;
@@ -1231,6 +1233,9 @@ static int __net_init sit_init_net(struct net *net)
if ((err = register_netdev(sitn->fb_tunnel_dev)))
goto err_reg_dev;
+ t = netdev_priv(sitn->fb_tunnel_dev);
+
+ strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
return 0;
err_reg_dev:
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-08 10:46 ` Ted Feng
@ 2011-12-10 14:29 ` Ted Feng
2011-12-10 18:12 ` David Miller
2011-12-12 23:51 ` David Miller
1 sibling, 1 reply; 9+ messages in thread
From: Ted Feng @ 2011-12-10 14:29 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: David S. Miller
On Thu, Dec 08, 2011 at 06:46:21PM +0800, Ted Feng wrote:
> From: Ted Feng <artisdom@gmail.com>
>
> Same fix as 731abb9cb2 for ipip and sit tunnel.
> Commit 1c5cae815d removed an explicit call to dev_alloc_name in
> ipip_tunnel_locate and ipip6_tunnel_locate, because register_netdevice
> will now create a valid name, however the tunnel keeps a copy of the
> name in the private parms structure. Fix this by copying the name back
> after register_netdevice has successfully returned.
>
Just a reminder. The previous resubmited patch got no response.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-10 14:29 ` Ted Feng
@ 2011-12-10 18:12 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2011-12-10 18:12 UTC (permalink / raw)
To: artisdom; +Cc: netdev, linux-kernel
From: Ted Feng <artisdom@gmail.com>
Date: Sat, 10 Dec 2011 22:29:24 +0800
> On Thu, Dec 08, 2011 at 06:46:21PM +0800, Ted Feng wrote:
>> From: Ted Feng <artisdom@gmail.com>
>>
>> Same fix as 731abb9cb2 for ipip and sit tunnel.
>> Commit 1c5cae815d removed an explicit call to dev_alloc_name in
>> ipip_tunnel_locate and ipip6_tunnel_locate, because register_netdevice
>> will now create a valid name, however the tunnel keeps a copy of the
>> name in the private parms structure. Fix this by copying the name back
>> after register_netdevice has successfully returned.
>>
> Just a reminder. The previous resubmited patch got no response.
So? It's queued up in patchwork:
http://patchwork.ozlabs.org/project/netdev/list/
and therefore will get looked at when someone finds the time.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
2011-12-08 10:46 ` Ted Feng
2011-12-10 14:29 ` Ted Feng
@ 2011-12-12 23:51 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2011-12-12 23:51 UTC (permalink / raw)
To: artisdom; +Cc: jpirko, jwboyer, netdev, linux-kernel
From: Ted Feng <artisdom@gmail.com>
Date: Thu, 8 Dec 2011 18:46:21 +0800
> From: Ted Feng <artisdom@gmail.com>
>
> Same fix as 731abb9cb2 for ipip and sit tunnel.
> Commit 1c5cae815d removed an explicit call to dev_alloc_name in
> ipip_tunnel_locate and ipip6_tunnel_locate, because register_netdevice
> will now create a valid name, however the tunnel keeps a copy of the
> name in the private parms structure. Fix this by copying the name back
> after register_netdevice has successfully returned.
>
> This shows up if you do a simple tunnel add, followed by a tunnel show:
>
> $ sudo ip tunnel add mode ipip remote 10.2.20.211
> $ ip tunnel
> tunl0: ip/ip remote any local any ttl inherit nopmtudisc
> tunl%d: ip/ip remote 10.2.20.211 local any ttl inherit
> $ sudo ip tunnel add mode sit remote 10.2.20.212
> $ ip tunnel
> sit0: ipv6/ip remote any local any ttl 64 nopmtudisc 6rd-prefix 2002::/16
> sit%d: ioctl 89f8 failed: No such device
> sit%d: ipv6/ip remote 10.2.20.212 local any ttl inherit
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ted Feng <artisdom@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-12-12 23:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 9:25 [PATCH] ipip, sit: copy parms.name after register_netdevice Ted Feng
2011-12-06 17:32 ` Greg KH
2011-12-08 3:35 ` Ted Feng
2011-12-08 4:16 ` Stephen Hemminger
2011-12-08 4:56 ` David Miller
2011-12-08 10:46 ` Ted Feng
2011-12-10 14:29 ` Ted Feng
2011-12-10 18:12 ` David Miller
2011-12-12 23:51 ` David Miller
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).