|
@@ -139,21 +139,22 @@ static inline int is_link_local(const unsigned char *dest)
|
|
|
* Return NULL if skb is handled
|
|
* Return NULL if skb is handled
|
|
|
* note: already called with rcu_read_lock
|
|
* note: already called with rcu_read_lock
|
|
|
*/
|
|
*/
|
|
|
-struct sk_buff *br_handle_frame(struct sk_buff *skb)
|
|
|
|
|
|
|
+rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
|
|
|
{
|
|
{
|
|
|
struct net_bridge_port *p;
|
|
struct net_bridge_port *p;
|
|
|
|
|
+ struct sk_buff *skb = *pskb;
|
|
|
const unsigned char *dest = eth_hdr(skb)->h_dest;
|
|
const unsigned char *dest = eth_hdr(skb)->h_dest;
|
|
|
br_should_route_hook_t *rhook;
|
|
br_should_route_hook_t *rhook;
|
|
|
|
|
|
|
|
if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
|
|
if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
|
|
|
- return skb;
|
|
|
|
|
|
|
+ return RX_HANDLER_PASS;
|
|
|
|
|
|
|
|
if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
|
|
if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
|
|
|
goto drop;
|
|
goto drop;
|
|
|
|
|
|
|
|
skb = skb_share_check(skb, GFP_ATOMIC);
|
|
skb = skb_share_check(skb, GFP_ATOMIC);
|
|
|
if (!skb)
|
|
if (!skb)
|
|
|
- return NULL;
|
|
|
|
|
|
|
+ return RX_HANDLER_CONSUMED;
|
|
|
|
|
|
|
|
p = br_port_get_rcu(skb->dev);
|
|
p = br_port_get_rcu(skb->dev);
|
|
|
|
|
|
|
@@ -167,10 +168,12 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
|
|
|
goto forward;
|
|
goto forward;
|
|
|
|
|
|
|
|
if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
|
|
if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
|
|
|
- NULL, br_handle_local_finish))
|
|
|
|
|
- return NULL; /* frame consumed by filter */
|
|
|
|
|
- else
|
|
|
|
|
- return skb; /* continue processing */
|
|
|
|
|
|
|
+ NULL, br_handle_local_finish)) {
|
|
|
|
|
+ return RX_HANDLER_CONSUMED; /* consumed by filter */
|
|
|
|
|
+ } else {
|
|
|
|
|
+ *pskb = skb;
|
|
|
|
|
+ return RX_HANDLER_PASS; /* continue processing */
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
forward:
|
|
forward:
|
|
@@ -178,8 +181,10 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
|
|
|
case BR_STATE_FORWARDING:
|
|
case BR_STATE_FORWARDING:
|
|
|
rhook = rcu_dereference(br_should_route_hook);
|
|
rhook = rcu_dereference(br_should_route_hook);
|
|
|
if (rhook) {
|
|
if (rhook) {
|
|
|
- if ((*rhook)(skb))
|
|
|
|
|
- return skb;
|
|
|
|
|
|
|
+ if ((*rhook)(skb)) {
|
|
|
|
|
+ *pskb = skb;
|
|
|
|
|
+ return RX_HANDLER_PASS;
|
|
|
|
|
+ }
|
|
|
dest = eth_hdr(skb)->h_dest;
|
|
dest = eth_hdr(skb)->h_dest;
|
|
|
}
|
|
}
|
|
|
/* fall through */
|
|
/* fall through */
|
|
@@ -194,5 +199,5 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
|
|
|
drop:
|
|
drop:
|
|
|
kfree_skb(skb);
|
|
kfree_skb(skb);
|
|
|
}
|
|
}
|
|
|
- return NULL;
|
|
|
|
|
|
|
+ return RX_HANDLER_CONSUMED;
|
|
|
}
|
|
}
|