mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
bridge: reduce size of input cb to 16 bytes
Reduce size of br_input_skb_cb from 24 to 16 bytes by using bitfield for those values that can only be 0 or 1. igmp is the igmp type value, so it needs to be at least u8. Furthermore, the bridge currently relies on step-by-step initialization of br_input_skb_cb fields as the skb passes through the stack. Explicitly zero out the bridge input cb instead, this avoids having to review/validate that no BR_INPUT_SKB_CB(skb)->foo test can see a 'random' value from previous protocol cb. AFAICS all current fields are always set up before they are read again, so this is not a bug fix. Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
26f7fe4a5d
commit
f12064d1b4
@ -131,7 +131,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
u8 *arpptr, *sha;
|
||||
__be32 sip, tip;
|
||||
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = false;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 0;
|
||||
|
||||
if ((dev->flags & IFF_NOARP) ||
|
||||
!pskb_may_pull(skb, arp_hdr_len(dev)))
|
||||
@ -161,7 +161,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
return;
|
||||
if (ipv4_is_zeronet(sip) || sip == tip) {
|
||||
/* prevent flooding to neigh suppress ports */
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
/* its our local ip, so don't proxy reply
|
||||
* and don't forward to neigh suppress ports
|
||||
*/
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
*/
|
||||
if (replied ||
|
||||
br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED))
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 1;
|
||||
}
|
||||
|
||||
neigh_release(n);
|
||||
@ -393,7 +393,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
|
||||
struct ipv6hdr *iphdr;
|
||||
struct neighbour *n;
|
||||
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = false;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 0;
|
||||
|
||||
if (p && (p->flags & BR_NEIGH_SUPPRESS))
|
||||
return;
|
||||
@ -401,7 +401,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
|
||||
if (msg->icmph.icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT &&
|
||||
!msg->icmph.icmp6_solicited) {
|
||||
/* prevent flooding to neigh suppress ports */
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
|
||||
|
||||
if (ipv6_addr_any(saddr) || !ipv6_addr_cmp(saddr, daddr)) {
|
||||
/* prevent flooding to neigh suppress ports */
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -432,7 +432,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
|
||||
/* its our own ip, so don't proxy reply
|
||||
* and don't forward to arp suppress ports
|
||||
*/
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,
|
||||
*/
|
||||
if (replied ||
|
||||
br_opt_get(br, BROPT_NEIGH_SUPPRESS_ENABLED))
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = true;
|
||||
BR_INPUT_SKB_CB(skb)->proxyarp_replied = 1;
|
||||
}
|
||||
neigh_release(n);
|
||||
}
|
||||
|
@ -227,6 +227,8 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
|
||||
if (!skb)
|
||||
return RX_HANDLER_CONSUMED;
|
||||
|
||||
memset(skb->cb, 0, sizeof(struct br_input_skb_cb));
|
||||
|
||||
p = br_port_get_rcu(skb->dev);
|
||||
if (p->flags & BR_VLAN_TUNNEL) {
|
||||
if (br_handle_ingress_vlan_tunnel(skb, p,
|
||||
|
@ -425,15 +425,13 @@ struct br_input_skb_cb {
|
||||
struct net_device *brdev;
|
||||
|
||||
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
|
||||
int igmp;
|
||||
int mrouters_only;
|
||||
u8 igmp;
|
||||
u8 mrouters_only:1;
|
||||
#endif
|
||||
|
||||
bool proxyarp_replied;
|
||||
bool src_port_isolated;
|
||||
|
||||
u8 proxyarp_replied:1;
|
||||
u8 src_port_isolated:1;
|
||||
#ifdef CONFIG_BRIDGE_VLAN_FILTERING
|
||||
bool vlan_filtered;
|
||||
u8 vlan_filtered:1;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_SWITCHDEV
|
||||
|
Loading…
Reference in New Issue
Block a user