Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp295553ybl; Tue, 20 Aug 2019 20:21:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwN9qkJcMBjFjNBy+RNI9YTE8SKUbzXnqBZwX5BaLXBEVDc35Rj312XsVv1GUXYZkB+r9X+ X-Received: by 2002:a17:902:4ac2:: with SMTP id q2mr29224196plh.81.1566357676793; Tue, 20 Aug 2019 20:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566357676; cv=none; d=google.com; s=arc-20160816; b=Tg82ACQYWFqAzOwoWWbAOPsAVXglV9w3VR5bn4bDwlLGAcwu6PLG383wYICyjvWY6H 1heT99T/twIOOzandjhn31Ploz8Nb+fF3ss3gPvCRIbRndgf+EDBW+eE6ni9PzQ+S5VO g6jcO6W1GDLbxZbMiaYd4L8kim8vQBiSZplKy1KVWBA6plfSON2wsMO6WrQatekObkdQ 3EXq6HuHE9is/dB5+ThTo1fY3mOo9vnyDRjmc0lz9z2zzY7R1319w1cJc4R6qdS4wY2k 1LLhpaKKwDkQCdVM4GdyX9fpg9ycKWa0LJMpzJdFFdmxK+UzgYOwI6s/GRNslb7H+vdf arww== 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=R2fxGq46ohnqgpyzElfIOgjOeu6my8rg3dkHpN9xRtU=; b=HemxY73/Tei6GsLwF+lyzwzXL2hE6d4B956VW/888KfKay9LHcqOE9UxQ9JmoU0Qqm 6AT3AugRqD4+YnYtw+lzBc2UglF/iUcBOQrIa7B8UY+1ib7g7X3rZSuFQ03UIHnD2WlO f5BuPEq3shOkrdxcA4/z5ui3Xvnl6iPUUcNvGjjvhiZYtFwVNqGXX3gbrk/lysAHkQiV ISgS/rX5Bl8JBQpw0JdU2u72N2I9O17sgZfU7E4yw7P73ouXhkYeYvgOLJVE4hs8wngf cs2QFJXXA1ctYtXkX1/akx+LS8rLLvu5xJoM6oEac3OK+4mhPKwZyFMDs+7ZeJMyWGvR QgZg== 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 t16si13722688ply.133.2019.08.20.20.21.01; Tue, 20 Aug 2019 20:21:16 -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 S1727167AbfHUDUM (ORCPT + 99 others); Tue, 20 Aug 2019 23:20:12 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4742 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726864AbfHUDUM (ORCPT ); Tue, 20 Aug 2019 23:20:12 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5D0A5CDE30F52E2A0F31; Wed, 21 Aug 2019 11:20:09 +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; Wed, 21 Aug 2019 11:20:03 +0800 From: Dongxu Liu To: , , , , Subject: [PATCH] net: Add the same IP detection for duplicate address. Date: Wed, 21 Aug 2019 11:20:00 +0800 Message-ID: <20190821032000.10540-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. Windows and some other hosts may send the source IP address instead of 0. When IN_DEV_ORCONF(in_dev, DROP_GRATUITOUS_ARP) is enable, the REQUEST will be dropped. When IN_DEV_ORCONF(in_dev, DROP_GRATUITOUS_ARP) is disable, The case should be added to the IP conflict handling process. Signed-off-by: Dongxu Liu --- net/ipv4/arp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 05eb42f..a51c921 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -801,7 +801,7 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb) GFP_ATOMIC); /* Special case: IPv4 duplicate address detection packet (RFC2131) */ - if (sip == 0) { + 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