From patchwork Tue Jul 2 11:30:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 11027701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA80E13B1 for ; Tue, 2 Jul 2019 11:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97E132851B for ; Tue, 2 Jul 2019 11:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C0A0285DA; Tue, 2 Jul 2019 11:30:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23EB02851B for ; Tue, 2 Jul 2019 11:30:58 +0000 (UTC) Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 1EFE2625009F; Tue, 2 Jul 2019 11:30:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 1EFE2625009F Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 18CDC581B293E; Tue, 2 Jul 2019 11:30:58 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id B4E8E581CE655; Tue, 2 Jul 2019 11:30:54 +0000 (UTC) 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 EDB33581D76B0 for ; Tue, 2 Jul 2019 11:30:53 +0000 (UTC) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) (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 88FD3605D2E1 for ; Tue, 2 Jul 2019 11:30:53 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id w24so241603plp.2 for ; Tue, 02 Jul 2019 04:30:53 -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; bh=62yL9uzTnsKyCqFICcYzq1GRJeOVY6eRtF/d0hBYxz8=; b=l4RmiVOG2n+1Oeeawr1vY6I3IrFT2Cw4k7U+LgZQ8s2HzHs+Ge4IHa0L+5iEfTVBkK dLWIFbl3YGYq+5nipxnfJJOQ9Zq2WuQBVV+3YwTm39yJCkb+cwXdQiv+16QVlU2kztOF ao7glV2SUfh+cYK6JDOhbZxpepNkPkQRbWq80lHP4DQPett+5R1HmQ6e3nlK2riVQ0iM V0StJwG4AYdGTebXSsfbskRqtalwaP6xnDxF6OXExyyw9+MC2Mfqw40OYw0EJfACI0ou 9O9pxZz16T9vJXB1O00cH59lUnTTzzzbdbzD4m+qsRQm71ZkyAtQMFEuxBrrAj7moQSO VC0w== X-Gm-Message-State: APjAAAVIt7Id1egOwNlB97U8O5TChaN6N4IMRw3u/iuwQOn/4ddSp4By PKylaqD9kn0Xg/ZC+V6JUH0kI+lt X-Google-Smtp-Source: APXvYqx+di5r1YzKWe0yCwfWS3N5xemVgfnU+9aQmyX9fc+RgnsgpKZt8AB1deSWpVCRxTMgCFlQng== X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr35750931plo.320.1562067051900; Tue, 02 Jul 2019 04:30:51 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id g2sm25292990pfb.95.2019.07.02.04.30.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jul 2019 04:30:51 -0700 (PDT) From: Xin Long To: libteam@lists.fedorahosted.org Subject: [PATCHv2] teamd: return 0 if tdport doesn't exist in teamd_config_port_set Date: Tue, 2 Jul 2019 19:30:43 +0800 Message-Id: <0e1d909ddd8362c37a2ccd604793b95c763a18ca.1562067043.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 Message-ID-Hash: CTUOAFRQITSF6D7XROR54HHZNODAQKNL X-Message-ID-Hash: CTUOAFRQITSF6D7XROR54HHZNODAQKNL X-MailFrom: lucien.xin@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 Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP This issue can be reproduced by doing: # ip link add dummy1 type dummy # teamd -t team0 -c '{"runner": {"name": "activebackup"}}' -d # teamdctl team0 port config update dummy1 '{"prio": -10}' # ip link set dummy0 master team0 and the error shows: libteamdctl: usock: Error message received: "ConfigUpdateFail" libteamdctl: usock: Error message content: "Failed to update config." command call failed (Invalid argument) It's a regression caused by Commit c8b356a3cd36 ("teamd: config: update local prio to kernel") where it requires the tdport has to exist when a tdport config is being updated. However teamd supports for the port config going first before the port being enslaved. This issue breaks how NM-team starts a team device. Here to fix it by returning 0 even if the tdport doesn't exist in teamd_config_port_set. Reported-by: Radek Vykydal Fixes: c8b356a3cd36 ("teamd: config: update local prio to kernel") Signed-off-by: Xin Long --- teamd/teamd_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teamd/teamd_config.c b/teamd/teamd_config.c index 34fef1f..1bf85ac 100644 --- a/teamd/teamd_config.c +++ b/teamd/teamd_config.c @@ -164,7 +164,7 @@ static int teamd_config_port_set(struct teamd_context *ctx, const char *port_nam tdport = teamd_get_port_by_ifname(ctx, port_name); if (!tdport) - return -ENODEV; + return 0; config = json_object_get(port_obj, "prio"); if (json_is_integer(config)) {