diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2007-03-21 16:38:47 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:44 -0400 |
commit | 6229e362dd49b9e8387126bd4483ab0574d23e9c (patch) | |
tree | 425c24858a6d21e58e49c05655875237d9b37a7c /net/bridge/br_input.c | |
parent | 604763722c655c7e3f31ecf6f7b4dafcd26a7a15 (diff) |
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.c | 20 |
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) | |||
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Called via br_handle_frame_hook. | 123 | * Called via br_handle_frame_hook. |
124 | * Return 0 if *pskb should be processed furthur | 124 | * Return NULL if skb is handled |
125 | * 1 if *pskb is handled | ||
126 | * note: already called with rcu_read_lock (preempt_disabled) | 125 | * note: already called with rcu_read_lock (preempt_disabled) |
127 | */ | 126 | */ |
128 | int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) | 127 | struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) |
129 | { | 128 | { |
130 | struct sk_buff *skb = *pskb; | ||
131 | const unsigned char *dest = eth_hdr(skb)->h_dest; | 129 | const unsigned char *dest = eth_hdr(skb)->h_dest; |
132 | 130 | ||
133 | if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) | 131 | 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) | |||
135 | 133 | ||
136 | if (unlikely(is_link_local(dest))) { | 134 | if (unlikely(is_link_local(dest))) { |
137 | skb->pkt_type = PACKET_HOST; | 135 | skb->pkt_type = PACKET_HOST; |
138 | return NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev, | 136 | |
139 | NULL, br_handle_local_finish) != 0; | 137 | return (NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev, |
138 | NULL, br_handle_local_finish) == 0) ? skb : NULL; | ||
140 | } | 139 | } |
141 | 140 | ||
142 | if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) { | 141 | if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) { |
143 | if (br_should_route_hook) { | 142 | if (br_should_route_hook) { |
144 | if (br_should_route_hook(pskb)) | 143 | if (br_should_route_hook(&skb)) |
145 | return 0; | 144 | return skb; |
146 | skb = *pskb; | ||
147 | dest = eth_hdr(skb)->h_dest; | 145 | dest = eth_hdr(skb)->h_dest; |
148 | } | 146 | } |
149 | 147 | ||
@@ -152,10 +150,10 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) | |||
152 | 150 | ||
153 | NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, | 151 | NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, |
154 | br_handle_frame_finish); | 152 | br_handle_frame_finish); |
155 | return 1; | 153 | return NULL; |
156 | } | 154 | } |
157 | 155 | ||
158 | err: | 156 | err: |
159 | kfree_skb(skb); | 157 | kfree_skb(skb); |
160 | return 1; | 158 | return NULL; |
161 | } | 159 | } |