All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: Fix detection for IPv4 duplicate address.
@ 2019-08-20 15:19 Dongxu Liu
  2019-08-20 20:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dongxu Liu @ 2019-08-20 15:19 UTC (permalink / raw)
  To: davem, kuznet, yoshfuji, netdev, linux-kernel

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 <liudongxu3@huawei.com>
---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: Fix detection for IPv4 duplicate address.
  2019-08-20 15:19 [PATCH] net: Fix detection for IPv4 duplicate address Dongxu Liu
@ 2019-08-20 20:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-08-20 20:58 UTC (permalink / raw)
  To: liudongxu3; +Cc: kuznet, yoshfuji, netdev, linux-kernel

From: Dongxu Liu <liudongxu3@huawei.com>
Date: Tue, 20 Aug 2019 23:19:05 +0800

> @@ -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) {

Regardless of whether this is a valid change or not, you've unindented the
comment which is completely inappropriate.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-20 20:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 15:19 [PATCH] net: Fix detection for IPv4 duplicate address Dongxu Liu
2019-08-20 20:58 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.