netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ip_tunnel: don't add tunnel twice
@ 2014-05-15  5:07 Duan Jiong
  2014-05-16  3:10 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Duan Jiong @ 2014-05-15  5:07 UTC (permalink / raw)
  To: kaber, David Miller; +Cc: netdev


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

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv4/ip_tunnel.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index b3f8597..e83af0f 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -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) {
-- 
1.8.3.1

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

* Re: [PATCH net-next] ip_tunnel: don't add tunnel twice
  2014-05-15  5:07 [PATCH net-next] ip_tunnel: don't add tunnel twice Duan Jiong
@ 2014-05-16  3:10 ` David Miller
  2014-05-16  5:06   ` Duan Jiong
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-05-16  3:10 UTC (permalink / raw)
  To: duanj.fnst; +Cc: kaber, netdev

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Thu, 15 May 2014 13:07:02 +0800

> 
> 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().
> 
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>

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.

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

* Re: [PATCH net-next] ip_tunnel: don't add tunnel twice
  2014-05-16  3:10 ` David Miller
@ 2014-05-16  5:06   ` Duan Jiong
  2014-05-16 20:58     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Duan Jiong @ 2014-05-16  5:06 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, netdev

于 2014年05月16日 11:10, David Miller 写道:
> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> Date: Thu, 15 May 2014 13:07:02 +0800
> 
>>
>> 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().
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> 
> 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.

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
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH net-next] ip_tunnel: don't add tunnel twice
  2014-05-16  5:06   ` Duan Jiong
@ 2014-05-16 20:58     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-05-16 20:58 UTC (permalink / raw)
  To: duanj.fnst; +Cc: kaber, netdev

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Fri, 16 May 2014 13:06:47 +0800

> 于 2014年05月16日 11:10, David Miller 写道:
>> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>> Date: Thu, 15 May 2014 13:07:02 +0800
>> 
>>>
>>> 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().
>>>
>>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>> 
>> 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.
> 
> 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.

Aha, I see, thanks for explaining.

Patch applied.

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

end of thread, other threads:[~2014-05-16 20:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-15  5:07 [PATCH net-next] ip_tunnel: don't add tunnel twice Duan Jiong
2014-05-16  3:10 ` David Miller
2014-05-16  5:06   ` Duan Jiong
2014-05-16 20:58     ` 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).