From patchwork Wed Aug 9 07:41:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fukaige X-Patchwork-Id: 799555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xS3C96b9Hz9s2G for ; Wed, 9 Aug 2017 17:42:45 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6504E970; Wed, 9 Aug 2017 07:42:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id B4F564A3 for ; Wed, 9 Aug 2017 07:42:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C5D44189 for ; Wed, 9 Aug 2017 07:42:39 +0000 (UTC) Received: from 172.30.72.60 (EHLO DGGEMS408-HUB.china.huawei.com) ([172.30.72.60]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DEW17692; Wed, 09 Aug 2017 15:42:35 +0800 (CST) Received: from localhost (10.177.245.74) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.301.0; Wed, 9 Aug 2017 15:42:25 +0800 From: fukaige To: Date: Wed, 9 Aug 2017 15:41:55 +0800 Message-ID: <1502264515-29148-1-git-send-email-fukaige@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.245.74] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.598ABCEC.0014, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: bc80d06a94e1b449e5859e5be5ce5fe7 Subject: [ovs-dev] [PATCH v3] route-table: Remove netdevs in netdev_hash when deleted X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Kaige Fu Start a virtual machine with its backend tap device attached to a brought up linux bridge. If we delete the linux bridge when vm is still running, we'll get the following error when trying to create a ovs bridge with the same name. The reason is that ovs-router subsystem add the linux bridge into netdev_shash, but does not remove it when the bridge is deleted in the situation. When the bridge is deleted, ovs will receive a RTM_DELLINK msg, take this chance to remove the bridge in netdev_shash. ovs-vsctl: Error detected while setting up 'br-eth'. See ovs-vswitchd log for details. ovs-vswitchd log: 2017-05-11T03:45:25.293Z|00026|ofproto_dpif|INFO|system@ovs-system: Datapath supports recirculation 2017-05-11T03:45:25.293Z|00027|ofproto_dpif|INFO|system@ovs-system: MPLS label stack length probed as 1 2017-05-11T03:45:25.293Z|00028|ofproto_dpif|INFO|system@ovs-system: Datapath supports unique flow ids 2017-05-11T03:45:25.293Z|00029|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_state 2017-05-11T03:45:25.293Z|00030|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_zone 2017-05-11T03:45:25.293Z|00031|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_mark 2017-05-11T03:45:25.293Z|00032|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_label 2017-05-11T03:45:25.364Z|00001|ofproto_dpif_upcall(handler226)|INFO|received packet on unassociated datapath port 0 2017-05-11T03:45:25.368Z|00033|netdev_linux|WARN|ethtool command ETHTOOL_GFLAGS on network device br-eth failed: No such device 2017-05-11T03:45:25.368Z|00034|dpif|WARN|system@ovs-system: failed to add br-eth as port: No such device 2017-05-11T03:45:25.368Z|00035|bridge|INFO|bridge br-eth: using datapath ID 00002a51cf9f2841 2017-05-11T03:45:25.368Z|00036|connmgr|INFO|br-eth: added service controller "punix:/var/run/openvswitch/br-eth.mgmt" Signed-off-by: Kaige Fu --- lib/route-table.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/route-table.c b/lib/route-table.c index 67fda31..5107056 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -33,6 +33,7 @@ #include "ovs-router.h" #include "packets.h" #include "rtnetlink.h" +#include "tnl-ports.h" #include "openvswitch/vlog.h" /* Linux 2.6.36 added RTA_MARK, so define it just in case we're building with @@ -79,6 +80,7 @@ static int route_table_reset(void); static void route_table_handle_msg(const struct route_table_msg *); static int route_table_parse(struct ofpbuf *, struct route_table_msg *); static void route_table_change(const struct route_table_msg *, void *); +static void route_table_link_del(const struct rtnetlink_change *, void *); static void route_map_clear(void); static void name_table_init(void); @@ -112,6 +114,8 @@ route_table_init(void) nln_notifier_create(nln, RTNLGRP_IPV6_ROUTE, (nln_notify_func *) route_table_change, NULL); + rtnetlink_notifier_create(route_table_link_del, NULL); + route_table_reset(); name_table_init(); @@ -297,6 +301,17 @@ route_table_change(const struct route_table_msg *change OVS_UNUSED, } static void +route_table_link_del(const struct rtnetlink_change *change, + void *aux OVS_UNUSED) +{ + if(change && change->nlmsg_type == RTM_DELLINK) { + if(change->ifname) { + tnl_port_map_delete_ipdev(change->ifname); + } + } +} + +static void route_table_handle_msg(const struct route_table_msg *change) { if (change->relevant && change->nlmsg_type == RTM_NEWROUTE) {