aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_iv_ogm.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-06-03 16:19:21 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-07-01 16:47:19 -0400
commitacd34afa89772f6379b642bb979d0a112328c769 (patch)
treedc72002fdefbd521253f651a53bbed762d3af899 /net/batman-adv/bat_iv_ogm.c
parentd69909d2fc9e00bd8149cc8df9b18c35008e3e62 (diff)
batman-adv: Prefix packet enum with BATADV_
Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/bat_iv_ogm.c')
-rw-r--r--net/batman-adv/bat_iv_ogm.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 60997192c899..58bbb20663d5 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -71,7 +71,7 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
71 goto out; 71 goto out;
72 72
73 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; 73 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
74 batman_ogm_packet->header.packet_type = BAT_IV_OGM; 74 batman_ogm_packet->header.packet_type = BATADV_IV_OGM;
75 batman_ogm_packet->header.version = BATADV_COMPAT_VERSION; 75 batman_ogm_packet->header.version = BATADV_COMPAT_VERSION;
76 batman_ogm_packet->header.ttl = 2; 76 batman_ogm_packet->header.ttl = 2;
77 batman_ogm_packet->flags = BATADV_NO_FLAGS; 77 batman_ogm_packet->flags = BATADV_NO_FLAGS;
@@ -107,7 +107,7 @@ static void batadv_iv_ogm_primary_iface_set(struct hard_iface *hard_iface)
107 struct batman_ogm_packet *batman_ogm_packet; 107 struct batman_ogm_packet *batman_ogm_packet;
108 108
109 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; 109 batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
110 batman_ogm_packet->flags = PRIMARIES_FIRST_HOP; 110 batman_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP;
111 batman_ogm_packet->header.ttl = BATADV_TTL; 111 batman_ogm_packet->header.ttl = BATADV_TTL;
112} 112}
113 113
@@ -181,9 +181,9 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
181 */ 181 */
182 if ((forw_packet->direct_link_flags & (1 << packet_num)) && 182 if ((forw_packet->direct_link_flags & (1 << packet_num)) &&
183 (forw_packet->if_incoming == hard_iface)) 183 (forw_packet->if_incoming == hard_iface))
184 batman_ogm_packet->flags |= DIRECTLINK; 184 batman_ogm_packet->flags |= BATADV_DIRECTLINK;
185 else 185 else
186 batman_ogm_packet->flags &= ~DIRECTLINK; 186 batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
187 187
188 fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ? 188 fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ?
189 "Sending own" : 189 "Sending own" :
@@ -194,7 +194,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
194 batman_ogm_packet->orig, 194 batman_ogm_packet->orig,
195 ntohl(batman_ogm_packet->seqno), 195 ntohl(batman_ogm_packet->seqno),
196 batman_ogm_packet->tq, batman_ogm_packet->header.ttl, 196 batman_ogm_packet->tq, batman_ogm_packet->header.ttl,
197 (batman_ogm_packet->flags & DIRECTLINK ? 197 (batman_ogm_packet->flags & BATADV_DIRECTLINK ?
198 "on" : "off"), 198 "on" : "off"),
199 batman_ogm_packet->ttvn, hard_iface->net_dev->name, 199 batman_ogm_packet->ttvn, hard_iface->net_dev->name,
200 hard_iface->net_dev->dev_addr); 200 hard_iface->net_dev->dev_addr);
@@ -228,7 +228,7 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
228 228
229 batman_ogm_packet = (struct batman_ogm_packet *) 229 batman_ogm_packet = (struct batman_ogm_packet *)
230 (forw_packet->skb->data); 230 (forw_packet->skb->data);
231 directlink = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); 231 directlink = (batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0);
232 232
233 if (!forw_packet->if_incoming) { 233 if (!forw_packet->if_incoming) {
234 pr_err("Error - can't forward packet: incoming iface not specified\n"); 234 pr_err("Error - can't forward packet: incoming iface not specified\n");
@@ -330,7 +330,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
330 * are flooded through the net 330 * are flooded through the net
331 */ 331 */
332 if ((!directlink) && 332 if ((!directlink) &&
333 (!(batman_ogm_packet->flags & DIRECTLINK)) && 333 (!(batman_ogm_packet->flags & BATADV_DIRECTLINK)) &&
334 (batman_ogm_packet->header.ttl != 1) && 334 (batman_ogm_packet->header.ttl != 1) &&
335 335
336 /* own packets originating non-primary 336 /* own packets originating non-primary
@@ -353,7 +353,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
353 * own secondary interface packets 353 * own secondary interface packets
354 * (= secondary interface packets in general) 354 * (= secondary interface packets in general)
355 */ 355 */
356 (batman_ogm_packet->flags & DIRECTLINK || 356 (batman_ogm_packet->flags & BATADV_DIRECTLINK ||
357 (forw_packet->own && 357 (forw_packet->own &&
358 forw_packet->if_incoming != primary_if))) { 358 forw_packet->if_incoming != primary_if))) {
359 res = true; 359 res = true;
@@ -480,7 +480,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
480 unsigned long max_aggregation_jiffies; 480 unsigned long max_aggregation_jiffies;
481 481
482 batman_ogm_packet = (struct batman_ogm_packet *)packet_buff; 482 batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
483 direct_link = batman_ogm_packet->flags & DIRECTLINK ? 1 : 0; 483 direct_link = batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0;
484 max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS); 484 max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
485 485
486 /* find position for the packet in the forward queue */ 486 /* find position for the packet in the forward queue */
@@ -547,7 +547,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
547 * simply drop the ogm. 547 * simply drop the ogm.
548 */ 548 */
549 if (is_single_hop_neigh) 549 if (is_single_hop_neigh)
550 batman_ogm_packet->flags |= NOT_BEST_NEXT_HOP; 550 batman_ogm_packet->flags |= BATADV_NOT_BEST_NEXT_HOP;
551 else 551 else
552 return; 552 return;
553 } 553 }
@@ -566,11 +566,11 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
566 batman_ogm_packet->tq, batman_ogm_packet->header.ttl); 566 batman_ogm_packet->tq, batman_ogm_packet->header.ttl);
567 567
568 /* switch of primaries first hop flag when forwarding */ 568 /* switch of primaries first hop flag when forwarding */
569 batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP; 569 batman_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP;
570 if (is_single_hop_neigh) 570 if (is_single_hop_neigh)
571 batman_ogm_packet->flags |= DIRECTLINK; 571 batman_ogm_packet->flags |= BATADV_DIRECTLINK;
572 else 572 else
573 batman_ogm_packet->flags &= ~DIRECTLINK; 573 batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
574 574
575 batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet, 575 batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet,
576 BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes), 576 BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes),
@@ -605,10 +605,10 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
605 if (tt_num_changes >= 0) 605 if (tt_num_changes >= 0)
606 batman_ogm_packet->tt_num_changes = tt_num_changes; 606 batman_ogm_packet->tt_num_changes = tt_num_changes;
607 607
608 if (vis_server == VIS_TYPE_SERVER_SYNC) 608 if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC)
609 batman_ogm_packet->flags |= VIS_SERVER; 609 batman_ogm_packet->flags |= BATADV_VIS_SERVER;
610 else 610 else
611 batman_ogm_packet->flags &= ~VIS_SERVER; 611 batman_ogm_packet->flags &= ~BATADV_VIS_SERVER;
612 612
613 if ((hard_iface == primary_if) && 613 if ((hard_iface == primary_if) &&
614 (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER)) 614 (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER))
@@ -746,7 +746,7 @@ update_tt:
746 */ 746 */
747 if (((batman_ogm_packet->orig != ethhdr->h_source) && 747 if (((batman_ogm_packet->orig != ethhdr->h_source) &&
748 (batman_ogm_packet->header.ttl > 2)) || 748 (batman_ogm_packet->header.ttl > 2)) ||
749 (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) 749 (batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
750 batadv_tt_update_orig(bat_priv, orig_node, tt_buff, 750 batadv_tt_update_orig(bat_priv, orig_node, tt_buff,
751 batman_ogm_packet->tt_num_changes, 751 batman_ogm_packet->tt_num_changes,
752 batman_ogm_packet->ttvn, 752 batman_ogm_packet->ttvn,
@@ -993,13 +993,16 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
993 * packet in an aggregation. Here we expect that the padding 993 * packet in an aggregation. Here we expect that the padding
994 * is always zero (or not 0x01) 994 * is always zero (or not 0x01)
995 */ 995 */
996 if (batman_ogm_packet->header.packet_type != BAT_IV_OGM) 996 if (batman_ogm_packet->header.packet_type != BATADV_IV_OGM)
997 return; 997 return;
998 998
999 /* could be changed by schedule_own_packet() */ 999 /* could be changed by schedule_own_packet() */
1000 if_incoming_seqno = atomic_read(&if_incoming->seqno); 1000 if_incoming_seqno = atomic_read(&if_incoming->seqno);
1001 1001
1002 has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); 1002 if (batman_ogm_packet->flags & BATADV_DIRECTLINK)
1003 has_directlink_flag = 1;
1004 else
1005 has_directlink_flag = 0;
1003 1006
1004 if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig)) 1007 if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig))
1005 is_single_hop_neigh = true; 1008 is_single_hop_neigh = true;
@@ -1107,7 +1110,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
1107 return; 1110 return;
1108 } 1111 }
1109 1112
1110 if (batman_ogm_packet->flags & NOT_BEST_NEXT_HOP) { 1113 if (batman_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) {
1111 batadv_dbg(DBG_BATMAN, bat_priv, 1114 batadv_dbg(DBG_BATMAN, bat_priv,
1112 "Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n", 1115 "Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n",
1113 ethhdr->h_source); 1116 ethhdr->h_source);
@@ -1299,7 +1302,8 @@ int __init batadv_iv_init(void)
1299 int ret; 1302 int ret;
1300 1303
1301 /* batman originator packet */ 1304 /* batman originator packet */
1302 ret = batadv_recv_handler_register(BAT_IV_OGM, batadv_iv_ogm_receive); 1305 ret = batadv_recv_handler_register(BATADV_IV_OGM,
1306 batadv_iv_ogm_receive);
1303 if (ret < 0) 1307 if (ret < 0)
1304 goto out; 1308 goto out;
1305 1309
@@ -1310,7 +1314,7 @@ int __init batadv_iv_init(void)
1310 goto out; 1314 goto out;
1311 1315
1312handler_unregister: 1316handler_unregister:
1313 batadv_recv_handler_unregister(BAT_IV_OGM); 1317 batadv_recv_handler_unregister(BATADV_IV_OGM);
1314out: 1318out:
1315 return ret; 1319 return ret;
1316} 1320}