Message ID | 1471024164-58766-2-git-send-email-pshelar@ovn.org |
---|---|
State | Deferred |
Headers | show |
On Fri, Aug 12, 2016 at 10:49 AM, Pravin B Shelar <pshelar@ovn.org> wrote: > 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> Should we also extend this to LISP and STT?
On Sat, Aug 13, 2016 at 10:11 AM, Jesse Gross <jesse@kernel.org> wrote: > On Fri, Aug 12, 2016 at 10:49 AM, Pravin B Shelar <pshelar@ovn.org> wrote: >> 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> > > Should we also extend this to LISP and STT? right, I missed it. I posted upstream patch.
diff --git a/datapath/vport-geneve.c b/datapath/vport-geneve.c index 5821ef4..14a54f1 100644 --- a/datapath/vport-geneve.c +++ b/datapath/vport-geneve.c @@ -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: diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 32d7d9f..1d63734 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -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; } diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c index b830a46..11965c0 100644 --- a/datapath/vport-vxlan.c +++ b/datapath/vport-vxlan.c @@ -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: