Skip to content

Commit c69c2cd

Browse files
Nikolay Aleksandrovdavem330
authored andcommitted
net: bridge: convert neigh_suppress_enabled option to a bit
Convert the neigh_suppress_enabled option to a bit. Signed-off-by: Nikolay Aleksandrov <[email protected]> Reviewed-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 675779a commit c69c2cd

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

net/bridge/br_arp_nd_proxy.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void br_recalculate_neigh_suppress_enabled(struct net_bridge *br)
3939
}
4040
}
4141

42-
br->neigh_suppress_enabled = neigh_suppress;
42+
br_opt_toggle(br, BROPT_NEIGH_SUPPRESS_ENABLED, neigh_suppress);
4343
}
4444

4545
#if IS_ENABLED(CONFIG_INET)
@@ -155,7 +155,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
155155
ipv4_is_multicast(tip))
156156
return;
157157

158-
if (br->neigh_suppress_enabled) {
158+
if (br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED)) {
159159
if (p && (p->flags & BR_NEIGH_SUPPRESS))
160160
return;
161161
if (ipv4_is_zeronet(sip) || sip == tip) {
@@ -175,7 +175,8 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
175175
return;
176176
}
177177

178-
if (br->neigh_suppress_enabled && br_is_local_ip(vlandev, tip)) {
178+
if (br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED) &&
179+
br_is_local_ip(vlandev, tip)) {
179180
/* its our local ip, so don't proxy reply
180181
* and don't forward to neigh suppress ports
181182
*/
@@ -213,7 +214,8 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
213214
/* If we have replied or as long as we know the
214215
* mac, indicate to arp replied
215216
*/
216-
if (replied || br->neigh_suppress_enabled)
217+
if (replied ||
218+
br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED))
217219
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
218220
}
219221

@@ -460,7 +462,8 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
460462
* mac, indicate to NEIGH_SUPPRESS ports that we
461463
* have replied
462464
*/
463-
if (replied || br->neigh_suppress_enabled)
465+
if (replied ||
466+
br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED))
464467
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
465468
}
466469
neigh_release(n);

net/bridge/br_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
6767
if (IS_ENABLED(CONFIG_INET) &&
6868
(eth->h_proto == htons(ETH_P_ARP) ||
6969
eth->h_proto == htons(ETH_P_RARP)) &&
70-
br->neigh_suppress_enabled) {
70+
br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED)) {
7171
br_do_proxy_suppress_arp(skb, br, vid, NULL);
7272
} else if (IS_ENABLED(CONFIG_IPV6) &&
7373
skb->protocol == htons(ETH_P_IPV6) &&
74-
br->neigh_suppress_enabled &&
74+
br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED) &&
7575
pskb_may_pull(skb, sizeof(struct ipv6hdr) +
7676
sizeof(struct nd_msg)) &&
7777
ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) {

net/bridge/br_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
122122
br_do_proxy_suppress_arp(skb, br, vid, p);
123123
} else if (IS_ENABLED(CONFIG_IPV6) &&
124124
skb->protocol == htons(ETH_P_IPV6) &&
125-
br->neigh_suppress_enabled &&
125+
br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED) &&
126126
pskb_may_pull(skb, sizeof(struct ipv6hdr) +
127127
sizeof(struct nd_msg)) &&
128128
ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) {

net/bridge/br_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ enum net_bridge_opts {
318318
BROPT_MULTICAST_QUERY_USE_IFADDR,
319319
BROPT_MULTICAST_STATS_ENABLED,
320320
BROPT_HAS_IPV6_ADDR,
321+
BROPT_NEIGH_SUPPRESS_ENABLED,
321322
};
322323

323324
struct net_bridge {
@@ -414,7 +415,6 @@ struct net_bridge {
414415
#ifdef CONFIG_NET_SWITCHDEV
415416
int offload_fwd_mark;
416417
#endif
417-
bool neigh_suppress_enabled;
418418
bool mtu_set_by_user;
419419
struct hlist_head fdb_list;
420420
};

0 commit comments

Comments
 (0)