summaryrefslogtreecommitdiff
path: root/net/bridge/br_input.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2007-03-21 23:38:47 +0300
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 09:28:44 +0400
commit6229e362dd49b9e8387126bd4483ab0574d23e9c (patch)
tree425c24858a6d21e58e49c05655875237d9b37a7c /net/bridge/br_input.c
parent604763722c655c7e3f31ecf6f7b4dafcd26a7a15 (diff)
downloadlinux-6229e362dd49b9e8387126bd4483ab0574d23e9c.tar.xz
bridge: eliminate call by reference
Change the bridging hook to be simple function with return value rather than modifying the skb argument. This could generate better code and is cleaner. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Diffstat (limited to 'net/bridge/br_input.c')
-rw-r--r--net/bridge/br_input.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index a260679afad8..2f5c379d9ffa 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -121,13 +121,11 @@ static inline int is_link_local(const unsigned char *dest)
/*
* Called via br_handle_frame_hook.
- * Return 0 if *pskb should be processed furthur
- * 1 if *pskb is handled
+ * Return NULL if skb is handled
* note: already called with rcu_read_lock (preempt_disabled)
*/
-int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
+struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
{
- struct sk_buff *skb = *pskb;
const unsigned char *dest = eth_hdr(skb)->h_dest;
if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
@@ -135,15 +133,15 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
if (unlikely(is_link_local(dest))) {
skb->pkt_type = PACKET_HOST;
- return NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
- NULL, br_handle_local_finish) != 0;
+
+ return (NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
+ NULL, br_handle_local_finish) == 0) ? skb : NULL;
}
if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) {
if (br_should_route_hook) {
- if (br_should_route_hook(pskb))
- return 0;
- skb = *pskb;
+ if (br_should_route_hook(&skb))
+ return skb;
dest = eth_hdr(skb)->h_dest;
}
@@ -152,10 +150,10 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
br_handle_frame_finish);
- return 1;
+ return NULL;
}
err:
kfree_skb(skb);
- return 1;
+ return NULL;
}