ip_tunnel: don't add tunnel twice
authorDuan Jiong <duanj.fnst@cn.fujitsu.com>
Thu, 15 May 2014 05:07:02 +0000 (13:07 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 May 2014 20:57:44 +0000 (16:57 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_tunnel.c

index 059176dfab7f2f6523d39351176a0e7853ea38c9..289c6ee388c1dad7613c30ed432d04b614e9f4e9 100644 (file)
@@ -754,10 +754,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) {