diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2012-03-04 03:56:25 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-05-11 04:08:11 -0400 |
commit | c3e29312c8c27d403f91522711ce9a290c7571c9 (patch) | |
tree | a366ebef6e2d65ed5fdbec48e38fc3e630a9e367 /net/batman-adv/routing.c | |
parent | ffa995e036bef734ea40cbbccda574d1df3a8a58 (diff) |
batman-adv: register batman ogm receive function during protocol init
The B.A.T.M.A.N. IV OGM receive function still was hard-coded although
it is a routing protocol specific function. This patch takes advantage
of the dynamic packet handler registration to remove the hard-coded
function calls.
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index ff560863bc74..7ed9d8f92916 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -248,37 +248,35 @@ int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, | |||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | int recv_bat_ogm_packet(struct sk_buff *skb, struct hard_iface *hard_iface) | 251 | bool check_management_packet(struct sk_buff *skb, |
252 | struct hard_iface *hard_iface, | ||
253 | int header_len) | ||
252 | { | 254 | { |
253 | struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); | ||
254 | struct ethhdr *ethhdr; | 255 | struct ethhdr *ethhdr; |
255 | 256 | ||
256 | /* drop packet if it has not necessary minimum size */ | 257 | /* drop packet if it has not necessary minimum size */ |
257 | if (unlikely(!pskb_may_pull(skb, BATMAN_OGM_HLEN))) | 258 | if (unlikely(!pskb_may_pull(skb, header_len))) |
258 | return NET_RX_DROP; | 259 | return false; |
259 | 260 | ||
260 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | 261 | ethhdr = (struct ethhdr *)skb_mac_header(skb); |
261 | 262 | ||
262 | /* packet with broadcast indication but unicast recipient */ | 263 | /* packet with broadcast indication but unicast recipient */ |
263 | if (!is_broadcast_ether_addr(ethhdr->h_dest)) | 264 | if (!is_broadcast_ether_addr(ethhdr->h_dest)) |
264 | return NET_RX_DROP; | 265 | return false; |
265 | 266 | ||
266 | /* packet with broadcast sender address */ | 267 | /* packet with broadcast sender address */ |
267 | if (is_broadcast_ether_addr(ethhdr->h_source)) | 268 | if (is_broadcast_ether_addr(ethhdr->h_source)) |
268 | return NET_RX_DROP; | 269 | return false; |
269 | 270 | ||
270 | /* create a copy of the skb, if needed, to modify it. */ | 271 | /* create a copy of the skb, if needed, to modify it. */ |
271 | if (skb_cow(skb, 0) < 0) | 272 | if (skb_cow(skb, 0) < 0) |
272 | return NET_RX_DROP; | 273 | return false; |
273 | 274 | ||
274 | /* keep skb linear */ | 275 | /* keep skb linear */ |
275 | if (skb_linearize(skb) < 0) | 276 | if (skb_linearize(skb) < 0) |
276 | return NET_RX_DROP; | 277 | return false; |
277 | |||
278 | bat_priv->bat_algo_ops->bat_ogm_receive(hard_iface, skb); | ||
279 | 278 | ||
280 | kfree_skb(skb); | 279 | return true; |
281 | return NET_RX_SUCCESS; | ||
282 | } | 280 | } |
283 | 281 | ||
284 | static int recv_my_icmp_packet(struct bat_priv *bat_priv, | 282 | static int recv_my_icmp_packet(struct bat_priv *bat_priv, |