bridge: Base the BR_PROXYARP decision on the target port flag
Subsystems (3)
PATCH 1/3 bridge: Base the BR_PROXYARP decision on the target port flag
From: Kyeyoon Park <[email protected]>
When doing proxy ARP, instead of checking the bridge port flag for BR_PROXYARP on the bridge port on which the frame was received, check the bridge port flag of the bridge port to which the target device belongs.
--- net/bridge/br_input.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/bridge/br_input.c +1 -2
@@ -105,7 +105,7 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br, } f =__br_fdb_get (br, n->ha, vid); -if (f) +if (f && f->dst->flags &BR_PROXYARP )arp_send (ARPOP_REPLY ,ETH_P_ARP , sip, skb->dev, tip, sha, n->ha, sha);
@@ -155,7 +155,6 @@ int br_handle_frame_finish(struct sk_buff *skb)if (is_broadcast_ether_addr (dest)) {if (IS_ENABLED (CONFIG_INET ) && - p->flags &BR_PROXYARP && skb->protocol ==htons (ETH_P_ARP ))br_do_proxy_arp (skb, br, vid);
Signature · 1 line
1.9.1
PATCH 2/3 bridge: Selectively prevent bridge port flooding for proxy ARP
From: Kyeyoon Park <[email protected]>
Rather than completely blocking the bridge port flooding when BR_PROXYARP is enabled, selectively prevent bridge port flooding for the proxy ARP relevant frames. This is done by marking the "skb" with this info when proxy ARP code executes.
--- net/bridge/br_forward.c | 3 ++- net/bridge/br_input.c | 6 +++++- net/bridge/br_private.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-)
net/bridge/br_forward.c +2 -1
@@ -186,7 +186,8 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb,continue ;/* Do not flood to ports that enable proxy ARP */ -if (p->flags &BR_PROXYARP ) +if (p->flags &BR_PROXYARP && +BR_INPUT_SKB_CB (skb)->proxyarp_replied)continue ; prev =maybe_deliver (prev, p, skb, __packet_hook);
net/bridge/br_input.c +5 -1
@@ -68,6 +68,8 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br,u8 *arpptr, *sha;__be32 sip, tip; +BR_INPUT_SKB_CB (skb)->proxyarp_replied = false; +if (dev->flags &IFF_NOARP )return ;
@@ -105,9 +107,11 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br, } f =__br_fdb_get (br, n->ha, vid); -if (f && f->dst->flags &BR_PROXYARP ) +if (f && f->dst->flags &BR_PROXYARP ) {arp_send (ARPOP_REPLY ,ETH_P_ARP , sip, skb->dev, tip, sha, n->ha, sha); +BR_INPUT_SKB_CB (skb)->proxyarp_replied = true; + }neigh_release (n); }
net/bridge/br_private.h +1 -0
@@ -305,6 +305,7 @@ struct br_input_skb_cb {#endif u16 frag_max_size; +bool proxyarp_replied;#ifdef CONFIG_BRIDGE_VLAN_FILTERING bool vlan_filtered;
Signature · 1 line
1.9.1
PATCH 3/3 bridge: Allow proxy ARP for unicast ARP requests
In reply to Jouni MalinenFrom: Kyeyoon Park <[email protected]>
It is possible for unicast ARP requests to be used and the same proxyarp mechanism should work for them as well as for the broadcast case.
--- net/bridge/br_input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/bridge/br_input.c +4 -4
@@ -157,11 +157,11 @@ int br_handle_frame_finish(struct sk_buff *skb) dst =NULL ; -if (is_broadcast_ether_addr (dest)) { -if (IS_ENABLED (CONFIG_INET ) && - skb->protocol ==htons (ETH_P_ARP )) -br_do_proxy_arp (skb, br, vid); +if (IS_ENABLED (CONFIG_INET ) && + skb->protocol ==htons (ETH_P_ARP )) +br_do_proxy_arp (skb, br, vid); +if (is_broadcast_ether_addr (dest)) { skb2 = skb; unicast = false; }else if (is_multicast_ether_addr (dest)) {
Signature · 1 line
1.9.1
net/bridge/br_input.c static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br, · line 108
Quoted 1 line · On Wed, 4 Feb 2015 11:51:05 +0200 Jouni Malinen <[email protected]> wrote:
net/bridge/br_input.c +1
-0+if (f && f->dst->flags &BR_PROXYARP )
Please add parens when mixing && and & in same if