From patchwork Thu Jul 28 16:14:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 653810 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3s0cQc1qjTz9t1S for ; Fri, 29 Jul 2016 02:15:19 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 5A4811121D; Thu, 28 Jul 2016 09:15:18 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 08E6210E06 for ; Thu, 28 Jul 2016 09:15:17 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 617331E03AC for ; Thu, 28 Jul 2016 10:15:16 -0600 (MDT) X-ASG-Debug-ID: 1469722510-09eadd7aea2b24a0001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar5.cudamail.com with ESMTP id 2U4ihEoV1RzVI5Ju (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 28 Jul 2016 10:15:10 -0600 (MDT) X-Barracuda-Envelope-From: cascardo@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx3-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 28 Jul 2016 16:15:10 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF85B4F5 for ; Thu, 28 Jul 2016 16:15:08 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-116-71.phx2.redhat.com [10.3.116.71]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6SGF7uG020945 for ; Thu, 28 Jul 2016 12:15:08 -0400 X-CudaMail-Envelope-Sender: cascardo@redhat.com From: Thadeu Lima de Souza Cascardo To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-727025313 X-CudaMail-DTE: 072816 X-CudaMail-Originating-IP: 209.132.183.28 Date: Thu, 28 Jul 2016 13:14:58 -0300 X-ASG-Orig-Subj: [##CM-V1-727025313##][PATCH v2] route-table: flush addresses list when route table is reset Message-Id: <1469722498-7450-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 28 Jul 2016 16:15:09 +0000 (UTC) X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1469722510 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH v2] route-table: flush addresses list when route table is reset X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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 --- 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 #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++;