From patchwork Fri Jan 11 01:57:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 10757203 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 F0AFF13B5 for ; Fri, 11 Jan 2019 01:57:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF71229AF4 for ; Fri, 11 Jan 2019 01:57:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D376C29B0C; Fri, 11 Jan 2019 01:57:35 +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 6E61029AF4 for ; Fri, 11 Jan 2019 01:57:35 +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 2F32360E816D; Fri, 11 Jan 2019 01:57:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 2F32360E816D Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 1CC873062D566; Fri, 11 Jan 2019 01:57:34 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 65BDD3062D565; Fri, 11 Jan 2019 01:57:30 +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 610B93062D547 for ; Fri, 11 Jan 2019 01:57:29 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id E3290605D2D8 for ; Fri, 11 Jan 2019 01:57:28 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id j10so5635198pga.1 for ; Thu, 10 Jan 2019 17:57:28 -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:mime-version :content-transfer-encoding; bh=Ob73m6lN6Qxi06J15ecpVlmhDpsNGTgu3cgvQjO7VKM=; b=kZnqNvIW+PewcvvNYECvKfWbZm/QDZP0OeQp3ofVW7vigxmiOieAYWVHSf8L9CbY4C l1Em1mboizDpHpug2gj+Lb3ejzuZnBmEaXR/trNobs4sAwz/1+XHl3HnmbORkWg0SAM3 t3VoQseQonXi6sGvqVDa1oou3TCDWLj2fjQM+PhOMjQT3QtZBtkTsIezk5yE5itudc3M NBRtghulGwxQ5JAS5pQ//PmNxR5rsYJDqqGSoG152YHblIfzNM8+bdIxPhp6+B3NM/24 1GdAYAMX1cTNTVJsu66pw/ZI8aTCkmNyb/zBmArFejIJdU72RIO0aukN8Qr5Z7QY3YSl gxXw== X-Gm-Message-State: AJcUukdqAbEgYOFA6QwiRtn04irXBKUlNIUT83CgLTNuLPlaZfeaTuzo HhtubxUoeAb01zoxk6BmhNBMR9Q2 X-Google-Smtp-Source: ALg8bN6QUPG9BeDiCkbPlgwoH7cT6//MDXZL7a+5eAE3y154yQkgNs7Ebubt3rGWRuraUfoTgf+NNw== X-Received: by 2002:a63:2586:: with SMTP id l128mr11798684pgl.104.1547171847689; Thu, 10 Jan 2019 17:57:27 -0800 (PST) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id h64sm120810309pfc.142.2019.01.10.17.57.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 17:57:27 -0800 (PST) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [patch libteam] teamd: lw: arp_ping: only check arp reply message Date: Fri, 11 Jan 2019 09:57:10 +0800 Message-Id: <20190111015710.16264-1-liuhangbin@gmail.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Message-ID-Hash: MGBS7RG24YUM7VW6UQZWM6JUVZFUNFXZ X-Message-ID-Hash: MGBS7RG24YUM7VW6UQZWM6JUVZFUNFXZ 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: Jiri Pirko , Hangbin Liu X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-Virus-Scanned: ClamAV using ClamSMTP Currently we check both arp request and reply message for arp_ping link watch. But if we enabled validate_active and validate_inactive at the same time, we will receive the other slave's arp request as the switch broadcasts arp request message. i.e. slave1 receives arp request from slave2 and vice versa. Then the arp check will pass even the target is unreachable. Fix it by only check arp reply message. Reported-by: LiLiang Signed-off-by: Hangbin Liu --- teamd/teamd_lw_arp_ping.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/teamd/teamd_lw_arp_ping.c b/teamd/teamd_lw_arp_ping.c index 01cd6e1..81806f0 100644 --- a/teamd/teamd_lw_arp_ping.c +++ b/teamd/teamd_lw_arp_ping.c @@ -336,7 +336,8 @@ static int lw_ap_receive(struct lw_psr_port_priv *psr_ppriv) if (ap.ah.ar_hrd != htons(ll_my.sll_hatype) || ap.ah.ar_pro != htons(ETH_P_IP) || ap.ah.ar_hln != ll_my.sll_halen || - ap.ah.ar_pln != 4) { + ap.ah.ar_pln != 4 || + ap.ah.ar_op != htons(ARPOP_REPLY)) { return 0; }