From patchwork Wed Dec 4 07:17:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 11272197 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7565013A4 for ; Wed, 4 Dec 2019 07:17:45 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FABC20640 for ; Wed, 4 Dec 2019 07:17:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FABC20640 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 653E56090E65; Wed, 4 Dec 2019 07:17:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 653E56090E65 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 51A4D5BB0ADEB; Wed, 4 Dec 2019 07:17:44 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 67D975BAE88BE; Wed, 4 Dec 2019 07:17:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 9E8A15BAE88B5 for ; Wed, 4 Dec 2019 07:17:39 +0000 (UTC) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 34C13605D129 for ; Wed, 4 Dec 2019 07:17:39 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id b19so3182392pfo.2 for ; Tue, 03 Dec 2019 23:17:39 -0800 (PST) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=FIobRcMEDQ8Vvgla44HfScTVPDTw96se9NZnEVOSigo=; b=EJ0CXkqi5EpzDevKTdU8b8f6vgpLaIrNM5dfYlZ6vqq/p/c9HOgkXo3vmqNiKfo1rf LVZtMVlOdDh3tgV+V7qMfpUkw5Yi8QWkjxhMWdHnuXIrFI2dK1yc4JpmIr5qyBj5Lqmv zvrMZiQTHBt9Yk5Q8RIZjZ414Hi1BdaxugVweoFxL5PZJ1gFUXiz6trT7CK42quTTISB hDBOxQLHmAjuekUE3cBkz4WBRwcOTWjtk6BEXB8KyEZNa4cFVU+cLtoBbLYzHquyWuOS tBfJYnzULvfzKXU0qspigwbMUe+lEpKxgkGwMxITmaI6af3dIPUWtrvbGWBh0QQAWHIe Es3g== X-Gm-Message-State: APjAAAVXNjfxeJaoRjgeOthqySJeSL8Q7euw5WWDCDLZyi1lmS4NylHt vYLhhzQj9fpCqlwIAIhdMvQKqGsg+rs= X-Google-Smtp-Source: APXvYqx/ajSpPxJYLZsVYRFssWrgg0dbwIh4icYIRITlu0VA2DPtUJjrdiDaZWPCg9SJe2gcviDX+A== X-Received: by 2002:aa7:98cd:: with SMTP id e13mr2048167pfm.56.1575443857999; Tue, 03 Dec 2019 23:17:37 -0800 (PST) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id k6sm6405872pfi.119.2019.12.03.23.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 23:17:37 -0800 (PST) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [libteam PATCHv2] teamd: update ctx->hwaddr after setting team dev to new hwaddr Date: Wed, 4 Dec 2019 15:17:11 +0800 Message-Id: <20191204071711.6963-1-liuhangbin@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191119103100.9687-1-liuhangbin@gmail.com> References: <20191119103100.9687-1-liuhangbin@gmail.com> MIME-Version: 1.0 Message-ID-Hash: YGZ6UPMYALIJLYMCRGS2IWZGURFGLPDU X-Message-ID-Hash: YGZ6UPMYALIJLYMCRGS2IWZGURFGLPDU X-MailFrom: liuhangbin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Hangbin Liu , jiri@resnulli.us X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: When adding the first slave to team dev, the team dev's hwaddr will be updated to this slave's hwaddr in function: teamd_event_watch_port_added() - teamd_hwaddr_check_change(), But we didn't update the ctx->hwaddr, which is still the team's init hwaddr. Later in the following functions: lacp_port_set_mac() lb_event_watch_port_added() ab_hwaddr_policy_same_all_port_added() they will set the first slave's hwaddr to team's init hwaddr(ctx->hwaddr). This will cause that the first slave(most likely the active slave)'s hwaddr changes to team dev's original hwaddr, and later back to its old hwaddr again, which would make the LACPDUs have different Actor System IDs. Fix it by updating ctx->hwaddr when set ctx->ifindex to new hwaddr. Note that teamd_set_hwaddr() doesn't need this fix as it will set ctx->hwaddr_explicit = true. v2: update commit description, no code changes. Signed-off-by: Hangbin Liu --- teamd/teamd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teamd/teamd.c b/teamd/teamd.c index 6c47312..9622da1 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c @@ -867,7 +867,7 @@ static int teamd_add_ports(struct teamd_context *ctx) static int teamd_hwaddr_check_change(struct teamd_context *ctx, struct teamd_port *tdport) { - const char *hwaddr; + char *hwaddr; unsigned char hwaddr_len; int err; @@ -885,6 +885,8 @@ static int teamd_hwaddr_check_change(struct teamd_context *ctx, teamd_log_err("Failed to set team device hardware address."); return err; } + ctx->hwaddr = hwaddr; + ctx->hwaddr_len = hwaddr_len; return 0; }