diff mbox

[ovs-dev,v2] route-table: flush addresses list when route table is reset

Message ID 1469722498-7450-1-git-send-email-cascardo@redhat.com
State Accepted
Headers show

Commit Message

Thadeu Lima de Souza Cascardo July 28, 2016, 4:14 p.m. UTC
When the route table is reset, the addresses list may be out of date, as we race
for the many netlink socket notifications.

A quick fix for this is flushing the addresses list, before dumping the routes
and gathering source addresses for them.

That way, instead of using invalid source addresses or preventing an entry to be
added because of missing source addresses, repeated tests showed the correct
entry is always added.

As route-table.c is only built for Linux, we don't need to be concerned that
Windows does not have netdev_get_addrs_list_flush, since it uses
route-table-stub.c instead.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
---
 lib/route-table.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thadeu Lima de Souza Cascardo July 28, 2016, 4:19 p.m. UTC | #1
On Thu, Jul 28, 2016 at 01:14:58PM -0300, Thadeu Lima de Souza Cascardo wrote:
> When the route table is reset, the addresses list may be out of date, as we race
> for the many netlink socket notifications.
> 
> A quick fix for this is flushing the addresses list, before dumping the routes
> and gathering source addresses for them.
> 
> That way, instead of using invalid source addresses or preventing an entry to be
> added because of missing source addresses, repeated tests showed the correct
> entry is always added.
> 
> As route-table.c is only built for Linux, we don't need to be concerned that
> Windows does not have netdev_get_addrs_list_flush, since it uses
> route-table-stub.c instead.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>

I am sorry. Missed it again.

Fixes: a8704b502785 ("tunneling: Handle multiple ip address for given device.")

> ---
>  lib/route-table.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/route-table.c b/lib/route-table.c
> index 58e7f62..0457de3 100644
> --- a/lib/route-table.c
> +++ b/lib/route-table.c
> @@ -25,6 +25,7 @@
>  #include <net/if.h>
>  
>  #include "hash.h"
> +#include "netdev.h"
>  #include "netlink.h"
>  #include "netlink-notifier.h"
>  #include "netlink-socket.h"
> @@ -151,6 +152,7 @@ route_table_reset(void)
>      struct ofpbuf request, reply, buf;
>  
>      route_map_clear();
> +    netdev_get_addrs_list_flush();
>      route_table_valid = true;
>      rt_change_seq++;
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Ben Pfaff July 28, 2016, 4:42 p.m. UTC | #2
On Thu, Jul 28, 2016 at 01:19:11PM -0300, Thadeu Lima de Souza Cascardo wrote:
> On Thu, Jul 28, 2016 at 01:14:58PM -0300, Thadeu Lima de Souza Cascardo wrote:
> > When the route table is reset, the addresses list may be out of date, as we race
> > for the many netlink socket notifications.
> > 
> > A quick fix for this is flushing the addresses list, before dumping the routes
> > and gathering source addresses for them.
> > 
> > That way, instead of using invalid source addresses or preventing an entry to be
> > added because of missing source addresses, repeated tests showed the correct
> > entry is always added.
> > 
> > As route-table.c is only built for Linux, we don't need to be concerned that
> > Windows does not have netdev_get_addrs_list_flush, since it uses
> > route-table-stub.c instead.
> > 
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
> 
> I am sorry. Missed it again.
> 
> Fixes: a8704b502785 ("tunneling: Handle multiple ip address for given device.")

No problem.

I applied this to master, with that added.
diff mbox

Patch

diff --git a/lib/route-table.c b/lib/route-table.c
index 58e7f62..0457de3 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -25,6 +25,7 @@ 
 #include <net/if.h>
 
 #include "hash.h"
+#include "netdev.h"
 #include "netlink.h"
 #include "netlink-notifier.h"
 #include "netlink-socket.h"
@@ -151,6 +152,7 @@  route_table_reset(void)
     struct ofpbuf request, reply, buf;
 
     route_map_clear();
+    netdev_get_addrs_list_flush();
     route_table_valid = true;
     rt_change_seq++;