From patchwork Wed Nov 1 19:35:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 833101 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=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Uzrxtqra"; dkim-atps=neutral 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 3yRz3M23zCz9t30 for ; Thu, 2 Nov 2017 06:35:59 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8DD84CD6; Wed, 1 Nov 2017 19:35:55 +0000 (UTC) X-Original-To: ovs-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 D16E5CC4 for ; Wed, 1 Nov 2017 19:35:53 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 60CCCE3 for ; Wed, 1 Nov 2017 19:35:53 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id t188so2702015pfd.10 for ; Wed, 01 Nov 2017 12:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2XjnCkgd8ijWRNGKgEk0hmaWk62LkGPSbE4o/Eiz0RE=; b=UzrxtqraOUiLmBFqigvmO1rf1l232Z08s76ynqO9UlQpMJ39bg3F/HM+CAIL9X2tIe T8Vlkl0SVE+HFEqVkXZlaiy/evdAsCTPzCepfpozY8enV5wrwCnnFXRtm5xP00sxJxBj uKXDz4oioj0wepc/bULGL0YVH5BbHIh0Dsdh71vnaDKLAiywrpjvyiHkHx7sWSn4Kj+V 37OMXmUPZgx1p0cfWjfsDQsSJix9pigqPr2xlfFFDFs8HpK9/BQLQlyTFgFStFmcFv2X E5wdT0Un41pUvx+eE7abF6uXiRm0H95JzgpIYc1oe/FlN8eBuW1al53s/qedkb8PpXLB 7QZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2XjnCkgd8ijWRNGKgEk0hmaWk62LkGPSbE4o/Eiz0RE=; b=S+qcQ6SUBj5Rwea09JAmtN8LoLOTAcxevr/uCUE2v4DZ69IVHh2jHTuS4aKlXEGdSD atI+39fdyR7Tt8NcvXxvb4BqipBXaYxs2/k0srV/6ldLU9jqH6QQNeUxkTIohqBhv3XW ovN2KjoFJtoJCt4kaVzwFqJnFJ8+fHbc3qZ85UFakm14JJdnr6q2odVgQfQRPI3IEqL3 BRJJScR5iMcG/bZ8L2Q2mDK54xWMGA9vmfrgCWargk1bLqfNT5QBmMMBNRe8XY8aP7QF xD8oGw/LCB5Xj1FNOA9ehzt7ZL/AcdwPzzmfD4EeQ/PKAkB436+nMh8hvNcMqK/0Rfje 1gOA== X-Gm-Message-State: AMCzsaVD+12+/DGdHiUDuIM4eJHmBIxzenzjrjRnFA+8eBVzC2PvSnSZ CSkv3T5oDjmP8torhw7E+AmIO8yI X-Google-Smtp-Source: ABhQp+R6zTz6kmEI/MQ35zw8+Wx8uxaHzzMm0tosHBsmafOTXQn6k8nM2Kb4sYPKxdSM/60Ez/v5Nw== X-Received: by 10.159.207.147 with SMTP id z19mr625267plo.441.1509564952658; Wed, 01 Nov 2017 12:35:52 -0700 (PDT) Received: from sc9-mailhost3.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id n72sm2578708pfi.92.2017.11.01.12.35.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Nov 2017 12:35:51 -0700 (PDT) From: William Tu To: ovs-dev@openvswitch.org Date: Wed, 1 Nov 2017 12:35:40 -0700 Message-Id: <1509564940-29100-1-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Eric Garver , Gurucharan Shetty Subject: [ovs-dev] [PATCHv2] dpif-netlink-rtnl: Fix ovs_geneve probing after restart. 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When using the out-of-tree (openvswitch compat) geneve module, the first time oot tunnel probing returns true (correct). Without unloading the geneve module, if the userspace ovs-vswitchd restarts, because the 'geneve_sys_6081' still exists, the probing incorrectly returns false and loads the in-tree (upstream kernel) geneve module. The patch fixes it by querying the geneve device's kind when exists. The out-of-tree modules uses kind string as 'ovs_geneve', while the in-tree module uses 'geneve'. To reproduce the issue, start the ovs > /etc/init.d/openvswitch-switch start > creat a bridge and attach a geneve port using out-of-tree geneve > /etc/init.d/openvswitch-switch restart Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides used interface") Signed-off-by: William Tu Cc: Eric Garver Cc: Gurucharan Shetty --- v1->v2: Add detection of existing module, instead of unconditionally remote it and create. --- lib/dpif-netlink-rtnl.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c index 0c32e7d8ccb4..b19b862d308b 100644 --- a/lib/dpif-netlink-rtnl.c +++ b/lib/dpif-netlink-rtnl.c @@ -440,6 +440,7 @@ dpif_netlink_rtnl_probe_oot_tunnels(void) error = netdev_open("ovs-system-probe", "geneve", &netdev); if (!error) { + struct ofpbuf *reply; const struct netdev_tunnel_config *tnl_cfg; tnl_cfg = netdev_get_tunnel_config(netdev); @@ -448,6 +449,36 @@ dpif_netlink_rtnl_probe_oot_tunnels(void) } name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf); + + /* The geneve module exists when ovs-vswitchd crashes + * and restarts, handle the case here. + */ + error = dpif_netlink_rtnl_getlink(name, &reply); + if (!error) { + + struct nlattr *linkinfo[ARRAY_SIZE(linkinfo_policy)]; + struct nlattr *rtlink[ARRAY_SIZE(rtlink_policy)]; + const char *kind; + + nl_policy_parse(reply, NLMSG_HDRLEN + sizeof(struct ifinfomsg), + rtlink_policy, rtlink, + ARRAY_SIZE(rtlink_policy)); + nl_parse_nested(rtlink[IFLA_LINKINFO], linkinfo_policy, + linkinfo, ARRAY_SIZE(linkinfo_policy)); + kind = nl_attr_get_string(linkinfo[IFLA_INFO_KIND]); + + if (!strcmp(kind, "ovs_geneve")) { + out_of_tree = true; + goto exit; + } else if (!strcmp(kind, "geneve")) { + out_of_tree = false; + goto exit; + } else { + VLOG_ABORT("Geneve tunnel device %s with kind %s" + " not supported", name, kind); + } + } + error = dpif_netlink_rtnl_create(tnl_cfg, name, OVS_VPORT_TYPE_GENEVE, "ovs_geneve", (NLM_F_REQUEST | NLM_F_ACK @@ -458,6 +489,10 @@ dpif_netlink_rtnl_probe_oot_tunnels(void) } out_of_tree = true; } + } + +exit: + if (!error) { netdev_close(netdev); }