diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-06-03 16:19:21 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-07-01 16:47:19 -0400 |
commit | acd34afa89772f6379b642bb979d0a112328c769 (patch) | |
tree | dc72002fdefbd521253f651a53bbed762d3af899 /net/batman-adv | |
parent | d69909d2fc9e00bd8149cc8df9b18c35008e3e62 (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')
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 48 | ||||
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 24 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 34 | ||||
-rw-r--r-- | net/batman-adv/icmp_socket.c | 8 | ||||
-rw-r--r-- | net/batman-adv/main.c | 14 | ||||
-rw-r--r-- | net/batman-adv/packet.h | 88 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 35 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 4 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 191 | ||||
-rw-r--r-- | net/batman-adv/unicast.c | 18 | ||||
-rw-r--r-- | net/batman-adv/unicast.h | 4 | ||||
-rw-r--r-- | net/batman-adv/vis.c | 18 |
12 files changed, 254 insertions, 232 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 | ||
1312 | handler_unregister: | 1316 | handler_unregister: |
1313 | batadv_recv_handler_unregister(BAT_IV_OGM); | 1317 | batadv_recv_handler_unregister(BATADV_IV_OGM); |
1314 | out: | 1318 | out: |
1315 | return ret; | 1319 | return ret; |
1316 | } | 1320 | } |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 680caca697e2..e27bfe3dd278 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -283,10 +283,14 @@ static ssize_t batadv_show_vis_mode(struct kobject *kobj, | |||
283 | { | 283 | { |
284 | struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj); | 284 | struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj); |
285 | int vis_mode = atomic_read(&bat_priv->vis_mode); | 285 | int vis_mode = atomic_read(&bat_priv->vis_mode); |
286 | const char *mode; | ||
286 | 287 | ||
287 | return sprintf(buff, "%s\n", | 288 | if (vis_mode == BATADV_VIS_TYPE_CLIENT_UPDATE) |
288 | vis_mode == VIS_TYPE_CLIENT_UPDATE ? | 289 | mode = "client"; |
289 | "client" : "server"); | 290 | else |
291 | mode = "server"; | ||
292 | |||
293 | return sprintf(buff, "%s\n", mode); | ||
290 | } | 294 | } |
291 | 295 | ||
292 | static ssize_t batadv_store_vis_mode(struct kobject *kobj, | 296 | static ssize_t batadv_store_vis_mode(struct kobject *kobj, |
@@ -301,14 +305,16 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, | |||
301 | 305 | ||
302 | ret = kstrtoul(buff, 10, &val); | 306 | ret = kstrtoul(buff, 10, &val); |
303 | 307 | ||
304 | if (((count == 2) && (!ret) && (val == VIS_TYPE_CLIENT_UPDATE)) || | 308 | if (((count == 2) && (!ret) && |
309 | (val == BATADV_VIS_TYPE_CLIENT_UPDATE)) || | ||
305 | (strncmp(buff, "client", 6) == 0) || | 310 | (strncmp(buff, "client", 6) == 0) || |
306 | (strncmp(buff, "off", 3) == 0)) | 311 | (strncmp(buff, "off", 3) == 0)) |
307 | vis_mode_tmp = VIS_TYPE_CLIENT_UPDATE; | 312 | vis_mode_tmp = BATADV_VIS_TYPE_CLIENT_UPDATE; |
308 | 313 | ||
309 | if (((count == 2) && (!ret) && (val == VIS_TYPE_SERVER_SYNC)) || | 314 | if (((count == 2) && (!ret) && |
315 | (val == BATADV_VIS_TYPE_SERVER_SYNC)) || | ||
310 | (strncmp(buff, "server", 6) == 0)) | 316 | (strncmp(buff, "server", 6) == 0)) |
311 | vis_mode_tmp = VIS_TYPE_SERVER_SYNC; | 317 | vis_mode_tmp = BATADV_VIS_TYPE_SERVER_SYNC; |
312 | 318 | ||
313 | if (vis_mode_tmp < 0) { | 319 | if (vis_mode_tmp < 0) { |
314 | if (buff[count - 1] == '\n') | 320 | if (buff[count - 1] == '\n') |
@@ -323,12 +329,12 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, | |||
323 | if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp) | 329 | if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp) |
324 | return count; | 330 | return count; |
325 | 331 | ||
326 | if (atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE) | 332 | if (atomic_read(&bat_priv->vis_mode) == BATADV_VIS_TYPE_CLIENT_UPDATE) |
327 | old_mode = "client"; | 333 | old_mode = "client"; |
328 | else | 334 | else |
329 | old_mode = "server"; | 335 | old_mode = "server"; |
330 | 336 | ||
331 | if (vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE) | 337 | if (vis_mode_tmp == BATADV_VIS_TYPE_CLIENT_UPDATE) |
332 | new_mode = "client"; | 338 | new_mode = "client"; |
333 | else | 339 | else |
334 | new_mode = "server"; | 340 | new_mode = "server"; |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 13afc6527521..c37513100f53 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -292,7 +292,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
292 | 292 | ||
293 | /* now we pretend that the client would have sent this ... */ | 293 | /* now we pretend that the client would have sent this ... */ |
294 | switch (claimtype) { | 294 | switch (claimtype) { |
295 | case CLAIM_TYPE_ADD: | 295 | case BATADV_CLAIM_TYPE_ADD: |
296 | /* normal claim frame | 296 | /* normal claim frame |
297 | * set Ethernet SRC to the clients mac | 297 | * set Ethernet SRC to the clients mac |
298 | */ | 298 | */ |
@@ -300,7 +300,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
300 | batadv_dbg(DBG_BLA, bat_priv, | 300 | batadv_dbg(DBG_BLA, bat_priv, |
301 | "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid); | 301 | "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid); |
302 | break; | 302 | break; |
303 | case CLAIM_TYPE_DEL: | 303 | case BATADV_CLAIM_TYPE_DEL: |
304 | /* unclaim frame | 304 | /* unclaim frame |
305 | * set HW SRC to the clients mac | 305 | * set HW SRC to the clients mac |
306 | */ | 306 | */ |
@@ -309,7 +309,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
309 | "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, | 309 | "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, |
310 | vid); | 310 | vid); |
311 | break; | 311 | break; |
312 | case CLAIM_TYPE_ANNOUNCE: | 312 | case BATADV_CLAIM_TYPE_ANNOUNCE: |
313 | /* announcement frame | 313 | /* announcement frame |
314 | * set HW SRC to the special mac containg the crc | 314 | * set HW SRC to the special mac containg the crc |
315 | */ | 315 | */ |
@@ -318,7 +318,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
318 | "bla_send_claim(): ANNOUNCE of %pM on vid %d\n", | 318 | "bla_send_claim(): ANNOUNCE of %pM on vid %d\n", |
319 | ethhdr->h_source, vid); | 319 | ethhdr->h_source, vid); |
320 | break; | 320 | break; |
321 | case CLAIM_TYPE_REQUEST: | 321 | case BATADV_CLAIM_TYPE_REQUEST: |
322 | /* request frame | 322 | /* request frame |
323 | * set HW SRC to the special mac containg the crc | 323 | * set HW SRC to the special mac containg the crc |
324 | */ | 324 | */ |
@@ -459,7 +459,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv, | |||
459 | continue; | 459 | continue; |
460 | 460 | ||
461 | batadv_bla_send_claim(bat_priv, claim->addr, claim->vid, | 461 | batadv_bla_send_claim(bat_priv, claim->addr, claim->vid, |
462 | CLAIM_TYPE_ADD); | 462 | BATADV_CLAIM_TYPE_ADD); |
463 | } | 463 | } |
464 | rcu_read_unlock(); | 464 | rcu_read_unlock(); |
465 | } | 465 | } |
@@ -485,7 +485,7 @@ static void batadv_bla_send_request(struct backbone_gw *backbone_gw) | |||
485 | 485 | ||
486 | /* send request */ | 486 | /* send request */ |
487 | batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, | 487 | batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, |
488 | backbone_gw->vid, CLAIM_TYPE_REQUEST); | 488 | backbone_gw->vid, BATADV_CLAIM_TYPE_REQUEST); |
489 | 489 | ||
490 | /* no local broadcasts should be sent or received, for now. */ | 490 | /* no local broadcasts should be sent or received, for now. */ |
491 | if (!atomic_read(&backbone_gw->request_sent)) { | 491 | if (!atomic_read(&backbone_gw->request_sent)) { |
@@ -511,7 +511,7 @@ static void batadv_bla_send_announce(struct bat_priv *bat_priv, | |||
511 | memcpy(&mac[4], &crc, 2); | 511 | memcpy(&mac[4], &crc, 2); |
512 | 512 | ||
513 | batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid, | 513 | batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid, |
514 | CLAIM_TYPE_ANNOUNCE); | 514 | BATADV_CLAIM_TYPE_ANNOUNCE); |
515 | 515 | ||
516 | } | 516 | } |
517 | 517 | ||
@@ -694,7 +694,7 @@ static int batadv_handle_unclaim(struct bat_priv *bat_priv, | |||
694 | if (primary_if && batadv_compare_eth(backbone_addr, | 694 | if (primary_if && batadv_compare_eth(backbone_addr, |
695 | primary_if->net_dev->dev_addr)) | 695 | primary_if->net_dev->dev_addr)) |
696 | batadv_bla_send_claim(bat_priv, claim_addr, vid, | 696 | batadv_bla_send_claim(bat_priv, claim_addr, vid, |
697 | CLAIM_TYPE_DEL); | 697 | BATADV_CLAIM_TYPE_DEL); |
698 | 698 | ||
699 | backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid); | 699 | backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid); |
700 | 700 | ||
@@ -730,7 +730,7 @@ static int batadv_handle_claim(struct bat_priv *bat_priv, | |||
730 | batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); | 730 | batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); |
731 | if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) | 731 | if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) |
732 | batadv_bla_send_claim(bat_priv, claim_addr, vid, | 732 | batadv_bla_send_claim(bat_priv, claim_addr, vid, |
733 | CLAIM_TYPE_ADD); | 733 | BATADV_CLAIM_TYPE_ADD); |
734 | 734 | ||
735 | /* TODO: we could call something like tt_local_del() here. */ | 735 | /* TODO: we could call something like tt_local_del() here. */ |
736 | 736 | ||
@@ -773,12 +773,12 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv, | |||
773 | * otherwise assume it is in the hw_src | 773 | * otherwise assume it is in the hw_src |
774 | */ | 774 | */ |
775 | switch (bla_dst->type) { | 775 | switch (bla_dst->type) { |
776 | case CLAIM_TYPE_ADD: | 776 | case BATADV_CLAIM_TYPE_ADD: |
777 | backbone_addr = hw_src; | 777 | backbone_addr = hw_src; |
778 | break; | 778 | break; |
779 | case CLAIM_TYPE_REQUEST: | 779 | case BATADV_CLAIM_TYPE_REQUEST: |
780 | case CLAIM_TYPE_ANNOUNCE: | 780 | case BATADV_CLAIM_TYPE_ANNOUNCE: |
781 | case CLAIM_TYPE_DEL: | 781 | case BATADV_CLAIM_TYPE_DEL: |
782 | backbone_addr = ethhdr->h_source; | 782 | backbone_addr = ethhdr->h_source; |
783 | break; | 783 | break; |
784 | default: | 784 | default: |
@@ -894,23 +894,23 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv, | |||
894 | 894 | ||
895 | /* check for the different types of claim frames ... */ | 895 | /* check for the different types of claim frames ... */ |
896 | switch (bla_dst->type) { | 896 | switch (bla_dst->type) { |
897 | case CLAIM_TYPE_ADD: | 897 | case BATADV_CLAIM_TYPE_ADD: |
898 | if (batadv_handle_claim(bat_priv, primary_if, hw_src, | 898 | if (batadv_handle_claim(bat_priv, primary_if, hw_src, |
899 | ethhdr->h_source, vid)) | 899 | ethhdr->h_source, vid)) |
900 | return 1; | 900 | return 1; |
901 | break; | 901 | break; |
902 | case CLAIM_TYPE_DEL: | 902 | case BATADV_CLAIM_TYPE_DEL: |
903 | if (batadv_handle_unclaim(bat_priv, primary_if, | 903 | if (batadv_handle_unclaim(bat_priv, primary_if, |
904 | ethhdr->h_source, hw_src, vid)) | 904 | ethhdr->h_source, hw_src, vid)) |
905 | return 1; | 905 | return 1; |
906 | break; | 906 | break; |
907 | 907 | ||
908 | case CLAIM_TYPE_ANNOUNCE: | 908 | case BATADV_CLAIM_TYPE_ANNOUNCE: |
909 | if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source, | 909 | if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source, |
910 | vid)) | 910 | vid)) |
911 | return 1; | 911 | return 1; |
912 | break; | 912 | break; |
913 | case CLAIM_TYPE_REQUEST: | 913 | case BATADV_CLAIM_TYPE_REQUEST: |
914 | if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr, | 914 | if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr, |
915 | vid)) | 915 | vid)) |
916 | return 1; | 916 | return 1; |
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index f5373a2a4d0b..a64cce2c4808 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -187,14 +187,14 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, | |||
187 | goto free_skb; | 187 | goto free_skb; |
188 | } | 188 | } |
189 | 189 | ||
190 | if (icmp_packet->header.packet_type != BAT_ICMP) { | 190 | if (icmp_packet->header.packet_type != BATADV_ICMP) { |
191 | batadv_dbg(DBG_BATMAN, bat_priv, | 191 | batadv_dbg(DBG_BATMAN, bat_priv, |
192 | "Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n"); | 192 | "Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n"); |
193 | len = -EINVAL; | 193 | len = -EINVAL; |
194 | goto free_skb; | 194 | goto free_skb; |
195 | } | 195 | } |
196 | 196 | ||
197 | if (icmp_packet->msg_type != ECHO_REQUEST) { | 197 | if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) { |
198 | batadv_dbg(DBG_BATMAN, bat_priv, | 198 | batadv_dbg(DBG_BATMAN, bat_priv, |
199 | "Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n"); | 199 | "Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n"); |
200 | len = -EINVAL; | 200 | len = -EINVAL; |
@@ -204,7 +204,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, | |||
204 | icmp_packet->uid = socket_client->index; | 204 | icmp_packet->uid = socket_client->index; |
205 | 205 | ||
206 | if (icmp_packet->header.version != BATADV_COMPAT_VERSION) { | 206 | if (icmp_packet->header.version != BATADV_COMPAT_VERSION) { |
207 | icmp_packet->msg_type = PARAMETER_PROBLEM; | 207 | icmp_packet->msg_type = BATADV_PARAMETER_PROBLEM; |
208 | icmp_packet->header.version = BATADV_COMPAT_VERSION; | 208 | icmp_packet->header.version = BATADV_COMPAT_VERSION; |
209 | batadv_socket_add_packet(socket_client, icmp_packet, | 209 | batadv_socket_add_packet(socket_client, icmp_packet, |
210 | packet_len); | 210 | packet_len); |
@@ -239,7 +239,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, | |||
239 | goto out; | 239 | goto out; |
240 | 240 | ||
241 | dst_unreach: | 241 | dst_unreach: |
242 | icmp_packet->msg_type = DESTINATION_UNREACHABLE; | 242 | icmp_packet->msg_type = BATADV_DESTINATION_UNREACHABLE; |
243 | batadv_socket_add_packet(socket_client, icmp_packet, packet_len); | 243 | batadv_socket_add_packet(socket_client, icmp_packet, packet_len); |
244 | free_skb: | 244 | free_skb: |
245 | kfree_skb(skb); | 245 | kfree_skb(skb); |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 23f5c8e4b675..b3f0a2e5e2ef 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -275,19 +275,19 @@ static void batadv_recv_handler_init(void) | |||
275 | batadv_rx_handler[i] = batadv_recv_unhandled_packet; | 275 | batadv_rx_handler[i] = batadv_recv_unhandled_packet; |
276 | 276 | ||
277 | /* batman icmp packet */ | 277 | /* batman icmp packet */ |
278 | batadv_rx_handler[BAT_ICMP] = batadv_recv_icmp_packet; | 278 | batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet; |
279 | /* unicast packet */ | 279 | /* unicast packet */ |
280 | batadv_rx_handler[BAT_UNICAST] = batadv_recv_unicast_packet; | 280 | batadv_rx_handler[BATADV_UNICAST] = batadv_recv_unicast_packet; |
281 | /* fragmented unicast packet */ | 281 | /* fragmented unicast packet */ |
282 | batadv_rx_handler[BAT_UNICAST_FRAG] = batadv_recv_ucast_frag_packet; | 282 | batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_ucast_frag_packet; |
283 | /* broadcast packet */ | 283 | /* broadcast packet */ |
284 | batadv_rx_handler[BAT_BCAST] = batadv_recv_bcast_packet; | 284 | batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet; |
285 | /* vis packet */ | 285 | /* vis packet */ |
286 | batadv_rx_handler[BAT_VIS] = batadv_recv_vis_packet; | 286 | batadv_rx_handler[BATADV_VIS] = batadv_recv_vis_packet; |
287 | /* Translation table query (request or response) */ | 287 | /* Translation table query (request or response) */ |
288 | batadv_rx_handler[BAT_TT_QUERY] = batadv_recv_tt_query; | 288 | batadv_rx_handler[BATADV_TT_QUERY] = batadv_recv_tt_query; |
289 | /* Roaming advertisement */ | 289 | /* Roaming advertisement */ |
290 | batadv_rx_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv; | 290 | batadv_rx_handler[BATADV_ROAM_ADV] = batadv_recv_roam_adv; |
291 | } | 291 | } |
292 | 292 | ||
293 | int batadv_recv_handler_register(uint8_t packet_type, | 293 | int batadv_recv_handler_register(uint8_t packet_type, |
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index e562414c2940..59e328a22fb9 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h | |||
@@ -22,80 +22,80 @@ | |||
22 | 22 | ||
23 | #define BATADV_ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ | 23 | #define BATADV_ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ |
24 | 24 | ||
25 | enum bat_packettype { | 25 | enum batadv_packettype { |
26 | BAT_IV_OGM = 0x01, | 26 | BATADV_IV_OGM = 0x01, |
27 | BAT_ICMP = 0x02, | 27 | BATADV_ICMP = 0x02, |
28 | BAT_UNICAST = 0x03, | 28 | BATADV_UNICAST = 0x03, |
29 | BAT_BCAST = 0x04, | 29 | BATADV_BCAST = 0x04, |
30 | BAT_VIS = 0x05, | 30 | BATADV_VIS = 0x05, |
31 | BAT_UNICAST_FRAG = 0x06, | 31 | BATADV_UNICAST_FRAG = 0x06, |
32 | BAT_TT_QUERY = 0x07, | 32 | BATADV_TT_QUERY = 0x07, |
33 | BAT_ROAM_ADV = 0x08 | 33 | BATADV_ROAM_ADV = 0x08, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | /* this file is included by batctl which needs these defines */ | 36 | /* this file is included by batctl which needs these defines */ |
37 | #define BATADV_COMPAT_VERSION 14 | 37 | #define BATADV_COMPAT_VERSION 14 |
38 | 38 | ||
39 | enum batman_iv_flags { | 39 | enum batadv_iv_flags { |
40 | NOT_BEST_NEXT_HOP = 1 << 3, | 40 | BATADV_NOT_BEST_NEXT_HOP = 1 << 3, |
41 | PRIMARIES_FIRST_HOP = 1 << 4, | 41 | BATADV_PRIMARIES_FIRST_HOP = 1 << 4, |
42 | VIS_SERVER = 1 << 5, | 42 | BATADV_VIS_SERVER = 1 << 5, |
43 | DIRECTLINK = 1 << 6 | 43 | BATADV_DIRECTLINK = 1 << 6, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /* ICMP message types */ | 46 | /* ICMP message types */ |
47 | enum icmp_packettype { | 47 | enum batadv_icmp_packettype { |
48 | ECHO_REPLY = 0, | 48 | BATADV_ECHO_REPLY = 0, |
49 | DESTINATION_UNREACHABLE = 3, | 49 | BATADV_DESTINATION_UNREACHABLE = 3, |
50 | ECHO_REQUEST = 8, | 50 | BATADV_ECHO_REQUEST = 8, |
51 | TTL_EXCEEDED = 11, | 51 | BATADV_TTL_EXCEEDED = 11, |
52 | PARAMETER_PROBLEM = 12 | 52 | BATADV_PARAMETER_PROBLEM = 12, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | /* vis defines */ | 55 | /* vis defines */ |
56 | enum vis_packettype { | 56 | enum batadv_vis_packettype { |
57 | VIS_TYPE_SERVER_SYNC = 0, | 57 | BATADV_VIS_TYPE_SERVER_SYNC = 0, |
58 | VIS_TYPE_CLIENT_UPDATE = 1 | 58 | BATADV_VIS_TYPE_CLIENT_UPDATE = 1, |
59 | }; | 59 | }; |
60 | 60 | ||
61 | /* fragmentation defines */ | 61 | /* fragmentation defines */ |
62 | enum unicast_frag_flags { | 62 | enum batadv_unicast_frag_flags { |
63 | UNI_FRAG_HEAD = 1 << 0, | 63 | BATADV_UNI_FRAG_HEAD = 1 << 0, |
64 | UNI_FRAG_LARGETAIL = 1 << 1 | 64 | BATADV_UNI_FRAG_LARGETAIL = 1 << 1, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | /* TT_QUERY subtypes */ | 67 | /* TT_QUERY subtypes */ |
68 | #define BATADV_TT_QUERY_TYPE_MASK 0x3 | 68 | #define BATADV_TT_QUERY_TYPE_MASK 0x3 |
69 | 69 | ||
70 | enum tt_query_packettype { | 70 | enum batadv_tt_query_packettype { |
71 | TT_REQUEST = 0, | 71 | BATADV_TT_REQUEST = 0, |
72 | TT_RESPONSE = 1 | 72 | BATADV_TT_RESPONSE = 1, |
73 | }; | 73 | }; |
74 | 74 | ||
75 | /* TT_QUERY flags */ | 75 | /* TT_QUERY flags */ |
76 | enum tt_query_flags { | 76 | enum batadv_tt_query_flags { |
77 | TT_FULL_TABLE = 1 << 2 | 77 | BATADV_TT_FULL_TABLE = 1 << 2, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | /* TT_CLIENT flags. | 80 | /* BATADV_TT_CLIENT flags. |
81 | * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to | 81 | * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to |
82 | * 1 << 15 are used for local computation only | 82 | * 1 << 15 are used for local computation only |
83 | */ | 83 | */ |
84 | enum tt_client_flags { | 84 | enum batadv_tt_client_flags { |
85 | TT_CLIENT_DEL = 1 << 0, | 85 | BATADV_TT_CLIENT_DEL = 1 << 0, |
86 | TT_CLIENT_ROAM = 1 << 1, | 86 | BATADV_TT_CLIENT_ROAM = 1 << 1, |
87 | TT_CLIENT_WIFI = 1 << 2, | 87 | BATADV_TT_CLIENT_WIFI = 1 << 2, |
88 | TT_CLIENT_NOPURGE = 1 << 8, | 88 | BATADV_TT_CLIENT_NOPURGE = 1 << 8, |
89 | TT_CLIENT_NEW = 1 << 9, | 89 | BATADV_TT_CLIENT_NEW = 1 << 9, |
90 | TT_CLIENT_PENDING = 1 << 10 | 90 | BATADV_TT_CLIENT_PENDING = 1 << 10, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | /* claim frame types for the bridge loop avoidance */ | 93 | /* claim frame types for the bridge loop avoidance */ |
94 | enum bla_claimframe { | 94 | enum batadv_bla_claimframe { |
95 | CLAIM_TYPE_ADD = 0x00, | 95 | BATADV_CLAIM_TYPE_ADD = 0x00, |
96 | CLAIM_TYPE_DEL = 0x01, | 96 | BATADV_CLAIM_TYPE_DEL = 0x01, |
97 | CLAIM_TYPE_ANNOUNCE = 0x02, | 97 | BATADV_CLAIM_TYPE_ANNOUNCE = 0x02, |
98 | CLAIM_TYPE_REQUEST = 0x03 | 98 | BATADV_CLAIM_TYPE_REQUEST = 0x03, |
99 | }; | 99 | }; |
100 | 100 | ||
101 | /* the destination hardware field in the ARP frame is used to | 101 | /* the destination hardware field in the ARP frame is used to |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index aa8325e8f8bf..8e43a951694f 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -219,7 +219,7 @@ batadv_bonding_save_primary(const struct orig_node *orig_node, | |||
219 | struct orig_node *orig_neigh_node, | 219 | struct orig_node *orig_neigh_node, |
220 | const struct batman_ogm_packet *batman_ogm_packet) | 220 | const struct batman_ogm_packet *batman_ogm_packet) |
221 | { | 221 | { |
222 | if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) | 222 | if (!(batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP)) |
223 | return; | 223 | return; |
224 | 224 | ||
225 | memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN); | 225 | memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN); |
@@ -290,7 +290,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv, | |||
290 | icmp_packet = (struct icmp_packet_rr *)skb->data; | 290 | icmp_packet = (struct icmp_packet_rr *)skb->data; |
291 | 291 | ||
292 | /* add data to device queue */ | 292 | /* add data to device queue */ |
293 | if (icmp_packet->msg_type != ECHO_REQUEST) { | 293 | if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) { |
294 | batadv_socket_receive_packet(icmp_packet, icmp_len); | 294 | batadv_socket_receive_packet(icmp_packet, icmp_len); |
295 | goto out; | 295 | goto out; |
296 | } | 296 | } |
@@ -317,7 +317,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv, | |||
317 | 317 | ||
318 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); | 318 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); |
319 | memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN); | 319 | memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN); |
320 | icmp_packet->msg_type = ECHO_REPLY; | 320 | icmp_packet->msg_type = BATADV_ECHO_REPLY; |
321 | icmp_packet->header.ttl = BATADV_TTL; | 321 | icmp_packet->header.ttl = BATADV_TTL; |
322 | 322 | ||
323 | batadv_send_skb_packet(skb, router->if_incoming, router->addr); | 323 | batadv_send_skb_packet(skb, router->if_incoming, router->addr); |
@@ -345,7 +345,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, | |||
345 | icmp_packet = (struct icmp_packet *)skb->data; | 345 | icmp_packet = (struct icmp_packet *)skb->data; |
346 | 346 | ||
347 | /* send TTL exceeded if packet is an echo request (traceroute) */ | 347 | /* send TTL exceeded if packet is an echo request (traceroute) */ |
348 | if (icmp_packet->msg_type != ECHO_REQUEST) { | 348 | if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) { |
349 | pr_debug("Warning - can't forward icmp packet from %pM to %pM: ttl exceeded\n", | 349 | pr_debug("Warning - can't forward icmp packet from %pM to %pM: ttl exceeded\n", |
350 | icmp_packet->orig, icmp_packet->dst); | 350 | icmp_packet->orig, icmp_packet->dst); |
351 | goto out; | 351 | goto out; |
@@ -372,7 +372,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, | |||
372 | 372 | ||
373 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); | 373 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); |
374 | memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN); | 374 | memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN); |
375 | icmp_packet->msg_type = TTL_EXCEEDED; | 375 | icmp_packet->msg_type = BATADV_TTL_EXCEEDED; |
376 | icmp_packet->header.ttl = BATADV_TTL; | 376 | icmp_packet->header.ttl = BATADV_TTL; |
377 | 377 | ||
378 | batadv_send_skb_packet(skb, router->if_incoming, router->addr); | 378 | batadv_send_skb_packet(skb, router->if_incoming, router->addr); |
@@ -606,14 +606,18 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
606 | tt_query = (struct tt_query_packet *)skb->data; | 606 | tt_query = (struct tt_query_packet *)skb->data; |
607 | 607 | ||
608 | switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) { | 608 | switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) { |
609 | case TT_REQUEST: | 609 | case BATADV_TT_REQUEST: |
610 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); | 610 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); |
611 | 611 | ||
612 | /* If we cannot provide an answer the tt_request is | 612 | /* If we cannot provide an answer the tt_request is |
613 | * forwarded | 613 | * forwarded |
614 | */ | 614 | */ |
615 | if (!batadv_send_tt_response(bat_priv, tt_query)) { | 615 | if (!batadv_send_tt_response(bat_priv, tt_query)) { |
616 | tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.'; | 616 | if (tt_query->flags & BATADV_TT_FULL_TABLE) |
617 | tt_flag = 'F'; | ||
618 | else | ||
619 | tt_flag = '.'; | ||
620 | |||
617 | batadv_dbg(DBG_TT, bat_priv, | 621 | batadv_dbg(DBG_TT, bat_priv, |
618 | "Routing TT_REQUEST to %pM [%c]\n", | 622 | "Routing TT_REQUEST to %pM [%c]\n", |
619 | tt_query->dst, | 623 | tt_query->dst, |
@@ -621,7 +625,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
621 | return batadv_route_unicast_packet(skb, recv_if); | 625 | return batadv_route_unicast_packet(skb, recv_if); |
622 | } | 626 | } |
623 | break; | 627 | break; |
624 | case TT_RESPONSE: | 628 | case BATADV_TT_RESPONSE: |
625 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); | 629 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); |
626 | 630 | ||
627 | if (batadv_is_my_mac(tt_query->dst)) { | 631 | if (batadv_is_my_mac(tt_query->dst)) { |
@@ -642,7 +646,10 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
642 | 646 | ||
643 | batadv_handle_tt_response(bat_priv, tt_query); | 647 | batadv_handle_tt_response(bat_priv, tt_query); |
644 | } else { | 648 | } else { |
645 | tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.'; | 649 | if (tt_query->flags & BATADV_TT_FULL_TABLE) |
650 | tt_flag = 'F'; | ||
651 | else | ||
652 | tt_flag = '.'; | ||
646 | batadv_dbg(DBG_TT, bat_priv, | 653 | batadv_dbg(DBG_TT, bat_priv, |
647 | "Routing TT_RESPONSE to %pM [%c]\n", | 654 | "Routing TT_RESPONSE to %pM [%c]\n", |
648 | tt_query->dst, | 655 | tt_query->dst, |
@@ -701,7 +708,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if) | |||
701 | roam_adv_packet->src, roam_adv_packet->client); | 708 | roam_adv_packet->src, roam_adv_packet->client); |
702 | 709 | ||
703 | batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client, | 710 | batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client, |
704 | TT_CLIENT_ROAM, | 711 | BATADV_TT_CLIENT_ROAM, |
705 | atomic_read(&orig_node->last_ttvn) + 1); | 712 | atomic_read(&orig_node->last_ttvn) + 1); |
706 | 713 | ||
707 | /* Roaming phase starts: I have new information but the ttvn has not | 714 | /* Roaming phase starts: I have new information but the ttvn has not |
@@ -868,7 +875,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
868 | 875 | ||
869 | unicast_packet = (struct unicast_packet *)skb->data; | 876 | unicast_packet = (struct unicast_packet *)skb->data; |
870 | 877 | ||
871 | if (unicast_packet->header.packet_type == BAT_UNICAST && | 878 | if (unicast_packet->header.packet_type == BATADV_UNICAST && |
872 | atomic_read(&bat_priv->fragmentation) && | 879 | atomic_read(&bat_priv->fragmentation) && |
873 | skb->len > neigh_node->if_incoming->net_dev->mtu) { | 880 | skb->len > neigh_node->if_incoming->net_dev->mtu) { |
874 | ret = batadv_frag_send_skb(skb, bat_priv, | 881 | ret = batadv_frag_send_skb(skb, bat_priv, |
@@ -877,7 +884,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, | |||
877 | goto out; | 884 | goto out; |
878 | } | 885 | } |
879 | 886 | ||
880 | if (unicast_packet->header.packet_type == BAT_UNICAST_FRAG && | 887 | if (unicast_packet->header.packet_type == BATADV_UNICAST_FRAG && |
881 | batadv_frag_can_reassemble(skb, | 888 | batadv_frag_can_reassemble(skb, |
882 | neigh_node->if_incoming->net_dev->mtu)) { | 889 | neigh_node->if_incoming->net_dev->mtu)) { |
883 | 890 | ||
@@ -1176,12 +1183,12 @@ int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if) | |||
1176 | return NET_RX_DROP; | 1183 | return NET_RX_DROP; |
1177 | 1184 | ||
1178 | switch (vis_packet->vis_type) { | 1185 | switch (vis_packet->vis_type) { |
1179 | case VIS_TYPE_SERVER_SYNC: | 1186 | case BATADV_VIS_TYPE_SERVER_SYNC: |
1180 | batadv_receive_server_sync_packet(bat_priv, vis_packet, | 1187 | batadv_receive_server_sync_packet(bat_priv, vis_packet, |
1181 | skb_headlen(skb)); | 1188 | skb_headlen(skb)); |
1182 | break; | 1189 | break; |
1183 | 1190 | ||
1184 | case VIS_TYPE_CLIENT_UPDATE: | 1191 | case BATADV_VIS_TYPE_CLIENT_UPDATE: |
1185 | batadv_receive_client_update_packet(bat_priv, vis_packet, | 1192 | batadv_receive_client_update_packet(bat_priv, vis_packet, |
1186 | skb_headlen(skb)); | 1193 | skb_headlen(skb)); |
1187 | break; | 1194 | break; |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 19a80d276585..3aae91d0d59a 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -213,7 +213,7 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
213 | bcast_packet->header.ttl = BATADV_TTL; | 213 | bcast_packet->header.ttl = BATADV_TTL; |
214 | 214 | ||
215 | /* batman packet type: broadcast */ | 215 | /* batman packet type: broadcast */ |
216 | bcast_packet->header.packet_type = BAT_BCAST; | 216 | bcast_packet->header.packet_type = BATADV_BCAST; |
217 | 217 | ||
218 | /* hw address of first interface is the orig mac because only | 218 | /* hw address of first interface is the orig mac because only |
219 | * this mac is known throughout the mesh | 219 | * this mac is known throughout the mesh |
@@ -387,7 +387,7 @@ struct net_device *batadv_softif_create(const char *name) | |||
387 | atomic_set(&bat_priv->bonding, 0); | 387 | atomic_set(&bat_priv->bonding, 0); |
388 | atomic_set(&bat_priv->bridge_loop_avoidance, 0); | 388 | atomic_set(&bat_priv->bridge_loop_avoidance, 0); |
389 | atomic_set(&bat_priv->ap_isolation, 0); | 389 | atomic_set(&bat_priv->ap_isolation, 0); |
390 | atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); | 390 | atomic_set(&bat_priv->vis_mode, BATADV_VIS_TYPE_CLIENT_UPDATE); |
391 | atomic_set(&bat_priv->gw_mode, BATADV_GW_MODE_OFF); | 391 | atomic_set(&bat_priv->gw_mode, BATADV_GW_MODE_OFF); |
392 | atomic_set(&bat_priv->gw_sel_class, 20); | 392 | atomic_set(&bat_priv->gw_sel_class, 20); |
393 | atomic_set(&bat_priv->gw_bandwidth, 41); | 393 | atomic_set(&bat_priv->gw_bandwidth, 41); |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index f36d1d52bff9..309d691abe64 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -169,7 +169,7 @@ static void batadv_tt_local_event(struct bat_priv *bat_priv, | |||
169 | tt_change_node->change.flags = flags; | 169 | tt_change_node->change.flags = flags; |
170 | memcpy(tt_change_node->change.addr, addr, ETH_ALEN); | 170 | memcpy(tt_change_node->change.addr, addr, ETH_ALEN); |
171 | 171 | ||
172 | del_op_requested = flags & TT_CLIENT_DEL; | 172 | del_op_requested = flags & BATADV_TT_CLIENT_DEL; |
173 | 173 | ||
174 | /* check for ADD+DEL or DEL+ADD events */ | 174 | /* check for ADD+DEL or DEL+ADD events */ |
175 | spin_lock_bh(&bat_priv->tt_changes_list_lock); | 175 | spin_lock_bh(&bat_priv->tt_changes_list_lock); |
@@ -185,7 +185,7 @@ static void batadv_tt_local_event(struct bat_priv *bat_priv, | |||
185 | * now possible due to automatically recognition of "temporary" | 185 | * now possible due to automatically recognition of "temporary" |
186 | * clients | 186 | * clients |
187 | */ | 187 | */ |
188 | del_op_entry = entry->change.flags & TT_CLIENT_DEL; | 188 | del_op_entry = entry->change.flags & BATADV_TT_CLIENT_DEL; |
189 | if (!del_op_requested && del_op_entry) | 189 | if (!del_op_requested && del_op_entry) |
190 | goto del; | 190 | goto del; |
191 | if (del_op_requested && !del_op_entry) | 191 | if (del_op_requested && !del_op_entry) |
@@ -243,8 +243,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
243 | 243 | ||
244 | if (tt_local_entry) { | 244 | if (tt_local_entry) { |
245 | tt_local_entry->last_seen = jiffies; | 245 | tt_local_entry->last_seen = jiffies; |
246 | /* possibly unset the TT_CLIENT_PENDING flag */ | 246 | /* possibly unset the BATADV_TT_CLIENT_PENDING flag */ |
247 | tt_local_entry->common.flags &= ~TT_CLIENT_PENDING; | 247 | tt_local_entry->common.flags &= ~BATADV_TT_CLIENT_PENDING; |
248 | goto out; | 248 | goto out; |
249 | } | 249 | } |
250 | 250 | ||
@@ -259,19 +259,19 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
259 | memcpy(tt_local_entry->common.addr, addr, ETH_ALEN); | 259 | memcpy(tt_local_entry->common.addr, addr, ETH_ALEN); |
260 | tt_local_entry->common.flags = BATADV_NO_FLAGS; | 260 | tt_local_entry->common.flags = BATADV_NO_FLAGS; |
261 | if (batadv_is_wifi_iface(ifindex)) | 261 | if (batadv_is_wifi_iface(ifindex)) |
262 | tt_local_entry->common.flags |= TT_CLIENT_WIFI; | 262 | tt_local_entry->common.flags |= BATADV_TT_CLIENT_WIFI; |
263 | atomic_set(&tt_local_entry->common.refcount, 2); | 263 | atomic_set(&tt_local_entry->common.refcount, 2); |
264 | tt_local_entry->last_seen = jiffies; | 264 | tt_local_entry->last_seen = jiffies; |
265 | 265 | ||
266 | /* the batman interface mac address should never be purged */ | 266 | /* the batman interface mac address should never be purged */ |
267 | if (batadv_compare_eth(addr, soft_iface->dev_addr)) | 267 | if (batadv_compare_eth(addr, soft_iface->dev_addr)) |
268 | tt_local_entry->common.flags |= TT_CLIENT_NOPURGE; | 268 | tt_local_entry->common.flags |= BATADV_TT_CLIENT_NOPURGE; |
269 | 269 | ||
270 | /* The local entry has to be marked as NEW to avoid to send it in | 270 | /* The local entry has to be marked as NEW to avoid to send it in |
271 | * a full table response going out before the next ttvn increment | 271 | * a full table response going out before the next ttvn increment |
272 | * (consistency check) | 272 | * (consistency check) |
273 | */ | 273 | */ |
274 | tt_local_entry->common.flags |= TT_CLIENT_NEW; | 274 | tt_local_entry->common.flags |= BATADV_TT_CLIENT_NEW; |
275 | 275 | ||
276 | hash_added = batadv_hash_add(bat_priv->tt_local_hash, batadv_compare_tt, | 276 | hash_added = batadv_hash_add(bat_priv->tt_local_hash, batadv_compare_tt, |
277 | batadv_choose_orig, | 277 | batadv_choose_orig, |
@@ -305,7 +305,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
305 | /* The global entry has to be marked as ROAMING and | 305 | /* The global entry has to be marked as ROAMING and |
306 | * has to be kept for consistency purpose | 306 | * has to be kept for consistency purpose |
307 | */ | 307 | */ |
308 | tt_global_entry->common.flags |= TT_CLIENT_ROAM; | 308 | tt_global_entry->common.flags |= BATADV_TT_CLIENT_ROAM; |
309 | tt_global_entry->roam_at = jiffies; | 309 | tt_global_entry->roam_at = jiffies; |
310 | } | 310 | } |
311 | out: | 311 | out: |
@@ -453,15 +453,15 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
453 | seq_printf(seq, " * %pM [%c%c%c%c%c]\n", | 453 | seq_printf(seq, " * %pM [%c%c%c%c%c]\n", |
454 | tt_common_entry->addr, | 454 | tt_common_entry->addr, |
455 | (tt_common_entry->flags & | 455 | (tt_common_entry->flags & |
456 | TT_CLIENT_ROAM ? 'R' : '.'), | 456 | BATADV_TT_CLIENT_ROAM ? 'R' : '.'), |
457 | (tt_common_entry->flags & | 457 | (tt_common_entry->flags & |
458 | TT_CLIENT_NOPURGE ? 'P' : '.'), | 458 | BATADV_TT_CLIENT_NOPURGE ? 'P' : '.'), |
459 | (tt_common_entry->flags & | 459 | (tt_common_entry->flags & |
460 | TT_CLIENT_NEW ? 'N' : '.'), | 460 | BATADV_TT_CLIENT_NEW ? 'N' : '.'), |
461 | (tt_common_entry->flags & | 461 | (tt_common_entry->flags & |
462 | TT_CLIENT_PENDING ? 'X' : '.'), | 462 | BATADV_TT_CLIENT_PENDING ? 'X' : '.'), |
463 | (tt_common_entry->flags & | 463 | (tt_common_entry->flags & |
464 | TT_CLIENT_WIFI ? 'W' : '.')); | 464 | BATADV_TT_CLIENT_WIFI ? 'W' : '.')); |
465 | } | 465 | } |
466 | rcu_read_unlock(); | 466 | rcu_read_unlock(); |
467 | } | 467 | } |
@@ -482,7 +482,7 @@ static void batadv_tt_local_set_pending(struct bat_priv *bat_priv, | |||
482 | * to be kept in the table in order to send it in a full table | 482 | * to be kept in the table in order to send it in a full table |
483 | * response issued before the net ttvn increment (consistency check) | 483 | * response issued before the net ttvn increment (consistency check) |
484 | */ | 484 | */ |
485 | tt_local_entry->common.flags |= TT_CLIENT_PENDING; | 485 | tt_local_entry->common.flags |= BATADV_TT_CLIENT_PENDING; |
486 | 486 | ||
487 | batadv_dbg(DBG_TT, bat_priv, | 487 | batadv_dbg(DBG_TT, bat_priv, |
488 | "Local tt entry (%pM) pending to be removed: %s\n", | 488 | "Local tt entry (%pM) pending to be removed: %s\n", |
@@ -499,9 +499,9 @@ void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, | |||
499 | if (!tt_local_entry) | 499 | if (!tt_local_entry) |
500 | goto out; | 500 | goto out; |
501 | 501 | ||
502 | flags = TT_CLIENT_DEL; | 502 | flags = BATADV_TT_CLIENT_DEL; |
503 | if (roaming) | 503 | if (roaming) |
504 | flags |= TT_CLIENT_ROAM; | 504 | flags |= BATADV_TT_CLIENT_ROAM; |
505 | 505 | ||
506 | batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message); | 506 | batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message); |
507 | out: | 507 | out: |
@@ -509,12 +509,36 @@ out: | |||
509 | batadv_tt_local_entry_free_ref(tt_local_entry); | 509 | batadv_tt_local_entry_free_ref(tt_local_entry); |
510 | } | 510 | } |
511 | 511 | ||
512 | static void batadv_tt_local_purge(struct bat_priv *bat_priv) | 512 | static void batadv_tt_local_purge_list(struct bat_priv *bat_priv, |
513 | struct hlist_head *head) | ||
513 | { | 514 | { |
514 | struct hashtable_t *hash = bat_priv->tt_local_hash; | ||
515 | struct tt_local_entry *tt_local_entry; | 515 | struct tt_local_entry *tt_local_entry; |
516 | struct tt_common_entry *tt_common_entry; | 516 | struct tt_common_entry *tt_common_entry; |
517 | struct hlist_node *node, *node_tmp; | 517 | struct hlist_node *node, *node_tmp; |
518 | |||
519 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, | ||
520 | hash_entry) { | ||
521 | tt_local_entry = container_of(tt_common_entry, | ||
522 | struct tt_local_entry, common); | ||
523 | if (tt_local_entry->common.flags & BATADV_TT_CLIENT_NOPURGE) | ||
524 | continue; | ||
525 | |||
526 | /* entry already marked for deletion */ | ||
527 | if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING) | ||
528 | continue; | ||
529 | |||
530 | if (!batadv_has_timed_out(tt_local_entry->last_seen, | ||
531 | BATADV_TT_LOCAL_TIMEOUT)) | ||
532 | continue; | ||
533 | |||
534 | batadv_tt_local_set_pending(bat_priv, tt_local_entry, | ||
535 | BATADV_TT_CLIENT_DEL, "timed out"); | ||
536 | } | ||
537 | } | ||
538 | |||
539 | static void batadv_tt_local_purge(struct bat_priv *bat_priv) | ||
540 | { | ||
541 | struct hashtable_t *hash = bat_priv->tt_local_hash; | ||
518 | struct hlist_head *head; | 542 | struct hlist_head *head; |
519 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 543 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
520 | uint32_t i; | 544 | uint32_t i; |
@@ -524,25 +548,7 @@ static void batadv_tt_local_purge(struct bat_priv *bat_priv) | |||
524 | list_lock = &hash->list_locks[i]; | 548 | list_lock = &hash->list_locks[i]; |
525 | 549 | ||
526 | spin_lock_bh(list_lock); | 550 | spin_lock_bh(list_lock); |
527 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, | 551 | batadv_tt_local_purge_list(bat_priv, head); |
528 | head, hash_entry) { | ||
529 | tt_local_entry = container_of(tt_common_entry, | ||
530 | struct tt_local_entry, | ||
531 | common); | ||
532 | if (tt_local_entry->common.flags & TT_CLIENT_NOPURGE) | ||
533 | continue; | ||
534 | |||
535 | /* entry already marked for deletion */ | ||
536 | if (tt_local_entry->common.flags & TT_CLIENT_PENDING) | ||
537 | continue; | ||
538 | |||
539 | if (!batadv_has_timed_out(tt_local_entry->last_seen, | ||
540 | BATADV_TT_LOCAL_TIMEOUT)) | ||
541 | continue; | ||
542 | |||
543 | batadv_tt_local_set_pending(bat_priv, tt_local_entry, | ||
544 | TT_CLIENT_DEL, "timed out"); | ||
545 | } | ||
546 | spin_unlock_bh(list_lock); | 552 | spin_unlock_bh(list_lock); |
547 | } | 553 | } |
548 | 554 | ||
@@ -701,16 +707,16 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, | |||
701 | } else { | 707 | } else { |
702 | /* there is already a global entry, use this one. */ | 708 | /* there is already a global entry, use this one. */ |
703 | 709 | ||
704 | /* If there is the TT_CLIENT_ROAM flag set, there is only one | 710 | /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only |
705 | * originator left in the list and we previously received a | 711 | * one originator left in the list and we previously received a |
706 | * delete + roaming change for this originator. | 712 | * delete + roaming change for this originator. |
707 | * | 713 | * |
708 | * We should first delete the old originator before adding the | 714 | * We should first delete the old originator before adding the |
709 | * new one. | 715 | * new one. |
710 | */ | 716 | */ |
711 | if (tt_global_entry->common.flags & TT_CLIENT_ROAM) { | 717 | if (tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM) { |
712 | batadv_tt_global_del_orig_list(tt_global_entry); | 718 | batadv_tt_global_del_orig_list(tt_global_entry); |
713 | tt_global_entry->common.flags &= ~TT_CLIENT_ROAM; | 719 | tt_global_entry->common.flags &= ~BATADV_TT_CLIENT_ROAM; |
714 | tt_global_entry->roam_at = 0; | 720 | tt_global_entry->roam_at = 0; |
715 | } | 721 | } |
716 | 722 | ||
@@ -727,7 +733,8 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, | |||
727 | out_remove: | 733 | out_remove: |
728 | /* remove address from local hash if present */ | 734 | /* remove address from local hash if present */ |
729 | batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr, | 735 | batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr, |
730 | "global tt received", flags & TT_CLIENT_ROAM); | 736 | "global tt received", |
737 | flags & BATADV_TT_CLIENT_ROAM); | ||
731 | ret = 1; | 738 | ret = 1; |
732 | out: | 739 | out: |
733 | if (tt_global_entry) | 740 | if (tt_global_entry) |
@@ -759,8 +766,8 @@ batadv_tt_global_print_entry(struct tt_global_entry *tt_global_entry, | |||
759 | seq_printf(seq, " * %pM (%3u) via %pM (%3u) [%c%c]\n", | 766 | seq_printf(seq, " * %pM (%3u) via %pM (%3u) [%c%c]\n", |
760 | tt_global_entry->common.addr, orig_entry->ttvn, | 767 | tt_global_entry->common.addr, orig_entry->ttvn, |
761 | orig_entry->orig_node->orig, last_ttvn, | 768 | orig_entry->orig_node->orig, last_ttvn, |
762 | (flags & TT_CLIENT_ROAM ? 'R' : '.'), | 769 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), |
763 | (flags & TT_CLIENT_WIFI ? 'W' : '.')); | 770 | (flags & BATADV_TT_CLIENT_WIFI ? 'W' : '.')); |
764 | } | 771 | } |
765 | } | 772 | } |
766 | 773 | ||
@@ -874,8 +881,8 @@ static void batadv_tt_global_del_struct(struct bat_priv *bat_priv, | |||
874 | } | 881 | } |
875 | 882 | ||
876 | /* If the client is to be deleted, we check if it is the last origantor entry | 883 | /* If the client is to be deleted, we check if it is the last origantor entry |
877 | * within tt_global entry. If yes, we set the TT_CLIENT_ROAM flag and the timer, | 884 | * within tt_global entry. If yes, we set the BATADV_TT_CLIENT_ROAM flag and the |
878 | * otherwise we simply remove the originator scheduled for deletion. | 885 | * timer, otherwise we simply remove the originator scheduled for deletion. |
879 | */ | 886 | */ |
880 | static void | 887 | static void |
881 | batadv_tt_global_del_roaming(struct bat_priv *bat_priv, | 888 | batadv_tt_global_del_roaming(struct bat_priv *bat_priv, |
@@ -903,7 +910,7 @@ batadv_tt_global_del_roaming(struct bat_priv *bat_priv, | |||
903 | 910 | ||
904 | if (last_entry) { | 911 | if (last_entry) { |
905 | /* its the last one, mark for roaming. */ | 912 | /* its the last one, mark for roaming. */ |
906 | tt_global_entry->common.flags |= TT_CLIENT_ROAM; | 913 | tt_global_entry->common.flags |= BATADV_TT_CLIENT_ROAM; |
907 | tt_global_entry->roam_at = jiffies; | 914 | tt_global_entry->roam_at = jiffies; |
908 | } else | 915 | } else |
909 | /* there is another entry, we can simply delete this | 916 | /* there is another entry, we can simply delete this |
@@ -942,7 +949,7 @@ static void batadv_tt_global_del(struct bat_priv *bat_priv, | |||
942 | * event, there are two possibilities: | 949 | * event, there are two possibilities: |
943 | * 1) the client roamed from node A to node B => if there | 950 | * 1) the client roamed from node A to node B => if there |
944 | * is only one originator left for this client, we mark | 951 | * is only one originator left for this client, we mark |
945 | * it with TT_CLIENT_ROAM, we start a timer and we | 952 | * it with BATADV_TT_CLIENT_ROAM, we start a timer and we |
946 | * wait for node B to claim it. In case of timeout | 953 | * wait for node B to claim it. In case of timeout |
947 | * the entry is purged. | 954 | * the entry is purged. |
948 | * | 955 | * |
@@ -1022,7 +1029,7 @@ static void batadv_tt_global_roam_purge_list(struct bat_priv *bat_priv, | |||
1022 | hash_entry) { | 1029 | hash_entry) { |
1023 | tt_global_entry = container_of(tt_common_entry, | 1030 | tt_global_entry = container_of(tt_common_entry, |
1024 | struct tt_global_entry, common); | 1031 | struct tt_global_entry, common); |
1025 | if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM)) | 1032 | if (!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM)) |
1026 | continue; | 1033 | continue; |
1027 | if (!batadv_has_timed_out(tt_global_entry->roam_at, | 1034 | if (!batadv_has_timed_out(tt_global_entry->roam_at, |
1028 | BATADV_TT_CLIENT_ROAM_TIMEOUT)) | 1035 | BATADV_TT_CLIENT_ROAM_TIMEOUT)) |
@@ -1096,8 +1103,8 @@ static bool _batadv_is_ap_isolated(struct tt_local_entry *tt_local_entry, | |||
1096 | { | 1103 | { |
1097 | bool ret = false; | 1104 | bool ret = false; |
1098 | 1105 | ||
1099 | if (tt_local_entry->common.flags & TT_CLIENT_WIFI && | 1106 | if (tt_local_entry->common.flags & BATADV_TT_CLIENT_WIFI && |
1100 | tt_global_entry->common.flags & TT_CLIENT_WIFI) | 1107 | tt_global_entry->common.flags & BATADV_TT_CLIENT_WIFI) |
1101 | ret = true; | 1108 | ret = true; |
1102 | 1109 | ||
1103 | return ret; | 1110 | return ret; |
@@ -1167,7 +1174,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | |||
1167 | { | 1174 | { |
1168 | uint16_t total = 0, total_one; | 1175 | uint16_t total = 0, total_one; |
1169 | struct hashtable_t *hash = bat_priv->tt_global_hash; | 1176 | struct hashtable_t *hash = bat_priv->tt_global_hash; |
1170 | struct tt_common_entry *tt_common_entry; | 1177 | struct tt_common_entry *tt_common; |
1171 | struct tt_global_entry *tt_global_entry; | 1178 | struct tt_global_entry *tt_global_entry; |
1172 | struct hlist_node *node; | 1179 | struct hlist_node *node; |
1173 | struct hlist_head *head; | 1180 | struct hlist_head *head; |
@@ -1178,9 +1185,8 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | |||
1178 | head = &hash->table[i]; | 1185 | head = &hash->table[i]; |
1179 | 1186 | ||
1180 | rcu_read_lock(); | 1187 | rcu_read_lock(); |
1181 | hlist_for_each_entry_rcu(tt_common_entry, node, | 1188 | hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { |
1182 | head, hash_entry) { | 1189 | tt_global_entry = container_of(tt_common, |
1183 | tt_global_entry = container_of(tt_common_entry, | ||
1184 | struct tt_global_entry, | 1190 | struct tt_global_entry, |
1185 | common); | 1191 | common); |
1186 | /* Roaming clients are in the global table for | 1192 | /* Roaming clients are in the global table for |
@@ -1188,7 +1194,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | |||
1188 | * taken into account while computing the | 1194 | * taken into account while computing the |
1189 | * global crc | 1195 | * global crc |
1190 | */ | 1196 | */ |
1191 | if (tt_global_entry->common.flags & TT_CLIENT_ROAM) | 1197 | if (tt_common->flags & BATADV_TT_CLIENT_ROAM) |
1192 | continue; | 1198 | continue; |
1193 | 1199 | ||
1194 | /* find out if this global entry is announced by this | 1200 | /* find out if this global entry is announced by this |
@@ -1201,7 +1207,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, | |||
1201 | total_one = 0; | 1207 | total_one = 0; |
1202 | for (j = 0; j < ETH_ALEN; j++) | 1208 | for (j = 0; j < ETH_ALEN; j++) |
1203 | total_one = crc16_byte(total_one, | 1209 | total_one = crc16_byte(total_one, |
1204 | tt_global_entry->common.addr[j]); | 1210 | tt_common->addr[j]); |
1205 | total ^= total_one; | 1211 | total ^= total_one; |
1206 | } | 1212 | } |
1207 | rcu_read_unlock(); | 1213 | rcu_read_unlock(); |
@@ -1215,7 +1221,7 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv) | |||
1215 | { | 1221 | { |
1216 | uint16_t total = 0, total_one; | 1222 | uint16_t total = 0, total_one; |
1217 | struct hashtable_t *hash = bat_priv->tt_local_hash; | 1223 | struct hashtable_t *hash = bat_priv->tt_local_hash; |
1218 | struct tt_common_entry *tt_common_entry; | 1224 | struct tt_common_entry *tt_common; |
1219 | struct hlist_node *node; | 1225 | struct hlist_node *node; |
1220 | struct hlist_head *head; | 1226 | struct hlist_head *head; |
1221 | uint32_t i; | 1227 | uint32_t i; |
@@ -1225,17 +1231,16 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv) | |||
1225 | head = &hash->table[i]; | 1231 | head = &hash->table[i]; |
1226 | 1232 | ||
1227 | rcu_read_lock(); | 1233 | rcu_read_lock(); |
1228 | hlist_for_each_entry_rcu(tt_common_entry, node, | 1234 | hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { |
1229 | head, hash_entry) { | ||
1230 | /* not yet committed clients have not to be taken into | 1235 | /* not yet committed clients have not to be taken into |
1231 | * account while computing the CRC | 1236 | * account while computing the CRC |
1232 | */ | 1237 | */ |
1233 | if (tt_common_entry->flags & TT_CLIENT_NEW) | 1238 | if (tt_common->flags & BATADV_TT_CLIENT_NEW) |
1234 | continue; | 1239 | continue; |
1235 | total_one = 0; | 1240 | total_one = 0; |
1236 | for (j = 0; j < ETH_ALEN; j++) | 1241 | for (j = 0; j < ETH_ALEN; j++) |
1237 | total_one = crc16_byte(total_one, | 1242 | total_one = crc16_byte(total_one, |
1238 | tt_common_entry->addr[j]); | 1243 | tt_common->addr[j]); |
1239 | total ^= total_one; | 1244 | total ^= total_one; |
1240 | } | 1245 | } |
1241 | rcu_read_unlock(); | 1246 | rcu_read_unlock(); |
@@ -1331,7 +1336,7 @@ static int batadv_tt_local_valid_entry(const void *entry_ptr, | |||
1331 | { | 1336 | { |
1332 | const struct tt_common_entry *tt_common_entry = entry_ptr; | 1337 | const struct tt_common_entry *tt_common_entry = entry_ptr; |
1333 | 1338 | ||
1334 | if (tt_common_entry->flags & TT_CLIENT_NEW) | 1339 | if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) |
1335 | return 0; | 1340 | return 0; |
1336 | return 1; | 1341 | return 1; |
1337 | } | 1342 | } |
@@ -1343,7 +1348,7 @@ static int batadv_tt_global_valid(const void *entry_ptr, | |||
1343 | const struct tt_global_entry *tt_global_entry; | 1348 | const struct tt_global_entry *tt_global_entry; |
1344 | const struct orig_node *orig_node = data_ptr; | 1349 | const struct orig_node *orig_node = data_ptr; |
1345 | 1350 | ||
1346 | if (tt_common_entry->flags & TT_CLIENT_ROAM) | 1351 | if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM) |
1347 | return 0; | 1352 | return 0; |
1348 | 1353 | ||
1349 | tt_global_entry = container_of(tt_common_entry, struct tt_global_entry, | 1354 | tt_global_entry = container_of(tt_common_entry, struct tt_global_entry, |
@@ -1450,17 +1455,17 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv, | |||
1450 | tt_request = (struct tt_query_packet *)skb_put(skb, | 1455 | tt_request = (struct tt_query_packet *)skb_put(skb, |
1451 | sizeof(struct tt_query_packet)); | 1456 | sizeof(struct tt_query_packet)); |
1452 | 1457 | ||
1453 | tt_request->header.packet_type = BAT_TT_QUERY; | 1458 | tt_request->header.packet_type = BATADV_TT_QUERY; |
1454 | tt_request->header.version = BATADV_COMPAT_VERSION; | 1459 | tt_request->header.version = BATADV_COMPAT_VERSION; |
1455 | memcpy(tt_request->src, primary_if->net_dev->dev_addr, ETH_ALEN); | 1460 | memcpy(tt_request->src, primary_if->net_dev->dev_addr, ETH_ALEN); |
1456 | memcpy(tt_request->dst, dst_orig_node->orig, ETH_ALEN); | 1461 | memcpy(tt_request->dst, dst_orig_node->orig, ETH_ALEN); |
1457 | tt_request->header.ttl = BATADV_TTL; | 1462 | tt_request->header.ttl = BATADV_TTL; |
1458 | tt_request->ttvn = ttvn; | 1463 | tt_request->ttvn = ttvn; |
1459 | tt_request->tt_data = htons(tt_crc); | 1464 | tt_request->tt_data = htons(tt_crc); |
1460 | tt_request->flags = TT_REQUEST; | 1465 | tt_request->flags = BATADV_TT_REQUEST; |
1461 | 1466 | ||
1462 | if (full_table) | 1467 | if (full_table) |
1463 | tt_request->flags |= TT_FULL_TABLE; | 1468 | tt_request->flags |= BATADV_TT_FULL_TABLE; |
1464 | 1469 | ||
1465 | neigh_node = batadv_orig_node_get_router(dst_orig_node); | 1470 | neigh_node = batadv_orig_node_get_router(dst_orig_node); |
1466 | if (!neigh_node) | 1471 | if (!neigh_node) |
@@ -1509,7 +1514,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv, | |||
1509 | batadv_dbg(DBG_TT, bat_priv, | 1514 | batadv_dbg(DBG_TT, bat_priv, |
1510 | "Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n", | 1515 | "Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n", |
1511 | tt_request->src, tt_request->ttvn, tt_request->dst, | 1516 | tt_request->src, tt_request->ttvn, tt_request->dst, |
1512 | (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); | 1517 | (tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); |
1513 | 1518 | ||
1514 | /* Let's get the orig node of the REAL destination */ | 1519 | /* Let's get the orig node of the REAL destination */ |
1515 | req_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->dst); | 1520 | req_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->dst); |
@@ -1537,7 +1542,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv, | |||
1537 | goto out; | 1542 | goto out; |
1538 | 1543 | ||
1539 | /* If the full table has been explicitly requested */ | 1544 | /* If the full table has been explicitly requested */ |
1540 | if (tt_request->flags & TT_FULL_TABLE || | 1545 | if (tt_request->flags & BATADV_TT_FULL_TABLE || |
1541 | !req_dst_orig_node->tt_buff) | 1546 | !req_dst_orig_node->tt_buff) |
1542 | full_table = true; | 1547 | full_table = true; |
1543 | else | 1548 | else |
@@ -1584,15 +1589,15 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv, | |||
1584 | tt_response = (struct tt_query_packet *)skb->data; | 1589 | tt_response = (struct tt_query_packet *)skb->data; |
1585 | } | 1590 | } |
1586 | 1591 | ||
1587 | tt_response->header.packet_type = BAT_TT_QUERY; | 1592 | tt_response->header.packet_type = BATADV_TT_QUERY; |
1588 | tt_response->header.version = BATADV_COMPAT_VERSION; | 1593 | tt_response->header.version = BATADV_COMPAT_VERSION; |
1589 | tt_response->header.ttl = BATADV_TTL; | 1594 | tt_response->header.ttl = BATADV_TTL; |
1590 | memcpy(tt_response->src, req_dst_orig_node->orig, ETH_ALEN); | 1595 | memcpy(tt_response->src, req_dst_orig_node->orig, ETH_ALEN); |
1591 | memcpy(tt_response->dst, tt_request->src, ETH_ALEN); | 1596 | memcpy(tt_response->dst, tt_request->src, ETH_ALEN); |
1592 | tt_response->flags = TT_RESPONSE; | 1597 | tt_response->flags = BATADV_TT_RESPONSE; |
1593 | 1598 | ||
1594 | if (full_table) | 1599 | if (full_table) |
1595 | tt_response->flags |= TT_FULL_TABLE; | 1600 | tt_response->flags |= BATADV_TT_FULL_TABLE; |
1596 | 1601 | ||
1597 | batadv_dbg(DBG_TT, bat_priv, | 1602 | batadv_dbg(DBG_TT, bat_priv, |
1598 | "Sending TT_RESPONSE %pM via %pM for %pM (ttvn: %u)\n", | 1603 | "Sending TT_RESPONSE %pM via %pM for %pM (ttvn: %u)\n", |
@@ -1639,7 +1644,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv, | |||
1639 | batadv_dbg(DBG_TT, bat_priv, | 1644 | batadv_dbg(DBG_TT, bat_priv, |
1640 | "Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n", | 1645 | "Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n", |
1641 | tt_request->src, tt_request->ttvn, | 1646 | tt_request->src, tt_request->ttvn, |
1642 | (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); | 1647 | (tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); |
1643 | 1648 | ||
1644 | 1649 | ||
1645 | my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn); | 1650 | my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn); |
@@ -1660,7 +1665,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv, | |||
1660 | /* If the full table has been explicitly requested or the gap | 1665 | /* If the full table has been explicitly requested or the gap |
1661 | * is too big send the whole local translation table | 1666 | * is too big send the whole local translation table |
1662 | */ | 1667 | */ |
1663 | if (tt_request->flags & TT_FULL_TABLE || my_ttvn != req_ttvn || | 1668 | if (tt_request->flags & BATADV_TT_FULL_TABLE || my_ttvn != req_ttvn || |
1664 | !bat_priv->tt_buff) | 1669 | !bat_priv->tt_buff) |
1665 | full_table = true; | 1670 | full_table = true; |
1666 | else | 1671 | else |
@@ -1705,20 +1710,20 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv, | |||
1705 | tt_response = (struct tt_query_packet *)skb->data; | 1710 | tt_response = (struct tt_query_packet *)skb->data; |
1706 | } | 1711 | } |
1707 | 1712 | ||
1708 | tt_response->header.packet_type = BAT_TT_QUERY; | 1713 | tt_response->header.packet_type = BATADV_TT_QUERY; |
1709 | tt_response->header.version = BATADV_COMPAT_VERSION; | 1714 | tt_response->header.version = BATADV_COMPAT_VERSION; |
1710 | tt_response->header.ttl = BATADV_TTL; | 1715 | tt_response->header.ttl = BATADV_TTL; |
1711 | memcpy(tt_response->src, primary_if->net_dev->dev_addr, ETH_ALEN); | 1716 | memcpy(tt_response->src, primary_if->net_dev->dev_addr, ETH_ALEN); |
1712 | memcpy(tt_response->dst, tt_request->src, ETH_ALEN); | 1717 | memcpy(tt_response->dst, tt_request->src, ETH_ALEN); |
1713 | tt_response->flags = TT_RESPONSE; | 1718 | tt_response->flags = BATADV_TT_RESPONSE; |
1714 | 1719 | ||
1715 | if (full_table) | 1720 | if (full_table) |
1716 | tt_response->flags |= TT_FULL_TABLE; | 1721 | tt_response->flags |= BATADV_TT_FULL_TABLE; |
1717 | 1722 | ||
1718 | batadv_dbg(DBG_TT, bat_priv, | 1723 | batadv_dbg(DBG_TT, bat_priv, |
1719 | "Sending TT_RESPONSE to %pM via %pM [%c]\n", | 1724 | "Sending TT_RESPONSE to %pM via %pM [%c]\n", |
1720 | orig_node->orig, neigh_node->addr, | 1725 | orig_node->orig, neigh_node->addr, |
1721 | (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); | 1726 | (tt_response->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); |
1722 | 1727 | ||
1723 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); | 1728 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); |
1724 | 1729 | ||
@@ -1764,8 +1769,8 @@ static void _batadv_tt_update_changes(struct bat_priv *bat_priv, | |||
1764 | int roams; | 1769 | int roams; |
1765 | 1770 | ||
1766 | for (i = 0; i < tt_num_changes; i++) { | 1771 | for (i = 0; i < tt_num_changes; i++) { |
1767 | if ((tt_change + i)->flags & TT_CLIENT_DEL) { | 1772 | if ((tt_change + i)->flags & BATADV_TT_CLIENT_DEL) { |
1768 | roams = (tt_change + i)->flags & TT_CLIENT_ROAM; | 1773 | roams = (tt_change + i)->flags & BATADV_TT_CLIENT_ROAM; |
1769 | batadv_tt_global_del(bat_priv, orig_node, | 1774 | batadv_tt_global_del(bat_priv, orig_node, |
1770 | (tt_change + i)->addr, | 1775 | (tt_change + i)->addr, |
1771 | "tt removed by changes", | 1776 | "tt removed by changes", |
@@ -1840,7 +1845,7 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) | |||
1840 | /* Check if the client has been logically deleted (but is kept for | 1845 | /* Check if the client has been logically deleted (but is kept for |
1841 | * consistency purpose) | 1846 | * consistency purpose) |
1842 | */ | 1847 | */ |
1843 | if (tt_local_entry->common.flags & TT_CLIENT_PENDING) | 1848 | if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING) |
1844 | goto out; | 1849 | goto out; |
1845 | ret = true; | 1850 | ret = true; |
1846 | out: | 1851 | out: |
@@ -1859,7 +1864,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, | |||
1859 | "Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n", | 1864 | "Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n", |
1860 | tt_response->src, tt_response->ttvn, | 1865 | tt_response->src, tt_response->ttvn, |
1861 | ntohs(tt_response->tt_data), | 1866 | ntohs(tt_response->tt_data), |
1862 | (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); | 1867 | (tt_response->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); |
1863 | 1868 | ||
1864 | /* we should have never asked a backbone gw */ | 1869 | /* we should have never asked a backbone gw */ |
1865 | if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_response->src)) | 1870 | if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_response->src)) |
@@ -1869,7 +1874,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, | |||
1869 | if (!orig_node) | 1874 | if (!orig_node) |
1870 | goto out; | 1875 | goto out; |
1871 | 1876 | ||
1872 | if (tt_response->flags & TT_FULL_TABLE) | 1877 | if (tt_response->flags & BATADV_TT_FULL_TABLE) |
1873 | batadv_tt_fill_gtable(bat_priv, tt_response); | 1878 | batadv_tt_fill_gtable(bat_priv, tt_response); |
1874 | else | 1879 | else |
1875 | batadv_tt_update_changes(bat_priv, orig_node, | 1880 | batadv_tt_update_changes(bat_priv, orig_node, |
@@ -2019,7 +2024,7 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, | |||
2019 | roam_adv_packet = (struct roam_adv_packet *)skb_put(skb, | 2024 | roam_adv_packet = (struct roam_adv_packet *)skb_put(skb, |
2020 | sizeof(struct roam_adv_packet)); | 2025 | sizeof(struct roam_adv_packet)); |
2021 | 2026 | ||
2022 | roam_adv_packet->header.packet_type = BAT_ROAM_ADV; | 2027 | roam_adv_packet->header.packet_type = BATADV_ROAM_ADV; |
2023 | roam_adv_packet->header.version = BATADV_COMPAT_VERSION; | 2028 | roam_adv_packet->header.version = BATADV_COMPAT_VERSION; |
2024 | roam_adv_packet->header.ttl = BATADV_TTL; | 2029 | roam_adv_packet->header.ttl = BATADV_TTL; |
2025 | primary_if = batadv_primary_if_get_selected(bat_priv); | 2030 | primary_if = batadv_primary_if_get_selected(bat_priv); |
@@ -2117,11 +2122,11 @@ out: | |||
2117 | return changed_num; | 2122 | return changed_num; |
2118 | } | 2123 | } |
2119 | 2124 | ||
2120 | /* Purge out all the tt local entries marked with TT_CLIENT_PENDING */ | 2125 | /* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */ |
2121 | static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv) | 2126 | static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv) |
2122 | { | 2127 | { |
2123 | struct hashtable_t *hash = bat_priv->tt_local_hash; | 2128 | struct hashtable_t *hash = bat_priv->tt_local_hash; |
2124 | struct tt_common_entry *tt_common_entry; | 2129 | struct tt_common_entry *tt_common; |
2125 | struct tt_local_entry *tt_local_entry; | 2130 | struct tt_local_entry *tt_local_entry; |
2126 | struct hlist_node *node, *node_tmp; | 2131 | struct hlist_node *node, *node_tmp; |
2127 | struct hlist_head *head; | 2132 | struct hlist_head *head; |
@@ -2136,18 +2141,18 @@ static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv) | |||
2136 | list_lock = &hash->list_locks[i]; | 2141 | list_lock = &hash->list_locks[i]; |
2137 | 2142 | ||
2138 | spin_lock_bh(list_lock); | 2143 | spin_lock_bh(list_lock); |
2139 | hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, | 2144 | hlist_for_each_entry_safe(tt_common, node, node_tmp, head, |
2140 | head, hash_entry) { | 2145 | hash_entry) { |
2141 | if (!(tt_common_entry->flags & TT_CLIENT_PENDING)) | 2146 | if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING)) |
2142 | continue; | 2147 | continue; |
2143 | 2148 | ||
2144 | batadv_dbg(DBG_TT, bat_priv, | 2149 | batadv_dbg(DBG_TT, bat_priv, |
2145 | "Deleting local tt entry (%pM): pending\n", | 2150 | "Deleting local tt entry (%pM): pending\n", |
2146 | tt_common_entry->addr); | 2151 | tt_common->addr); |
2147 | 2152 | ||
2148 | atomic_dec(&bat_priv->num_local_tt); | 2153 | atomic_dec(&bat_priv->num_local_tt); |
2149 | hlist_del_rcu(node); | 2154 | hlist_del_rcu(node); |
2150 | tt_local_entry = container_of(tt_common_entry, | 2155 | tt_local_entry = container_of(tt_common, |
2151 | struct tt_local_entry, | 2156 | struct tt_local_entry, |
2152 | common); | 2157 | common); |
2153 | batadv_tt_local_entry_free_ref(tt_local_entry); | 2158 | batadv_tt_local_entry_free_ref(tt_local_entry); |
@@ -2167,7 +2172,7 @@ static int batadv_tt_commit_changes(struct bat_priv *bat_priv, | |||
2167 | return -ENOENT; | 2172 | return -ENOENT; |
2168 | 2173 | ||
2169 | changed_num = batadv_tt_set_flags(bat_priv->tt_local_hash, | 2174 | changed_num = batadv_tt_set_flags(bat_priv->tt_local_hash, |
2170 | TT_CLIENT_NEW, false); | 2175 | BATADV_TT_CLIENT_NEW, false); |
2171 | 2176 | ||
2172 | /* all reset entries have to be counted as local entries */ | 2177 | /* all reset entries have to be counted as local entries */ |
2173 | atomic_add(changed_num, &bat_priv->num_local_tt); | 2178 | atomic_add(changed_num, &bat_priv->num_local_tt); |
@@ -2326,7 +2331,7 @@ bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv, | |||
2326 | if (!tt_global_entry) | 2331 | if (!tt_global_entry) |
2327 | goto out; | 2332 | goto out; |
2328 | 2333 | ||
2329 | ret = tt_global_entry->common.flags & TT_CLIENT_ROAM; | 2334 | ret = tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM; |
2330 | batadv_tt_global_entry_free_ref(tt_global_entry); | 2335 | batadv_tt_global_entry_free_ref(tt_global_entry); |
2331 | out: | 2336 | out: |
2332 | return ret; | 2337 | return ret; |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index 8454d916cd01..c4603552f9d8 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -42,7 +42,7 @@ batadv_frag_merge_packet(struct list_head *head, | |||
42 | int uni_diff = sizeof(*up) - hdr_len; | 42 | int uni_diff = sizeof(*up) - hdr_len; |
43 | 43 | ||
44 | /* set skb to the first part and tmp_skb to the second part */ | 44 | /* set skb to the first part and tmp_skb to the second part */ |
45 | if (up->flags & UNI_FRAG_HEAD) { | 45 | if (up->flags & BATADV_UNI_FRAG_HEAD) { |
46 | tmp_skb = tfp->skb; | 46 | tmp_skb = tfp->skb; |
47 | } else { | 47 | } else { |
48 | tmp_skb = skb; | 48 | tmp_skb = skb; |
@@ -66,7 +66,7 @@ batadv_frag_merge_packet(struct list_head *head, | |||
66 | 66 | ||
67 | memmove(skb->data + uni_diff, skb->data, hdr_len); | 67 | memmove(skb->data + uni_diff, skb->data, hdr_len); |
68 | unicast_packet = (struct unicast_packet *)skb_pull(skb, uni_diff); | 68 | unicast_packet = (struct unicast_packet *)skb_pull(skb, uni_diff); |
69 | unicast_packet->header.packet_type = BAT_UNICAST; | 69 | unicast_packet->header.packet_type = BATADV_UNICAST; |
70 | 70 | ||
71 | return skb; | 71 | return skb; |
72 | 72 | ||
@@ -121,7 +121,7 @@ batadv_frag_search_packet(struct list_head *head, | |||
121 | struct unicast_frag_packet *tmp_up = NULL; | 121 | struct unicast_frag_packet *tmp_up = NULL; |
122 | uint16_t search_seqno; | 122 | uint16_t search_seqno; |
123 | 123 | ||
124 | if (up->flags & UNI_FRAG_HEAD) | 124 | if (up->flags & BATADV_UNI_FRAG_HEAD) |
125 | search_seqno = ntohs(up->seqno)+1; | 125 | search_seqno = ntohs(up->seqno)+1; |
126 | else | 126 | else |
127 | search_seqno = ntohs(up->seqno)-1; | 127 | search_seqno = ntohs(up->seqno)-1; |
@@ -138,8 +138,8 @@ batadv_frag_search_packet(struct list_head *head, | |||
138 | 138 | ||
139 | if (tfp->seqno == search_seqno) { | 139 | if (tfp->seqno == search_seqno) { |
140 | 140 | ||
141 | if ((tmp_up->flags & UNI_FRAG_HEAD) != | 141 | if ((tmp_up->flags & BATADV_UNI_FRAG_HEAD) != |
142 | (up->flags & UNI_FRAG_HEAD)) | 142 | (up->flags & BATADV_UNI_FRAG_HEAD)) |
143 | return tfp; | 143 | return tfp; |
144 | else | 144 | else |
145 | goto mov_tail; | 145 | goto mov_tail; |
@@ -254,15 +254,15 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | |||
254 | 254 | ||
255 | frag1->header.ttl--; | 255 | frag1->header.ttl--; |
256 | frag1->header.version = BATADV_COMPAT_VERSION; | 256 | frag1->header.version = BATADV_COMPAT_VERSION; |
257 | frag1->header.packet_type = BAT_UNICAST_FRAG; | 257 | frag1->header.packet_type = BATADV_UNICAST_FRAG; |
258 | 258 | ||
259 | memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN); | 259 | memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN); |
260 | memcpy(frag2, frag1, sizeof(*frag2)); | 260 | memcpy(frag2, frag1, sizeof(*frag2)); |
261 | 261 | ||
262 | if (data_len & 1) | 262 | if (data_len & 1) |
263 | large_tail = UNI_FRAG_LARGETAIL; | 263 | large_tail = BATADV_UNI_FRAG_LARGETAIL; |
264 | 264 | ||
265 | frag1->flags = UNI_FRAG_HEAD | large_tail; | 265 | frag1->flags = BATADV_UNI_FRAG_HEAD | large_tail; |
266 | frag2->flags = large_tail; | 266 | frag2->flags = large_tail; |
267 | 267 | ||
268 | seqno = atomic_add_return(2, &hard_iface->frag_seqno); | 268 | seqno = atomic_add_return(2, &hard_iface->frag_seqno); |
@@ -321,7 +321,7 @@ find_router: | |||
321 | 321 | ||
322 | unicast_packet->header.version = BATADV_COMPAT_VERSION; | 322 | unicast_packet->header.version = BATADV_COMPAT_VERSION; |
323 | /* batman packet type: unicast */ | 323 | /* batman packet type: unicast */ |
324 | unicast_packet->header.packet_type = BAT_UNICAST; | 324 | unicast_packet->header.packet_type = BATADV_UNICAST; |
325 | /* set unicast ttl */ | 325 | /* set unicast ttl */ |
326 | unicast_packet->header.ttl = BATADV_TTL; | 326 | unicast_packet->header.ttl = BATADV_TTL; |
327 | /* copy the destination for faster routing */ | 327 | /* copy the destination for faster routing */ |
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h index 936287f552ee..510e23f4179d 100644 --- a/net/batman-adv/unicast.h +++ b/net/batman-adv/unicast.h | |||
@@ -41,8 +41,8 @@ static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu) | |||
41 | 41 | ||
42 | unicast_packet = (struct unicast_frag_packet *)skb->data; | 42 | unicast_packet = (struct unicast_frag_packet *)skb->data; |
43 | 43 | ||
44 | if (unicast_packet->flags & UNI_FRAG_LARGETAIL) { | 44 | if (unicast_packet->flags & BATADV_UNI_FRAG_LARGETAIL) { |
45 | if (unicast_packet->flags & UNI_FRAG_HEAD) | 45 | if (unicast_packet->flags & BATADV_UNI_FRAG_HEAD) |
46 | uneven_correction = 1; | 46 | uneven_correction = 1; |
47 | else | 47 | else |
48 | uneven_correction = -1; | 48 | uneven_correction = -1; |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index c920b4b8516b..f5692eef613a 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -256,7 +256,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | |||
256 | if (!primary_if) | 256 | if (!primary_if) |
257 | goto out; | 257 | goto out; |
258 | 258 | ||
259 | if (vis_server == VIS_TYPE_CLIENT_UPDATE) | 259 | if (vis_server == BATADV_VIS_TYPE_CLIENT_UPDATE) |
260 | goto out; | 260 | goto out; |
261 | 261 | ||
262 | spin_lock_bh(&bat_priv->vis_hash_lock); | 262 | spin_lock_bh(&bat_priv->vis_hash_lock); |
@@ -437,7 +437,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, | |||
437 | int is_new, make_broadcast; | 437 | int is_new, make_broadcast; |
438 | int vis_server = atomic_read(&bat_priv->vis_mode); | 438 | int vis_server = atomic_read(&bat_priv->vis_mode); |
439 | 439 | ||
440 | make_broadcast = (vis_server == VIS_TYPE_SERVER_SYNC); | 440 | make_broadcast = (vis_server == BATADV_VIS_TYPE_SERVER_SYNC); |
441 | 441 | ||
442 | spin_lock_bh(&bat_priv->vis_hash_lock); | 442 | spin_lock_bh(&bat_priv->vis_hash_lock); |
443 | info = batadv_add_packet(bat_priv, vis_packet, vis_info_len, | 443 | info = batadv_add_packet(bat_priv, vis_packet, vis_info_len, |
@@ -448,7 +448,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, | |||
448 | /* only if we are server ourselves and packet is newer than the one in | 448 | /* only if we are server ourselves and packet is newer than the one in |
449 | * hash. | 449 | * hash. |
450 | */ | 450 | */ |
451 | if (vis_server == VIS_TYPE_SERVER_SYNC && is_new) | 451 | if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && is_new) |
452 | batadv_send_list_add(bat_priv, info); | 452 | batadv_send_list_add(bat_priv, info); |
453 | end: | 453 | end: |
454 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 454 | spin_unlock_bh(&bat_priv->vis_hash_lock); |
@@ -470,7 +470,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv, | |||
470 | return; | 470 | return; |
471 | 471 | ||
472 | /* Are we the target for this VIS packet? */ | 472 | /* Are we the target for this VIS packet? */ |
473 | if (vis_server == VIS_TYPE_SERVER_SYNC && | 473 | if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && |
474 | batadv_is_my_mac(vis_packet->target_orig)) | 474 | batadv_is_my_mac(vis_packet->target_orig)) |
475 | are_target = 1; | 475 | are_target = 1; |
476 | 476 | ||
@@ -486,7 +486,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv, | |||
486 | 486 | ||
487 | /* send only if we're the target server or ... */ | 487 | /* send only if we're the target server or ... */ |
488 | if (are_target && is_new) { | 488 | if (are_target && is_new) { |
489 | packet->vis_type = VIS_TYPE_SERVER_SYNC; /* upgrade! */ | 489 | packet->vis_type = BATADV_VIS_TYPE_SERVER_SYNC; /* upgrade! */ |
490 | batadv_send_list_add(bat_priv, info); | 490 | batadv_send_list_add(bat_priv, info); |
491 | 491 | ||
492 | /* ... we're not the recipient (and thus need to forward). */ | 492 | /* ... we're not the recipient (and thus need to forward). */ |
@@ -526,7 +526,7 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv, | |||
526 | if (!router) | 526 | if (!router) |
527 | continue; | 527 | continue; |
528 | 528 | ||
529 | if ((orig_node->flags & VIS_SERVER) && | 529 | if ((orig_node->flags & BATADV_VIS_SERVER) && |
530 | (router->tq_avg > best_tq)) { | 530 | (router->tq_avg > best_tq)) { |
531 | best_tq = router->tq_avg; | 531 | best_tq = router->tq_avg; |
532 | memcpy(packet->target_orig, orig_node->orig, | 532 | memcpy(packet->target_orig, orig_node->orig, |
@@ -580,7 +580,7 @@ static int batadv_generate_vis_packet(struct bat_priv *bat_priv) | |||
580 | packet->entries = 0; | 580 | packet->entries = 0; |
581 | skb_trim(info->skb_packet, sizeof(*packet)); | 581 | skb_trim(info->skb_packet, sizeof(*packet)); |
582 | 582 | ||
583 | if (packet->vis_type == VIS_TYPE_CLIENT_UPDATE) { | 583 | if (packet->vis_type == BATADV_VIS_TYPE_CLIENT_UPDATE) { |
584 | best_tq = batadv_find_best_vis_server(bat_priv, info); | 584 | best_tq = batadv_find_best_vis_server(bat_priv, info); |
585 | 585 | ||
586 | if (best_tq < 0) | 586 | if (best_tq < 0) |
@@ -707,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv, | |||
707 | rcu_read_lock(); | 707 | rcu_read_lock(); |
708 | hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { | 708 | hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { |
709 | /* if it's a vis server and reachable, send it. */ | 709 | /* if it's a vis server and reachable, send it. */ |
710 | if (!(orig_node->flags & VIS_SERVER)) | 710 | if (!(orig_node->flags & BATADV_VIS_SERVER)) |
711 | continue; | 711 | continue; |
712 | 712 | ||
713 | router = batadv_orig_node_get_router(orig_node); | 713 | router = batadv_orig_node_get_router(orig_node); |
@@ -875,7 +875,7 @@ int batadv_vis_init(struct bat_priv *bat_priv) | |||
875 | kref_init(&bat_priv->my_vis_info->refcount); | 875 | kref_init(&bat_priv->my_vis_info->refcount); |
876 | bat_priv->my_vis_info->bat_priv = bat_priv; | 876 | bat_priv->my_vis_info->bat_priv = bat_priv; |
877 | packet->header.version = BATADV_COMPAT_VERSION; | 877 | packet->header.version = BATADV_COMPAT_VERSION; |
878 | packet->header.packet_type = BAT_VIS; | 878 | packet->header.packet_type = BATADV_VIS; |
879 | packet->header.ttl = BATADV_TTL; | 879 | packet->header.ttl = BATADV_TTL; |
880 | packet->seqno = 0; | 880 | packet->seqno = 0; |
881 | packet->entries = 0; | 881 | packet->entries = 0; |