aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2011-05-14 17:14:50 -0400
committerSven Eckelmann <sven@narfation.org>2011-05-30 01:39:31 -0400
commit747e4221a03cde62402b614ca1f8e961b8416130 (patch)
tree98428064fef191a5093e276d5a779b9e801a97f0 /net/batman-adv/routing.c
parent38e3c5f0dae7a3bbb32c3b2bb28c3f2557d40fe9 (diff)
batman-adv: Add const type qualifier for pointers
batman-adv uses pointers which are marked as const and should not violate that type qualifier by passing it to functions which force a cast to the non-const version. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 8c403ce785d0..e0df4a007eac 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -65,7 +65,7 @@ void slide_own_bcast_window(struct hard_iface *hard_iface)
65} 65}
66 66
67static void update_TT(struct bat_priv *bat_priv, struct orig_node *orig_node, 67static void update_TT(struct bat_priv *bat_priv, struct orig_node *orig_node,
68 unsigned char *tt_buff, int tt_buff_len) 68 const unsigned char *tt_buff, int tt_buff_len)
69{ 69{
70 if ((tt_buff_len != orig_node->tt_buff_len) || 70 if ((tt_buff_len != orig_node->tt_buff_len) ||
71 ((tt_buff_len > 0) && 71 ((tt_buff_len > 0) &&
@@ -82,10 +82,9 @@ static void update_TT(struct bat_priv *bat_priv, struct orig_node *orig_node,
82 } 82 }
83} 83}
84 84
85static void update_route(struct bat_priv *bat_priv, 85static void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
86 struct orig_node *orig_node,
87 struct neigh_node *neigh_node, 86 struct neigh_node *neigh_node,
88 unsigned char *tt_buff, int tt_buff_len) 87 const unsigned char *tt_buff, int tt_buff_len)
89{ 88{
90 struct neigh_node *curr_router; 89 struct neigh_node *curr_router;
91 90
@@ -133,9 +132,8 @@ static void update_route(struct bat_priv *bat_priv,
133 neigh_node_free_ref(curr_router); 132 neigh_node_free_ref(curr_router);
134} 133}
135 134
136
137void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node, 135void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node,
138 struct neigh_node *neigh_node, unsigned char *tt_buff, 136 struct neigh_node *neigh_node, const unsigned char *tt_buff,
139 int tt_buff_len) 137 int tt_buff_len)
140{ 138{
141 struct neigh_node *router = NULL; 139 struct neigh_node *router = NULL;
@@ -348,9 +346,9 @@ out:
348} 346}
349 347
350/* copy primary address for bonding */ 348/* copy primary address for bonding */
351static void bonding_save_primary(struct orig_node *orig_node, 349static void bonding_save_primary(const struct orig_node *orig_node,
352 struct orig_node *orig_neigh_node, 350 struct orig_node *orig_neigh_node,
353 struct batman_packet *batman_packet) 351 const struct batman_packet *batman_packet)
354{ 352{
355 if (!(batman_packet->flags & PRIMARIES_FIRST_HOP)) 353 if (!(batman_packet->flags & PRIMARIES_FIRST_HOP))
356 return; 354 return;
@@ -358,12 +356,11 @@ static void bonding_save_primary(struct orig_node *orig_node,
358 memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN); 356 memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN);
359} 357}
360 358
361static void update_orig(struct bat_priv *bat_priv, 359static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
362 struct orig_node *orig_node, 360 const struct ethhdr *ethhdr,
363 struct ethhdr *ethhdr, 361 const struct batman_packet *batman_packet,
364 struct batman_packet *batman_packet,
365 struct hard_iface *if_incoming, 362 struct hard_iface *if_incoming,
366 unsigned char *tt_buff, int tt_buff_len, 363 const unsigned char *tt_buff, int tt_buff_len,
367 char is_duplicate) 364 char is_duplicate)
368{ 365{
369 struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; 366 struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
@@ -531,9 +528,9 @@ static int window_protected(struct bat_priv *bat_priv,
531 * -1 the packet is old and has been received while the seqno window 528 * -1 the packet is old and has been received while the seqno window
532 * was protected. Caller should drop it. 529 * was protected. Caller should drop it.
533 */ 530 */
534static char count_real_packets(struct ethhdr *ethhdr, 531static char count_real_packets(const struct ethhdr *ethhdr,
535 struct batman_packet *batman_packet, 532 const struct batman_packet *batman_packet,
536 struct hard_iface *if_incoming) 533 const struct hard_iface *if_incoming)
537{ 534{
538 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 535 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
539 struct orig_node *orig_node; 536 struct orig_node *orig_node;
@@ -595,9 +592,9 @@ out:
595 return ret; 592 return ret;
596} 593}
597 594
598void receive_bat_packet(struct ethhdr *ethhdr, 595void receive_bat_packet(const struct ethhdr *ethhdr,
599 struct batman_packet *batman_packet, 596 struct batman_packet *batman_packet,
600 unsigned char *tt_buff, int tt_buff_len, 597 const unsigned char *tt_buff, int tt_buff_len,
601 struct hard_iface *if_incoming) 598 struct hard_iface *if_incoming)
602{ 599{
603 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); 600 struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -1077,7 +1074,7 @@ out:
1077 * This method rotates the bonding list and increases the 1074 * This method rotates the bonding list and increases the
1078 * returned router's refcount. */ 1075 * returned router's refcount. */
1079static struct neigh_node *find_bond_router(struct orig_node *primary_orig, 1076static struct neigh_node *find_bond_router(struct orig_node *primary_orig,
1080 struct hard_iface *recv_if) 1077 const struct hard_iface *recv_if)
1081{ 1078{
1082 struct neigh_node *tmp_neigh_node; 1079 struct neigh_node *tmp_neigh_node;
1083 struct neigh_node *router = NULL, *first_candidate = NULL; 1080 struct neigh_node *router = NULL, *first_candidate = NULL;
@@ -1128,7 +1125,7 @@ out:
1128 * 1125 *
1129 * Increases the returned router's refcount */ 1126 * Increases the returned router's refcount */
1130static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig, 1127static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig,
1131 struct hard_iface *recv_if) 1128 const struct hard_iface *recv_if)
1132{ 1129{
1133 struct neigh_node *tmp_neigh_node; 1130 struct neigh_node *tmp_neigh_node;
1134 struct neigh_node *router = NULL, *first_candidate = NULL; 1131 struct neigh_node *router = NULL, *first_candidate = NULL;
@@ -1176,7 +1173,7 @@ static struct neigh_node *find_ifalter_router(struct orig_node *primary_orig,
1176 * refcount.*/ 1173 * refcount.*/
1177struct neigh_node *find_router(struct bat_priv *bat_priv, 1174struct neigh_node *find_router(struct bat_priv *bat_priv,
1178 struct orig_node *orig_node, 1175 struct orig_node *orig_node,
1179 struct hard_iface *recv_if) 1176 const struct hard_iface *recv_if)
1180{ 1177{
1181 struct orig_node *primary_orig_node; 1178 struct orig_node *primary_orig_node;
1182 struct orig_node *router_orig; 1179 struct orig_node *router_orig;