Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4198264ybl; Tue, 20 Aug 2019 08:20:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwb/be0kFSWU7UPjst6ItxeLa+AqkCTb+3Vuvl8DjWm7xDYVc835aHAwvnw7oBs80mxdCA7 X-Received: by 2002:a62:ce8a:: with SMTP id y132mr30360790pfg.240.1566314449971; Tue, 20 Aug 2019 08:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566314449; cv=none; d=google.com; s=arc-20160816; b=GqC+qAoSPP5GG2y/k84j7Gx1FCpkFqG40mHNbzKCqUwxMkI3JLsA/Ct+n+wKpsUuHJ AIEa0QTcX58Xp2Ra4lK6cSg/g9bb7GhNMe8sabQf+l10yctjiAlnM303xAt+3qbtY9I6 SywGOUsw342nWRTuTUpwWM+ddHwWUUCrao9eNsYPDREx+lBOzCyOhF6tpwuhlL30TYX5 gs7MYf2+sACoyx+7R1HdCcbnFC5bOGeNJoORfbeB5GiZphATonerdmNnSbFE9eOwwvDA uwPx7I0yzhPbCfbt4K7T/FqSR3hPb5NRaLKKdQO8tyUcsYXjJob4r7wifJ51rc/8D/5A bZ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from; bh=DJ+w0jGDjjBe9yoUQ6DzQmURKbHHTnYEIsb6K9caoas=; b=hgMypVWzCV8midJfxOBjB1Z9p5DdQLL+zfeG6MW/RAS2W3Xp6HKq/510xomyFQQgkc Yj5K5oqLcb9VvOY+VadFKMt2PsW5MVTHD/76OeLQKnJ1JpCleAqovgfatvZDjqbmhkUJ 5p2T60ipNmg7601W6++5Ur0dH/CP0M5IJzfzymvHLM2ehRIrjV+jbgipmdMHSZg+vH6H RjuDhuR6OyDkfWSon6l2KQndqG0k/CL/8+6DwDnUWJ09rOWXVzLJf/eDZ+iCUdFmUyry PSIo82LieK1+G76KgUOLIvAfbnosrrWx2z5RLs1rXsL5GPAGih+o44XHDpe9tvjBaeJA Q0qQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a59si12541852plc.319.2019.08.20.08.20.34; Tue, 20 Aug 2019 08:20:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730308AbfHTPTe (ORCPT + 99 others); Tue, 20 Aug 2019 11:19:34 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5166 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729956AbfHTPTd (ORCPT ); Tue, 20 Aug 2019 11:19:33 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id EADE958FF6C9E88FE42E; Tue, 20 Aug 2019 23:19:28 +0800 (CST) Received: from szxyal004123181.china.huawei.com (10.65.65.77) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 20 Aug 2019 23:19:27 +0800 From: Dongxu Liu To: , , , , Subject: [PATCH] net: Fix detection for IPv4 duplicate address. Date: Tue, 20 Aug 2019 23:19:05 +0800 Message-ID: <20190820151905.13148-1-liudongxu3@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.65.65.77] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The network sends an ARP REQUEST packet to determine whether there is a host with the same IP. The source IP address of the packet is 0. However, Windows may also send the source IP address to determine, then the source IP address is equal to the destination IP address. Signed-off-by: Dongxu Liu --- net/ipv4/arp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 05eb42f..944f8e8 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -800,8 +800,11 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb) iptunnel_metadata_reply(skb_metadata_dst(skb), GFP_ATOMIC); - /* Special case: IPv4 duplicate address detection packet (RFC2131) */ - if (sip == 0) { +/* Special case: IPv4 duplicate address detection packet (RFC2131). + * Linux usually sends zero to detect duplication, and windows may + * send a same ip (not zero, sip equal to tip) to do this detection. + */ + if (sip == 0 || sip == tip) { if (arp->ar_op == htons(ARPOP_REQUEST) && inet_addr_type_dev_table(net, dev, tip) == RTN_LOCAL && !arp_ignore(in_dev, sip, tip)) -- 2.12.3