ip_tunnel: don't add tunnel twice
Subsystems (3)
PATCH 1/1 ip_tunnel: don't add tunnel twice
When using command "ip tunnel add" to add a tunnel, the tunnel will be added twice, through ip_tunnel_create() and ip_tunnel_update().
Because the second is unnecessary, so we can just break after adding tunnel through ip_tunnel_create().
--- net/ipv4/ip_tunnel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/ipv4/ip_tunnel.c +2 -4
@@ -755,10 +755,8 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd)if (!t && (cmd ==SIOCADDTUNNEL )) { t =ip_tunnel_create (net, itn, p); -if (IS_ERR (t)) { - err =PTR_ERR (t); -break ; - } + err =PTR_ERR_OR_ZERO (t); +break ; }if (dev != itn->fb_tunnel_dev && cmd ==SIOCCHGTUNNEL ) {if (t !=NULL ) {
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Duan Jiong <[email protected]>
Date: Thu, 15 May 2014 13:07:02 +0800
Quoted 8 lines
When using command "ip tunnel add" to add a tunnel, the tunnel will be added twice, through
ip_tunnel_create()andip_tunnel_update().Because the second is unnecessary, so we can just break after adding tunnel through
ip_tunnel_create().Signed-off-by Duan Jiong <[email protected]>
ip_tunnel_update() seems to do some things tha ip_tunnel_create() does not.
For example, setting dev->dev_addr[] and dev->broadcast[] from the ipv4 parms if appropriate.
I think you need to rethink this change.
Quoted 12 lines · David Miller
From: Duan Jiong <[email protected]>
Date: Thu, 15 May 2014 13:07:02 +0800Quoted 8 lines
When using command "ip tunnel add" to add a tunnel, the tunnel will be added twice, through
ip_tunnel_create()andip_tunnel_update().Because the second is unnecessary, so we can just break after adding tunnel through
ip_tunnel_create().Signed-off-by Duan Jiong <[email protected]>
Quoted 7 lines
ip_tunnel_update()seems to do some things thaip_tunnel_create()does not.For example, setting dev->dev_addr[] and dev->broadcast[] from the ipv4 parms if appropriate.
I think you need to rethink this change.
When registering tunnel link, function register_netdevice() will call dev->netdev_ops->ndo_init, actually the virtual function ndo_init will do some same things the ip_tunnel_update() does, such as the above you mentioned.
So i think you don't need to worry about that.
Thanks,
Duan
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Duan Jiong <[email protected]>
Date: Fri, 16 May 2014 13:06:47 +0800
Quoted 19 lines
Quoted 18 lines · David Miller
From: Duan Jiong <[email protected]>
Date: Thu, 15 May 2014 13:07:02 +0800Quoted 8 lines
When using command "ip tunnel add" to add a tunnel, the tunnel will be added twice, through
ip_tunnel_create()andip_tunnel_update().Because the second is unnecessary, so we can just break after adding tunnel through
ip_tunnel_create().Signed-off-by Duan Jiong <[email protected]>
ip_tunnel_update()seems to do some things thaip_tunnel_create()does not.For example, setting dev->dev_addr[] and dev->broadcast[] from the ipv4 parms if appropriate.
Quoted 8 lines
Quoted 1 line
I think you need to rethink this change.
When registering tunnel link, function
register_netdevice()will calldev->netdev_ops->ndo_init, actually the virtual functionndo_initwill do some same things theip_tunnel_update()does, such as the above you mentioned.So i think you don't need to worry about that.
Aha, I see, thanks for explaining.
Patch applied.