From patchwork Wed Dec 6 10:36:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=B3bert_Mulik?= X-Patchwork-Id: 845107 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" (1024-bit key; unprotected) header.d=ericsson.onmicrosoft.com header.i=@ericsson.onmicrosoft.com header.b="PkwAJ4aQ"; 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 3ysFQx6Nm6z9s84 for ; Wed, 6 Dec 2017 21:36:41 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 40CC1D74; Wed, 6 Dec 2017 10:36:40 +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 943C2D4F for ; Wed, 6 Dec 2017 10:36:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sesbmg22.ericsson.net (sesbmg22.ericsson.net [193.180.251.48]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id AD169403 for ; Wed, 6 Dec 2017 10:36:37 +0000 (UTC) X-AuditID: c1b4fb30-cc1ff700000029e3-d3-5a27c833bc41 Received: from ESESSHC013.ericsson.se (Unknown_Domain [153.88.183.57]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 73.93.10723.338C72A5; Wed, 6 Dec 2017 11:36:35 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.57) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 6 Dec 2017 11:36:35 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.onmicrosoft.com; s=selector1-ericsson-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=cnF80a6/SvmxQ8wd2HULip7HMX/MixwD5xIxOSy8fxU=; b=PkwAJ4aQ6RkTBxKQCFlisC7Pvk4WZJbIpFuhe4DrAxaVdrd8p7ZGi0vatbPCxbSvgrxmM2LtLcbf5AwBFOmzidtpg5VcuYWEURhOL7jYJJ/1X3BFXg9oVKRPmZQjRS7PGCYib0cIM2uR/6iKLJ19VD6AlnfEdP75bmY4OQfDcZg= Received: from HE1PR07MB3115.eurprd07.prod.outlook.com (10.170.245.13) by HE1PR07MB3116.eurprd07.prod.outlook.com (10.170.245.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.4; Wed, 6 Dec 2017 10:36:33 +0000 Received: from HE1PR07MB3115.eurprd07.prod.outlook.com ([fe80::4526:3dbd:d2a3:b780]) by HE1PR07MB3115.eurprd07.prod.outlook.com ([fe80::4526:3dbd:d2a3:b780%13]) with mapi id 15.20.0282.007; Wed, 6 Dec 2017 10:36:33 +0000 From: =?iso-8859-1?q?R=F3bert_Mulik?= To: "dev@openvswitch.org" Thread-Topic: [PATCH] LACP: Check active partner sys id Thread-Index: AdNufbwVCrYsuN1DTq6HW0aBxl+Siw== Date: Wed, 6 Dec 2017 10:36:33 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=robert.mulik@ericsson.com; x-originating-ip: [91.82.100.59] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR07MB3116; 6:aFiFTaKk1BIEUDuwz8WQHuEpEg9BafUCY25I5lki63UH9H9Vv6pJMJjqRXhCkTJBzePBkKIixWly6fvF/SrCZ3ZUbQTqhl1ZsLaQo0JTZ3erPRF7BOlLAg+1/CDhkjjru3kIrjg/FldDEl9NN5UbmuSPaTFGUZm6PV5/YqZPmBqPjnJu96liGqWya8MrkY/wt6NVA0wXXzUox/+CNyaDOzWkdqstR6Ol6HPICT3i+V4iyrW0BL9gOZ4WfVKMguLj9YYQf52N2Fb5NzPAagPzQFqq/ZykeOJLALFqV22An/skfueXLFGxu+Tsopogc6syHTG9JZb/dM1yyOQm7P68Cy3AvTb2E+UrdWsEngnuYF0=; 5:7nsui32J0IoHZ8o1KZsnkX2vsI6NHqxXyR4OaUV5ASuxwBhIA7eliiJa6CYRNmcDRftB8p2HkgSJkOOq3BDRocarLWMuZLV3gSo40slNe6FtDyY/rcy23C4joCF3buB6HjuWrSH1NY3tkHYDKkUx3rhg5sGgXQRMrAMV5z7KIK0=; 24:wmJsX3W2gzU8NaMNEE8eL+OVCYBA++nQThNEwKbZNApiHw8RYTrH3D1KLSGAhAJToKNf9ZNHvTWzt2psfD3TE3fb+M0txK22ugjwfoQPKCc=; 7:MHSGSWB+Ls22Zt7NsLj5zZoPGeVeuo+hpT4Z1q0ocoql/hE+ObfzJ4p7Qjn8vZkGgjjHXY9sL/WpXZ/TFkMv9nNMGBcOxrfkInFe0Lz56IvVGOiU/0TgPme4gvW2j5azs7DFqbJjVEYO2ulvY1jRywn6cVBDaTh0nxlrIuDgf+N98ygtzcZL48IHpEG5HTiwbobLBZvQ4t9jBnJ0E9pHwVxKcx66TwTSgy/fmf1zSxBchZ1ir6cOUChZKaSjBBKy x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 181d477f-d75e-4be8-f55e-08d53c95382b x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603286); SRVR:HE1PR07MB3116; x-ms-traffictypediagnostic: HE1PR07MB3116: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(3002001)(3231022)(10201501046)(93006095)(93001095)(6041248)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(6072148)(201708071742011); SRVR:HE1PR07MB3116; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR07MB3116; x-forefront-prvs: 05134F8B4F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(39860400002)(199004)(189003)(66066001)(478600001)(2906002)(99286004)(9686003)(5250100002)(3660700001)(6916009)(86362001)(3280700002)(14454004)(33656002)(106356001)(105586002)(2351001)(5660300001)(3846002)(6116002)(8676002)(81156014)(81166006)(1730700003)(53936002)(8936002)(68736007)(6506006)(305945005)(6436002)(74316002)(7736002)(102836003)(55016002)(5640700003)(25786009)(2900100001)(2501003)(7696005)(97736004)(5890100001)(316002)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR07MB3116; H:HE1PR07MB3115.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 181d477f-d75e-4be8-f55e-08d53c95382b X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2017 10:36:33.2054 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB3116 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0hTYRjHeXfOtuPywOua+qAJNgaC0tSVlBqSRFBgEIEhS7GTnnRepuzY 0giyyyJngpYGjnDTllopghQtMsvVMM1LqaTZxEtmSIqZZh+a1razoG+/5//83+fGSxFSFxlC abQlrE7LFMhFErI+7Un8rt1vItQxQ6a4fY63XcQBdHjh4x90DKkl+7PZAo2e1UUnnZLkGlo7 hMVzYaXrLwziclQdaER+FOA9UOWoFxuRhJLiVwg67lwX8UEvgncDTqEnIHEVAbNT84jP1Ang 5lKN780cgor1ceQpJsLJ4FiziD0sw9FgvzFIeng7VsEl63efvhe6zS0CI6LcrISJuwc9MokV YO22ER6mcTqYLKMCDyMcBL/627xM4GCYnDcL+LkxWLuGCZ4DYfHzlpD3p8PMdLtPD4dOy4qY 5zAYMVd6FwBsF8NmU5PPpITHNcuI56PwY+EewZusCBpGb/u6RcLI4KqQ53wYa7J4FwCcAA0D GbzfQsCgzekrugMaa+/7ulULoelnn7eQFLPQ0m5A/FVCYGqsAlWjKNN/2/HsPkxdrYjnKGhu /EaYvJcJgL76edKCyAcokGO504U5KpWS1WmyOK5Iq9SyJZ3I/Sd6Hv2OsaHFr8l2hCkk96dn X0eopUJGz5UV2hFQhFxG4x63RGczZedZXVGm7mwBy9lRKEXKg+m+I7RainOYEjafZYtZ3b+s gPILKUe0P6fdzBgzzrQFObNS36dQzUxS3pn0aeuCK65VcfLcMKNKLN0YuLZyUT8eakvLVMSG Rm6ZD8UfdxieVz17OPySNgnHExZJZmtS09/7Jdw0ffnCVWJjM+/T2pXVVNlTxa1ORUpzkuuE PkC9TLuco8LED5MTQxnbZEs7owrjKuUkl8vERhI6jvkLVJWVGg8DAAA= X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] LACP: Check active partner sys id 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 A reboot of one switch in an MC-LAG bond makes all bond links to go down, causing a total connectivity loss for 3 seconds. Packet capture shows that spurious LACP PDUs are sent to OVS with a different MAC address (partner system id) during the final stages of the MC-LAG switch reboot. The current implementation doesn't care about the partner sys_id (MAC address). The code change based on the following: - If an interface (lead interface) on a bond has an "attached" LACP connection, then any other slaves on that bond is allowed to become active only when its partner's sys_id is the same as the partner's sys_id of the lead interface. - So, when a slave interface of a bond becomes "current" (it gets valid LACP information), first checks if there is already an active interface on the bond. - If there is a lead, the slave checks for the partner sys_ids, and becomes active only when they are the same, otherwise it remains in "current" state, but "detached". - If there is no lead, it follows the old way, and accepts any partner sys_id. Signed-off-by: Robert Mulik --- lib/lacp.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) -- 1.9.1 diff --git a/lib/lacp.c b/lib/lacp.c index e6ad7b9..eaac2a5 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -595,7 +595,7 @@ lacp_wait(struct lacp *lacp) OVS_EXCLUDED(mutex) static void lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex) { - struct slave *lead, *slave; + struct slave *lead, *lead_current, *slave; struct lacp_info lead_pri; bool lead_enable; static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 10); @@ -603,7 +603,25 @@ lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex) lacp->update = false; lead = NULL; + lead_current = NULL; lead_enable = false; + + /* Check if there is a working interface. + * Store as lead_current, if there is one. */ + HMAP_FOR_EACH (slave, node, &lacp->slaves) { + if (slave->status == LACP_CURRENT && slave->attached) { + struct lacp_info pri; + slave_get_priority(slave, &pri); + if (!lead_current || memcmp(&pri, &lead_pri, sizeof pri) < 0) { + lead_current = slave; + lead = lead_current; + lead_pri = pri; + lead_enable = true; + } + } + } + + /* Find interface with highest priority. */ HMAP_FOR_EACH (slave, node, &lacp->slaves) { struct lacp_info pri; @@ -624,14 +642,22 @@ lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex) continue; } - slave->attached = true; slave_get_priority(slave, &pri); bool enable = slave_may_enable__(slave); - if (!lead - || enable > lead_enable - || (enable == lead_enable - && memcmp(&pri, &lead_pri, sizeof pri) < 0)) { + /* Check if partner MAC address is the same as on the working + * interface. Activate slave only if the MAC is the same, or + * there is no working interface. */ + if (!lead_current || (lead_current + && eth_addr_equals(slave->partner.sys_id, + lead_current->partner.sys_id))) { + slave->attached = true; + } + if (slave->attached && + (!lead + || enable > lead_enable + || (enable == lead_enable + && memcmp(&pri, &lead_pri, sizeof pri) < 0))) { lead = slave; lead_enable = enable; lead_pri = pri;