generic: 6.1: replace ipq40xx MDIO patch with upstream version
[openwrt/openwrt.git] / target / linux / generic / pending-6.1 / 151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 4 Jan 2024 15:21:21 +0100
3 Subject: [PATCH] net: bridge: do not send arp replies if src and target hw
4 addr is the same
5
6 There are broken devices in the wild that handle duplicate IP address
7 detection by sending out ARP requests for the IP that they received from a
8 DHCP server and refuse the address if they get a reply.
9 When proxyarp is enabled, they would go into a loop of requesting an address
10 and then NAKing it again.
11
12 Link: https://github.com/openwrt/openwrt/issues/14309
13 Signed-off-by: Felix Fietkau <nbd@nbd.name>
14 ---
15
16 --- a/net/bridge/br_arp_nd_proxy.c
17 +++ b/net/bridge/br_arp_nd_proxy.c
18 @@ -204,7 +204,10 @@ void br_do_proxy_suppress_arp(struct sk_
19 if ((p && (p->flags & BR_PROXYARP)) ||
20 (f->dst && (f->dst->flags & (BR_PROXYARP_WIFI |
21 BR_NEIGH_SUPPRESS)))) {
22 - if (!vid)
23 + replied = true;
24 + if (!memcmp(n->ha, sha, dev->addr_len))
25 + replied = false;
26 + else if (!vid)
27 br_arp_send(br, p, skb->dev, sip, tip,
28 sha, n->ha, sha, 0, 0);
29 else
30 @@ -212,7 +215,6 @@ void br_do_proxy_suppress_arp(struct sk_
31 sha, n->ha, sha,
32 skb->vlan_proto,
33 skb_vlan_tag_get(skb));
34 - replied = true;
35 }
36
37 /* If we have replied or as long as we know the