* [PATCH] openvswitch: do not ignore netdev errors when creating tunnel vports
@ 2016-08-09 15:24 Martynas Pumputis
[not found] ` <20160809152450.6626-1-martynas-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>
2016-08-11 6:14 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Martynas Pumputis @ 2016-08-09 15:24 UTC (permalink / raw)
To: pshelar-l0M0P4e3n4LQT0dZR+AlfA
Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
Martynas Pumputis, davem-fT/PcQaiUtIeIZ0/mPfg9Q
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>
---
net/openvswitch/vport-geneve.c | 9 ++++++++-
net/openvswitch/vport-gre.c | 11 +++++++++--
net/openvswitch/vport-vxlan.c | 9 ++++++++-
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/net/openvswitch/vport-geneve.c b/net/openvswitch/vport-geneve.c
index 1a1fcec..5aaf3ba 100644
--- a/net/openvswitch/vport-geneve.c
+++ b/net/openvswitch/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/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c
index 7f8897f..0e72d95 100644
--- a/net/openvswitch/vport-gre.c
+++ b/net/openvswitch/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/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
index 5eb7694..7eb955e 100644
--- a/net/openvswitch/vport-vxlan.c
+++ b/net/openvswitch/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:
--
2.9.0
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <20160809152450.6626-1-martynas-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>]
* Re: [PATCH] openvswitch: do not ignore netdev errors when creating tunnel vports
[not found] ` <20160809152450.6626-1-martynas-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>
@ 2016-08-10 17:26 ` pravin shelar
0 siblings, 0 replies; 3+ messages in thread
From: pravin shelar @ 2016-08-10 17:26 UTC (permalink / raw)
To: Martynas Pumputis
Cc: ovs dev, Linux Kernel Network Developers, David S. Miller
On Tue, Aug 9, 2016 at 8:24 AM, Martynas Pumputis <martynas@weave.works> wrote:
> 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>
Thanks.
Acked-by: Pravin B Shelar <pshelar@ovn.org>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] openvswitch: do not ignore netdev errors when creating tunnel vports
2016-08-09 15:24 [PATCH] openvswitch: do not ignore netdev errors when creating tunnel vports Martynas Pumputis
[not found] ` <20160809152450.6626-1-martynas-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>
@ 2016-08-11 6:14 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-08-11 6:14 UTC (permalink / raw)
To: martynas; +Cc: pshelar, netdev, dev
From: Martynas Pumputis <martynas@weave.works>
Date: Tue, 9 Aug 2016 16:24:50 +0100
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-11 6:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-09 15:24 [PATCH] openvswitch: do not ignore netdev errors when creating tunnel vports Martynas Pumputis
[not found] ` <20160809152450.6626-1-martynas-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>
2016-08-10 17:26 ` pravin shelar
2016-08-11 6:14 ` 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).