]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath: backport: openvswitch: do not ignore netdev errors when creating tunnel...
authorPravin B Shelar <pshelar@ovn.org>
Fri, 12 Aug 2016 17:49:24 +0000 (10:49 -0700)
committerPravin B Shelar <pshelar@ovn.org>
Mon, 15 Aug 2016 20:02:49 +0000 (13:02 -0700)
Upstream commit:
    commit 4b5b9ba553f9aa5f484ab972fc9b58061885ceca
    Author: Martynas Pumputis <martynas@weave.works>
    Date:   Tue Aug 9 16:24:50 2016 +0100

    openvswitch: do not ignore netdev errors when creating tunnel vports

    The creation of a tunnel vport (geneve, gre, vxlan) brings up a
    corresponding netdev, a multi-step operation which can fail.

    For example, changing a vxlan vport's netdev state to 'up' binds the
    vport's socket to a UDP port - if the binding fails (e.g. due to the
    port being in use), the error is currently ignored giving the
    appearance that the tunnel vport creation completed successfully.

Signed-off-by: Martynas Pumputis <martynas@weave.works>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
datapath/linux/compat/dev-openvswitch.c
datapath/vport-geneve.c
datapath/vport-gre.c
datapath/vport-lisp.c
datapath/vport-stt.c
datapath/vport-vxlan.c

index 7257665741046405640374b3a123ccff7c697296..56e1a5b6804cb70cc1e16c99456af066e5d4d77e 100644 (file)
@@ -53,6 +53,7 @@ int rpl_rtnl_delete_link(struct net_device *dev)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(rpl_rtnl_delete_link);
 
 #ifndef USE_UPSTREAM_TUNNEL
 int ovs_dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
index 5821ef481d85ea93c5fd5e0136f8dd63856329c8..14a54f1997a9a47e2995503e1a010db826e7b903 100644 (file)
@@ -93,7 +93,14 @@ static struct vport *geneve_tnl_create(const struct vport_parms *parms)
                return ERR_CAST(dev);
        }
 
-       dev_change_flags(dev, dev->flags | IFF_UP);
+       err = dev_change_flags(dev, dev->flags | IFF_UP);
+       if (err < 0) {
+               rtnl_delete_link(dev);
+               rtnl_unlock();
+               ovs_vport_free(vport);
+               goto error;
+       }
+
        rtnl_unlock();
        return vport;
 error:
index 32d7d9f7939b2f3a3257e05b174631f5237f9e41..1d63734f4141825bd6ff20cd55fe8b98708f7b83 100644 (file)
@@ -54,6 +54,7 @@ static struct vport *gre_tnl_create(const struct vport_parms *parms)
        struct net *net = ovs_dp_get_net(parms->dp);
        struct net_device *dev;
        struct vport *vport;
+       int err;
 
        vport = ovs_vport_alloc(0, &ovs_gre_vport_ops, parms);
        if (IS_ERR(vport))
@@ -67,9 +68,15 @@ static struct vport *gre_tnl_create(const struct vport_parms *parms)
                return ERR_CAST(dev);
        }
 
-       dev_change_flags(dev, dev->flags | IFF_UP);
-       rtnl_unlock();
+       err = dev_change_flags(dev, dev->flags | IFF_UP);
+       if (err < 0) {
+               rtnl_delete_link(dev);
+               rtnl_unlock();
+               ovs_vport_free(vport);
+               return ERR_PTR(err);
+       }
 
+       rtnl_unlock();
        return vport;
 }
 
index 9e894e80a7b40783fef31ceb315a0a9520f6bc54..27f40ab4272f9de56bb8db37a15f4ec0bfc95f5d 100644 (file)
@@ -92,8 +92,14 @@ static struct vport *lisp_tnl_create(const struct vport_parms *parms)
                ovs_vport_free(vport);
                return ERR_CAST(dev);
        }
+       err = dev_change_flags(dev, dev->flags | IFF_UP);
+       if (err < 0) {
+               rtnl_delete_link(dev);
+               rtnl_unlock();
+               ovs_vport_free(vport);
+               goto error;
+       }
 
-       dev_change_flags(dev, dev->flags | IFF_UP);
        rtnl_unlock();
        return vport;
 error:
index 1c838de76674f4bcdb335c63eab8e82a66a41e7f..31fa46245503dfa5ac9b34ab347421b3e45d1305 100644 (file)
@@ -95,7 +95,14 @@ static struct vport *stt_tnl_create(const struct vport_parms *parms)
                return ERR_CAST(dev);
        }
 
-       dev_change_flags(dev, dev->flags | IFF_UP);
+       err = dev_change_flags(dev, dev->flags | IFF_UP);
+       if (err < 0) {
+               rtnl_delete_link(dev);
+               rtnl_unlock();
+               ovs_vport_free(vport);
+               goto error;
+       }
+
        rtnl_unlock();
        return vport;
 error:
index b830a463f0702e679280bb49160cb1728e03fefd..11965c00421edf86bd0aefa20e6a4bd7e71d3ca1 100644 (file)
@@ -130,7 +130,14 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms)
                return ERR_CAST(dev);
        }
 
-       dev_change_flags(dev, dev->flags | IFF_UP);
+       err = dev_change_flags(dev, dev->flags | IFF_UP);
+       if (err < 0) {
+               rtnl_delete_link(dev);
+               rtnl_unlock();
+               ovs_vport_free(vport);
+               goto error;
+       }
+
        rtnl_unlock();
        return vport;
 error: