diff mbox

[net,1/2] ovs/vxlan: fix rtnl notifications on iface deletion

Message ID 1465551147-17185-1-git-send-email-nicolas.dichtel@6wind.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Nicolas Dichtel June 10, 2016, 9:32 a.m. UTC
The function vxlan_dev_create() (only used by ovs) never calls
rtnl_configure_link(). The consequence is that dev->rtnl_link_state is
never set to RTNL_LINK_INITIALIZED.
During the deletion phase, the function rollback_registered_many() sends
a RTM_DELLINK only if dev->rtnl_link_state is set to RTNL_LINK_INITIALIZED.

Fixes: dcc38c033b32 ("openvswitch: Re-add CONFIG_OPENVSWITCH_VXLAN")
CC: Thomas Graf <tgraf@suug.ch>
CC: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 drivers/net/vxlan.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Pravin Shelar June 10, 2016, 5:50 p.m. UTC | #1
On Fri, Jun 10, 2016 at 2:32 AM, Nicolas Dichtel
<nicolas.dichtel@6wind.com> wrote:
> The function vxlan_dev_create() (only used by ovs) never calls
> rtnl_configure_link(). The consequence is that dev->rtnl_link_state is
> never set to RTNL_LINK_INITIALIZED.
> During the deletion phase, the function rollback_registered_many() sends
> a RTM_DELLINK only if dev->rtnl_link_state is set to RTNL_LINK_INITIALIZED.
>
> Fixes: dcc38c033b32 ("openvswitch: Re-add CONFIG_OPENVSWITCH_VXLAN")
> CC: Thomas Graf <tgraf@suug.ch>
> CC: Pravin B Shelar <pshelar@nicira.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>  drivers/net/vxlan.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index f999db2f97b4..f7669d60b3f7 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2972,6 +2972,12 @@ struct net_device *vxlan_dev_create(struct net *net, const char *name,
>                 return ERR_PTR(err);
>         }
>
> +       err = rtnl_configure_link(dev, NULL);
> +       if (err < 0) {
> +               free_netdev(dev);
> +               return ERR_PTR(err);
> +       }
> +
Patch looks good except the error handling code. earlier call to
vxlan_dev_configure() registers the net-device  and add the device to
vxlan device list. it needs to be undone before freeing the device.
Jesse Gross June 10, 2016, 5:52 p.m. UTC | #2
On Fri, Jun 10, 2016 at 2:32 AM, Nicolas Dichtel
<nicolas.dichtel@6wind.com> wrote:
> The function vxlan_dev_create() (only used by ovs) never calls
> rtnl_configure_link(). The consequence is that dev->rtnl_link_state is
> never set to RTNL_LINK_INITIALIZED.
> During the deletion phase, the function rollback_registered_many() sends
> a RTM_DELLINK only if dev->rtnl_link_state is set to RTNL_LINK_INITIALIZED.
>
> Fixes: dcc38c033b32 ("openvswitch: Re-add CONFIG_OPENVSWITCH_VXLAN")
> CC: Thomas Graf <tgraf@suug.ch>
> CC: Pravin B Shelar <pshelar@nicira.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Does Geneve need this as well?
Nicolas Dichtel June 13, 2016, 7:44 a.m. UTC | #3
Le 10/06/2016 19:50, pravin shelar a écrit :
[snip]
> Patch looks good except the error handling code. earlier call to
> vxlan_dev_configure() registers the net-device  and add the device to
> vxlan device list. it needs to be undone before freeing the device.
> 
Ok, will fix it (and also for GRE).


Thank you,
Nicolas
Nicolas Dichtel June 13, 2016, 8:12 a.m. UTC | #4
Le 10/06/2016 19:52, Jesse Gross a écrit :
[snip]
> Does Geneve need this as well?
> 
Yes, will fix it.


Thank you,
Nicolas
Nicolas Dichtel June 13, 2016, 8:31 a.m. UTC | #5
There was no rtnl notifications for interfaces (gre, vxlan, geneve) created
by ovs. This problem is fixed by adjusting the creation path.

v1 -> v2:
 - add patch #1 and #4
 - rework error handling in patch #2

 drivers/net/geneve.c | 14 ++++++++++---
 drivers/net/vxlan.c  | 58 ++++++++++++++++++++++++++++++----------------------
 net/ipv4/ip_gre.c    | 14 ++++++++++---
 3 files changed, 56 insertions(+), 30 deletions(-)

Regards,
Nicolas
Pravin Shelar June 13, 2016, 7:39 p.m. UTC | #6
On Mon, Jun 13, 2016 at 1:31 AM, Nicolas Dichtel
<nicolas.dichtel@6wind.com> wrote:
>
> There was no rtnl notifications for interfaces (gre, vxlan, geneve) created
> by ovs. This problem is fixed by adjusting the creation path.
>
> v1 -> v2:
>  - add patch #1 and #4
>  - rework error handling in patch #2
>
>  drivers/net/geneve.c | 14 ++++++++++---
>  drivers/net/vxlan.c  | 58 ++++++++++++++++++++++++++++++----------------------
>  net/ipv4/ip_gre.c    | 14 ++++++++++---
>  3 files changed, 56 insertions(+), 30 deletions(-)
>

All patches looks good to me.

Acked-by: Pravin B Shelar <pshelar@ovn.org>
David Miller June 15, 2016, 5:22 a.m. UTC | #7
From: pravin shelar <pshelar@ovn.org>
Date: Mon, 13 Jun 2016 12:39:16 -0700

> On Mon, Jun 13, 2016 at 1:31 AM, Nicolas Dichtel
> <nicolas.dichtel@6wind.com> wrote:
>>
>> There was no rtnl notifications for interfaces (gre, vxlan, geneve) created
>> by ovs. This problem is fixed by adjusting the creation path.
>>
>> v1 -> v2:
>>  - add patch #1 and #4
>>  - rework error handling in patch #2
>>
>>  drivers/net/geneve.c | 14 ++++++++++---
>>  drivers/net/vxlan.c  | 58 ++++++++++++++++++++++++++++++----------------------
>>  net/ipv4/ip_gre.c    | 14 ++++++++++---
>>  3 files changed, 56 insertions(+), 30 deletions(-)
>>
> 
> All patches looks good to me.
> 
> Acked-by: Pravin B Shelar <pshelar@ovn.org>

Series applied, thanks.
diff mbox

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index f999db2f97b4..f7669d60b3f7 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2972,6 +2972,12 @@  struct net_device *vxlan_dev_create(struct net *net, const char *name,
 		return ERR_PTR(err);
 	}
 
+	err = rtnl_configure_link(dev, NULL);
+	if (err < 0) {
+		free_netdev(dev);
+		return ERR_PTR(err);
+	}
+
 	return dev;
 }
 EXPORT_SYMBOL_GPL(vxlan_dev_create);