diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-06-05 16:31:31 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-07-01 16:47:21 -0400 |
commit | 56303d34a332be8e2f4daf7891ebc12cb7900529 (patch) | |
tree | bc972916771e698bd8a88fd66917950ce0bd48c1 /net/batman-adv/routing.c | |
parent | 96412690116afcc1b2705615b5a7c8dc6c5e905f (diff) |
batman-adv: Prefix types structs with batadv_
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 144 |
1 files changed, 75 insertions, 69 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index e15790761105..b79e42e0c0b5 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -30,15 +30,15 @@ | |||
30 | #include "bridge_loop_avoidance.h" | 30 | #include "bridge_loop_avoidance.h" |
31 | 31 | ||
32 | static int batadv_route_unicast_packet(struct sk_buff *skb, | 32 | static int batadv_route_unicast_packet(struct sk_buff *skb, |
33 | struct hard_iface *recv_if); | 33 | struct batadv_hard_iface *recv_if); |
34 | 34 | ||
35 | void batadv_slide_own_bcast_window(struct hard_iface *hard_iface) | 35 | void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface) |
36 | { | 36 | { |
37 | struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); | 37 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); |
38 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 38 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
39 | struct hlist_node *node; | 39 | struct hlist_node *node; |
40 | struct hlist_head *head; | 40 | struct hlist_head *head; |
41 | struct orig_node *orig_node; | 41 | struct batadv_orig_node *orig_node; |
42 | unsigned long *word; | 42 | unsigned long *word; |
43 | uint32_t i; | 43 | uint32_t i; |
44 | size_t word_index; | 44 | size_t word_index; |
@@ -62,11 +62,11 @@ void batadv_slide_own_bcast_window(struct hard_iface *hard_iface) | |||
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | static void _batadv_update_route(struct bat_priv *bat_priv, | 65 | static void _batadv_update_route(struct batadv_priv *bat_priv, |
66 | struct orig_node *orig_node, | 66 | struct batadv_orig_node *orig_node, |
67 | struct neigh_node *neigh_node) | 67 | struct batadv_neigh_node *neigh_node) |
68 | { | 68 | { |
69 | struct neigh_node *curr_router; | 69 | struct batadv_neigh_node *curr_router; |
70 | 70 | ||
71 | curr_router = batadv_orig_node_get_router(orig_node); | 71 | curr_router = batadv_orig_node_get_router(orig_node); |
72 | 72 | ||
@@ -107,10 +107,11 @@ static void _batadv_update_route(struct bat_priv *bat_priv, | |||
107 | batadv_neigh_node_free_ref(curr_router); | 107 | batadv_neigh_node_free_ref(curr_router); |
108 | } | 108 | } |
109 | 109 | ||
110 | void batadv_update_route(struct bat_priv *bat_priv, struct orig_node *orig_node, | 110 | void batadv_update_route(struct batadv_priv *bat_priv, |
111 | struct neigh_node *neigh_node) | 111 | struct batadv_orig_node *orig_node, |
112 | struct batadv_neigh_node *neigh_node) | ||
112 | { | 113 | { |
113 | struct neigh_node *router = NULL; | 114 | struct batadv_neigh_node *router = NULL; |
114 | 115 | ||
115 | if (!orig_node) | 116 | if (!orig_node) |
116 | goto out; | 117 | goto out; |
@@ -126,8 +127,8 @@ out: | |||
126 | } | 127 | } |
127 | 128 | ||
128 | /* caller must hold the neigh_list_lock */ | 129 | /* caller must hold the neigh_list_lock */ |
129 | void batadv_bonding_candidate_del(struct orig_node *orig_node, | 130 | void batadv_bonding_candidate_del(struct batadv_orig_node *orig_node, |
130 | struct neigh_node *neigh_node) | 131 | struct batadv_neigh_node *neigh_node) |
131 | { | 132 | { |
132 | /* this neighbor is not part of our candidate list */ | 133 | /* this neighbor is not part of our candidate list */ |
133 | if (list_empty(&neigh_node->bonding_list)) | 134 | if (list_empty(&neigh_node->bonding_list)) |
@@ -142,11 +143,11 @@ out: | |||
142 | return; | 143 | return; |
143 | } | 144 | } |
144 | 145 | ||
145 | void batadv_bonding_candidate_add(struct orig_node *orig_node, | 146 | void batadv_bonding_candidate_add(struct batadv_orig_node *orig_node, |
146 | struct neigh_node *neigh_node) | 147 | struct batadv_neigh_node *neigh_node) |
147 | { | 148 | { |
148 | struct hlist_node *node; | 149 | struct hlist_node *node; |
149 | struct neigh_node *tmp_neigh_node, *router = NULL; | 150 | struct batadv_neigh_node *tmp_neigh_node, *router = NULL; |
150 | uint8_t interference_candidate = 0; | 151 | uint8_t interference_candidate = 0; |
151 | 152 | ||
152 | spin_lock_bh(&orig_node->neigh_list_lock); | 153 | spin_lock_bh(&orig_node->neigh_list_lock); |
@@ -215,8 +216,8 @@ out: | |||
215 | 216 | ||
216 | /* copy primary address for bonding */ | 217 | /* copy primary address for bonding */ |
217 | void | 218 | void |
218 | batadv_bonding_save_primary(const struct orig_node *orig_node, | 219 | batadv_bonding_save_primary(const struct batadv_orig_node *orig_node, |
219 | struct orig_node *orig_neigh_node, | 220 | struct batadv_orig_node *orig_neigh_node, |
220 | const struct batadv_ogm_packet *batman_ogm_packet) | 221 | const struct batadv_ogm_packet *batman_ogm_packet) |
221 | { | 222 | { |
222 | if (!(batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP)) | 223 | if (!(batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP)) |
@@ -230,7 +231,7 @@ batadv_bonding_save_primary(const struct orig_node *orig_node, | |||
230 | * 0 if the packet is to be accepted | 231 | * 0 if the packet is to be accepted |
231 | * 1 if the packet is to be ignored. | 232 | * 1 if the packet is to be ignored. |
232 | */ | 233 | */ |
233 | int batadv_window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, | 234 | int batadv_window_protected(struct batadv_priv *bat_priv, int32_t seq_num_diff, |
234 | unsigned long *last_reset) | 235 | unsigned long *last_reset) |
235 | { | 236 | { |
236 | if (seq_num_diff <= -BATADV_TQ_LOCAL_WINDOW_SIZE || | 237 | if (seq_num_diff <= -BATADV_TQ_LOCAL_WINDOW_SIZE || |
@@ -248,7 +249,7 @@ int batadv_window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, | |||
248 | } | 249 | } |
249 | 250 | ||
250 | bool batadv_check_management_packet(struct sk_buff *skb, | 251 | bool batadv_check_management_packet(struct sk_buff *skb, |
251 | struct hard_iface *hard_iface, | 252 | struct batadv_hard_iface *hard_iface, |
252 | int header_len) | 253 | int header_len) |
253 | { | 254 | { |
254 | struct ethhdr *ethhdr; | 255 | struct ethhdr *ethhdr; |
@@ -278,12 +279,12 @@ bool batadv_check_management_packet(struct sk_buff *skb, | |||
278 | return true; | 279 | return true; |
279 | } | 280 | } |
280 | 281 | ||
281 | static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv, | 282 | static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv, |
282 | struct sk_buff *skb, size_t icmp_len) | 283 | struct sk_buff *skb, size_t icmp_len) |
283 | { | 284 | { |
284 | struct hard_iface *primary_if = NULL; | 285 | struct batadv_hard_iface *primary_if = NULL; |
285 | struct orig_node *orig_node = NULL; | 286 | struct batadv_orig_node *orig_node = NULL; |
286 | struct neigh_node *router = NULL; | 287 | struct batadv_neigh_node *router = NULL; |
287 | struct batadv_icmp_packet_rr *icmp_packet; | 288 | struct batadv_icmp_packet_rr *icmp_packet; |
288 | int ret = NET_RX_DROP; | 289 | int ret = NET_RX_DROP; |
289 | 290 | ||
@@ -333,12 +334,12 @@ out: | |||
333 | return ret; | 334 | return ret; |
334 | } | 335 | } |
335 | 336 | ||
336 | static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, | 337 | static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv, |
337 | struct sk_buff *skb) | 338 | struct sk_buff *skb) |
338 | { | 339 | { |
339 | struct hard_iface *primary_if = NULL; | 340 | struct batadv_hard_iface *primary_if = NULL; |
340 | struct orig_node *orig_node = NULL; | 341 | struct batadv_orig_node *orig_node = NULL; |
341 | struct neigh_node *router = NULL; | 342 | struct batadv_neigh_node *router = NULL; |
342 | struct batadv_icmp_packet *icmp_packet; | 343 | struct batadv_icmp_packet *icmp_packet; |
343 | int ret = NET_RX_DROP; | 344 | int ret = NET_RX_DROP; |
344 | 345 | ||
@@ -389,13 +390,14 @@ out: | |||
389 | } | 390 | } |
390 | 391 | ||
391 | 392 | ||
392 | int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if) | 393 | int batadv_recv_icmp_packet(struct sk_buff *skb, |
394 | struct batadv_hard_iface *recv_if) | ||
393 | { | 395 | { |
394 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 396 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
395 | struct batadv_icmp_packet_rr *icmp_packet; | 397 | struct batadv_icmp_packet_rr *icmp_packet; |
396 | struct ethhdr *ethhdr; | 398 | struct ethhdr *ethhdr; |
397 | struct orig_node *orig_node = NULL; | 399 | struct batadv_orig_node *orig_node = NULL; |
398 | struct neigh_node *router = NULL; | 400 | struct batadv_neigh_node *router = NULL; |
399 | int hdr_size = sizeof(struct batadv_icmp_packet); | 401 | int hdr_size = sizeof(struct batadv_icmp_packet); |
400 | int ret = NET_RX_DROP; | 402 | int ret = NET_RX_DROP; |
401 | 403 | ||
@@ -475,12 +477,12 @@ out: | |||
475 | * This method rotates the bonding list and increases the | 477 | * This method rotates the bonding list and increases the |
476 | * returned router's refcount. | 478 | * returned router's refcount. |
477 | */ | 479 | */ |
478 | static struct neigh_node * | 480 | static struct batadv_neigh_node * |
479 | batadv_find_bond_router(struct orig_node *primary_orig, | 481 | batadv_find_bond_router(struct batadv_orig_node *primary_orig, |
480 | const struct hard_iface *recv_if) | 482 | const struct batadv_hard_iface *recv_if) |
481 | { | 483 | { |
482 | struct neigh_node *tmp_neigh_node; | 484 | struct batadv_neigh_node *tmp_neigh_node; |
483 | struct neigh_node *router = NULL, *first_candidate = NULL; | 485 | struct batadv_neigh_node *router = NULL, *first_candidate = NULL; |
484 | 486 | ||
485 | rcu_read_lock(); | 487 | rcu_read_lock(); |
486 | list_for_each_entry_rcu(tmp_neigh_node, &primary_orig->bond_list, | 488 | list_for_each_entry_rcu(tmp_neigh_node, &primary_orig->bond_list, |
@@ -530,12 +532,12 @@ out: | |||
530 | * | 532 | * |
531 | * Increases the returned router's refcount | 533 | * Increases the returned router's refcount |
532 | */ | 534 | */ |
533 | static struct neigh_node * | 535 | static struct batadv_neigh_node * |
534 | batadv_find_ifalter_router(struct orig_node *primary_orig, | 536 | batadv_find_ifalter_router(struct batadv_orig_node *primary_orig, |
535 | const struct hard_iface *recv_if) | 537 | const struct batadv_hard_iface *recv_if) |
536 | { | 538 | { |
537 | struct neigh_node *tmp_neigh_node; | 539 | struct batadv_neigh_node *tmp_neigh_node; |
538 | struct neigh_node *router = NULL, *first_candidate = NULL; | 540 | struct batadv_neigh_node *router = NULL, *first_candidate = NULL; |
539 | 541 | ||
540 | rcu_read_lock(); | 542 | rcu_read_lock(); |
541 | list_for_each_entry_rcu(tmp_neigh_node, &primary_orig->bond_list, | 543 | list_for_each_entry_rcu(tmp_neigh_node, &primary_orig->bond_list, |
@@ -577,9 +579,9 @@ batadv_find_ifalter_router(struct orig_node *primary_orig, | |||
577 | return router; | 579 | return router; |
578 | } | 580 | } |
579 | 581 | ||
580 | int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | 582 | int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) |
581 | { | 583 | { |
582 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 584 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
583 | struct batadv_tt_query_packet *tt_query; | 585 | struct batadv_tt_query_packet *tt_query; |
584 | uint16_t tt_size; | 586 | uint16_t tt_size; |
585 | struct ethhdr *ethhdr; | 587 | struct ethhdr *ethhdr; |
@@ -667,11 +669,11 @@ out: | |||
667 | return NET_RX_DROP; | 669 | return NET_RX_DROP; |
668 | } | 670 | } |
669 | 671 | ||
670 | int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if) | 672 | int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if) |
671 | { | 673 | { |
672 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 674 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
673 | struct batadv_roam_adv_packet *roam_adv_packet; | 675 | struct batadv_roam_adv_packet *roam_adv_packet; |
674 | struct orig_node *orig_node; | 676 | struct batadv_orig_node *orig_node; |
675 | struct ethhdr *ethhdr; | 677 | struct ethhdr *ethhdr; |
676 | 678 | ||
677 | /* drop packet if it has not necessary minimum size */ | 679 | /* drop packet if it has not necessary minimum size */ |
@@ -731,13 +733,14 @@ out: | |||
731 | * bonding if possible. increases the found neighbors | 733 | * bonding if possible. increases the found neighbors |
732 | * refcount. | 734 | * refcount. |
733 | */ | 735 | */ |
734 | struct neigh_node *batadv_find_router(struct bat_priv *bat_priv, | 736 | struct batadv_neigh_node * |
735 | struct orig_node *orig_node, | 737 | batadv_find_router(struct batadv_priv *bat_priv, |
736 | const struct hard_iface *recv_if) | 738 | struct batadv_orig_node *orig_node, |
739 | const struct batadv_hard_iface *recv_if) | ||
737 | { | 740 | { |
738 | struct orig_node *primary_orig_node; | 741 | struct batadv_orig_node *primary_orig_node; |
739 | struct orig_node *router_orig; | 742 | struct batadv_orig_node *router_orig; |
740 | struct neigh_node *router; | 743 | struct batadv_neigh_node *router; |
741 | static uint8_t zero_mac[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; | 744 | static uint8_t zero_mac[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; |
742 | int bonding_enabled; | 745 | int bonding_enabled; |
743 | uint8_t *primary_addr; | 746 | uint8_t *primary_addr; |
@@ -842,11 +845,11 @@ static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) | |||
842 | } | 845 | } |
843 | 846 | ||
844 | static int batadv_route_unicast_packet(struct sk_buff *skb, | 847 | static int batadv_route_unicast_packet(struct sk_buff *skb, |
845 | struct hard_iface *recv_if) | 848 | struct batadv_hard_iface *recv_if) |
846 | { | 849 | { |
847 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 850 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
848 | struct orig_node *orig_node = NULL; | 851 | struct batadv_orig_node *orig_node = NULL; |
849 | struct neigh_node *neigh_node = NULL; | 852 | struct batadv_neigh_node *neigh_node = NULL; |
850 | struct batadv_unicast_packet *unicast_packet; | 853 | struct batadv_unicast_packet *unicast_packet; |
851 | struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb); | 854 | struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb); |
852 | int ret = NET_RX_DROP; | 855 | int ret = NET_RX_DROP; |
@@ -927,12 +930,12 @@ out: | |||
927 | return ret; | 930 | return ret; |
928 | } | 931 | } |
929 | 932 | ||
930 | static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv, | 933 | static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, |
931 | struct sk_buff *skb) { | 934 | struct sk_buff *skb) { |
932 | uint8_t curr_ttvn; | 935 | uint8_t curr_ttvn; |
933 | struct orig_node *orig_node; | 936 | struct batadv_orig_node *orig_node; |
934 | struct ethhdr *ethhdr; | 937 | struct ethhdr *ethhdr; |
935 | struct hard_iface *primary_if; | 938 | struct batadv_hard_iface *primary_if; |
936 | struct batadv_unicast_packet *unicast_packet; | 939 | struct batadv_unicast_packet *unicast_packet; |
937 | bool tt_poss_change; | 940 | bool tt_poss_change; |
938 | int is_old_ttvn; | 941 | int is_old_ttvn; |
@@ -1006,9 +1009,10 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv, | |||
1006 | return 1; | 1009 | return 1; |
1007 | } | 1010 | } |
1008 | 1011 | ||
1009 | int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if) | 1012 | int batadv_recv_unicast_packet(struct sk_buff *skb, |
1013 | struct batadv_hard_iface *recv_if) | ||
1010 | { | 1014 | { |
1011 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 1015 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
1012 | struct batadv_unicast_packet *unicast_packet; | 1016 | struct batadv_unicast_packet *unicast_packet; |
1013 | int hdr_size = sizeof(*unicast_packet); | 1017 | int hdr_size = sizeof(*unicast_packet); |
1014 | 1018 | ||
@@ -1031,9 +1035,9 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if) | |||
1031 | } | 1035 | } |
1032 | 1036 | ||
1033 | int batadv_recv_ucast_frag_packet(struct sk_buff *skb, | 1037 | int batadv_recv_ucast_frag_packet(struct sk_buff *skb, |
1034 | struct hard_iface *recv_if) | 1038 | struct batadv_hard_iface *recv_if) |
1035 | { | 1039 | { |
1036 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 1040 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
1037 | struct batadv_unicast_frag_packet *unicast_packet; | 1041 | struct batadv_unicast_frag_packet *unicast_packet; |
1038 | int hdr_size = sizeof(*unicast_packet); | 1042 | int hdr_size = sizeof(*unicast_packet); |
1039 | struct sk_buff *new_skb = NULL; | 1043 | struct sk_buff *new_skb = NULL; |
@@ -1068,10 +1072,11 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb, | |||
1068 | } | 1072 | } |
1069 | 1073 | ||
1070 | 1074 | ||
1071 | int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if) | 1075 | int batadv_recv_bcast_packet(struct sk_buff *skb, |
1076 | struct batadv_hard_iface *recv_if) | ||
1072 | { | 1077 | { |
1073 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 1078 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
1074 | struct orig_node *orig_node = NULL; | 1079 | struct batadv_orig_node *orig_node = NULL; |
1075 | struct batadv_bcast_packet *bcast_packet; | 1080 | struct batadv_bcast_packet *bcast_packet; |
1076 | struct ethhdr *ethhdr; | 1081 | struct ethhdr *ethhdr; |
1077 | int hdr_size = sizeof(*bcast_packet); | 1082 | int hdr_size = sizeof(*bcast_packet); |
@@ -1158,11 +1163,12 @@ out: | |||
1158 | return ret; | 1163 | return ret; |
1159 | } | 1164 | } |
1160 | 1165 | ||
1161 | int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if) | 1166 | int batadv_recv_vis_packet(struct sk_buff *skb, |
1167 | struct batadv_hard_iface *recv_if) | ||
1162 | { | 1168 | { |
1163 | struct batadv_vis_packet *vis_packet; | 1169 | struct batadv_vis_packet *vis_packet; |
1164 | struct ethhdr *ethhdr; | 1170 | struct ethhdr *ethhdr; |
1165 | struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 1171 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
1166 | int hdr_size = sizeof(*vis_packet); | 1172 | int hdr_size = sizeof(*vis_packet); |
1167 | 1173 | ||
1168 | /* keep skb linear */ | 1174 | /* keep skb linear */ |