diff mbox

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

Message ID 1469376447-21980-2-git-send-email-cascardo@redhat.com
State Changes Requested
Delegated to: Daniele Di Proietto
Headers show

Commit Message

Thadeu Lima de Souza Cascardo July 24, 2016, 4:07 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.

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

Comments

Thadeu Lima de Souza Cascardo July 24, 2016, 4:17 p.m. UTC | #1
On Sun, Jul 24, 2016 at 01:07:27PM -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.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>

Forgot to add...

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

> ---
>  lib/route-table.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/route-table.c b/lib/route-table.c
> index 58e7f62..21df602 100644
> --- a/lib/route-table.c
> +++ b/lib/route-table.c
> @@ -151,6 +151,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 27, 2016, 8:48 p.m. UTC | #2
On Sun, Jul 24, 2016 at 01:07:27PM -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.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>

This gives me a compiler error:
    ../lib/route-table.c:154:5: error: implicit declaration of function 'netdev_get_addrs_list_flush' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

I also noticed that netdev_get_addrs_list_flush() is not available on
Windows.

Thanks,

Ben.
Thadeu Lima de Souza Cascardo July 27, 2016, 10:20 p.m. UTC | #3
On Wed, Jul 27, 2016 at 01:48:47PM -0700, Ben Pfaff wrote:
> On Sun, Jul 24, 2016 at 01:07:27PM -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.
> > 
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
> 
> This gives me a compiler error:
>     ../lib/route-table.c:154:5: error: implicit declaration of function 'netdev_get_addrs_list_flush' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> 
> I also noticed that netdev_get_addrs_list_flush() is not available on
> Windows.
> 
> Thanks,
> 
> Ben.

Hum... I'll take a look at that and resubmit.

Thanks.
Cascardo.
diff mbox

Patch

diff --git a/lib/route-table.c b/lib/route-table.c
index 58e7f62..21df602 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -151,6 +151,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++;