From patchwork Fri Apr 17 19:08:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Shirshov X-Patchwork-Id: 11496011 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 257E815AB for ; Fri, 17 Apr 2020 19:08:22 +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 E855820780 for ; Fri, 17 Apr 2020 19:08:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E855820780 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 4625560C3A82; Fri, 17 Apr 2020 19:08:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 4625560C3A82 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 28D575DF47C09; Fri, 17 Apr 2020 19:08:21 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id CA89A5E03D832; Fri, 17 Apr 2020 19:08:17 +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,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-osuosl01.fedoraproject.org (smtp-mm-osuosl01.vpn.fedoraproject.org [192.168.1.23]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 0058E5E03D82C for ; Fri, 17 Apr 2020 19:08:16 +0000 (UTC) Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (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-osuosl01.fedoraproject.org (Postfix) with ESMTPS id B849F98051 for ; Fri, 17 Apr 2020 19:08:16 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id n16so1546134pgb.7 for ; Fri, 17 Apr 2020 12:08:16 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=0Zdb/qveulvBvJAHmCEVkB7VmpPbWxlDYFZod2Bpimg=; b=sF5L0o0sIfAOttiT/1deJibjDAp/r+nugcrdg1hnFCuQn6UlBIojNiMr4EMIr6R3j9 yRhnAXnBzTWWL9U9R30zzm+xuDOdoMTQ3t15LeQcddktFpD7mLOeY7QYjw0LXAILryFg GD/v6JqMMaRlHRtzoxbpZjW3pWAzOQ1PJ/J2wkFKH9Ii2hKG5/KHNMZynafSsjxzxkm9 wts7I3Xcke8DWJxpfA5JKKH9QspMGaNaKi2ICOnugFR783Ow8Lwrq8SaAnnt+zjYui/7 o3XYlmABIyoKRw1UaYAlgSmJ/H+HisfYIAMkmyk8n0lhYzlBLMqN80m4iNJDhHGzsf3p /tXw== X-Gm-Message-State: AGi0PubC/pTl9YKboKgmSLHkcP8zHBITlxq5BHEZ1CpX+yPD5fD1cfvX 2GBrwxxR/7CmuGFXgposP092Uepu X-Google-Smtp-Source: APiQypKGp9WRJV8DL7UIuBih/7PKDB7GS79WZLw5H+p4ktXLW4rYxN8dL4UffZaTsE+IDJbdde+oYg== X-Received: by 2002:aa7:93c2:: with SMTP id y2mr4561329pff.50.1587150495748; Fri, 17 Apr 2020 12:08:15 -0700 (PDT) Received: from localhost.localdomain (50-47-139-32.evrt.wa.frontiernet.net. [50.47.139.32]) by smtp.gmail.com with ESMTPSA id j6sm20148660pfe.134.2020.04.17.12.08.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2020 12:08:15 -0700 (PDT) From: Pavel Shirshov To: libteam@lists.fedorahosted.org Subject: [PATCH] Send LACP PDU right after Actor state has been changed Date: Fri, 17 Apr 2020 12:08:06 -0700 Message-Id: <1587150486-12634-1-git-send-email-pavel.contrib@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Message-ID-Hash: V43G47CAPYO4N7W5YK56YCF5PQIGS553 X-Message-ID-Hash: V43G47CAPYO4N7W5YK56YCF5PQIGS553 X-MailFrom: pavel.contrib@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: 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: Fix a bug in libteam LACP protocol implementation. According to the LACP standard "LACP daemon must send LACP PDU packets with updates "when the Actor’s state changes or when it is apparent from the Partner’s LACPDUs that the Partner does not know the Actor’s current state." The current libteam implementation sends periodic updates only, so in LACP rate slow mode the update will be sent within 30 seconds which doesn't follow the LACP standard. To fix the issue: 1. The following patch was reverted: https://github.com/jpirko/libteam/commit/b2de61b39696c9158e725a691aee5a6f16a64137 2. LACP actor state recalculated before the comparison what the LACP partner thinks about the LACP actor state. Signed-off-by: Pavel Shirshov --- teamd/teamd_runner_lacp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c index ec01237..11d02f1 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -996,8 +996,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, return err; lacp_port_actor_update(lacp_port); - if (lacp_port->periodic_on) - return 0; + return lacpdu_send(lacp_port); } @@ -1110,9 +1109,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) if (err) return err; + lacp_port_actor_update(lacp_port); + /* Check if the other side has correct info about us */ - if (!lacp_port->periodic_on && - memcmp(&lacpdu.partner, &lacp_port->actor, + if (memcmp(&lacpdu.partner, &lacp_port->actor, sizeof(struct lacpdu_info))) { err = lacpdu_send(lacp_port); if (err)