diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-05-12 07:48:58 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-25 02:21:30 -0400 |
commit | 1eda58bfc56c43e73a0cf2bfb6e4d620ab866109 (patch) | |
tree | d71ba63d988193126831e49bdce03a1131d28ea4 /net/batman-adv | |
parent | f0530ee5fb9e73465ac844ada2c96a2bea85a18f (diff) |
batman-adv: Prefix main static inline functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 206 | ||||
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 8 | ||||
-rw-r--r-- | net/batman-adv/bitarray.c | 10 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 165 | ||||
-rw-r--r-- | net/batman-adv/gateway_client.c | 54 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 4 | ||||
-rw-r--r-- | net/batman-adv/icmp_socket.c | 12 | ||||
-rw-r--r-- | net/batman-adv/main.c | 8 | ||||
-rw-r--r-- | net/batman-adv/main.h | 17 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 65 | ||||
-rw-r--r-- | net/batman-adv/originator.h | 2 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 68 | ||||
-rw-r--r-- | net/batman-adv/send.c | 12 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 2 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 149 | ||||
-rw-r--r-- | net/batman-adv/vis.c | 27 |
16 files changed, 414 insertions, 395 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 94e6fdbdd13d..025df7c9a2d9 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -179,16 +179,16 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet, | |||
179 | fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ? | 179 | fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ? |
180 | "Sending own" : | 180 | "Sending own" : |
181 | "Forwarding")); | 181 | "Forwarding")); |
182 | bat_dbg(DBG_BATMAN, bat_priv, | 182 | batadv_dbg(DBG_BATMAN, bat_priv, |
183 | "%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s, ttvn %d) on interface %s [%pM]\n", | 183 | "%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s, ttvn %d) on interface %s [%pM]\n", |
184 | fwd_str, (packet_num > 0 ? "aggregated " : ""), | 184 | fwd_str, (packet_num > 0 ? "aggregated " : ""), |
185 | batman_ogm_packet->orig, | 185 | batman_ogm_packet->orig, |
186 | ntohl(batman_ogm_packet->seqno), | 186 | ntohl(batman_ogm_packet->seqno), |
187 | batman_ogm_packet->tq, batman_ogm_packet->header.ttl, | 187 | batman_ogm_packet->tq, batman_ogm_packet->header.ttl, |
188 | (batman_ogm_packet->flags & DIRECTLINK ? | 188 | (batman_ogm_packet->flags & DIRECTLINK ? |
189 | "on" : "off"), | 189 | "on" : "off"), |
190 | batman_ogm_packet->ttvn, hard_iface->net_dev->name, | 190 | batman_ogm_packet->ttvn, hard_iface->net_dev->name, |
191 | hard_iface->net_dev->dev_addr); | 191 | hard_iface->net_dev->dev_addr); |
192 | 192 | ||
193 | buff_pos += BATMAN_OGM_HLEN; | 193 | buff_pos += BATMAN_OGM_HLEN; |
194 | buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes); | 194 | buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes); |
@@ -243,14 +243,14 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet) | |||
243 | (forw_packet->own && (forw_packet->if_incoming != primary_if))) { | 243 | (forw_packet->own && (forw_packet->if_incoming != primary_if))) { |
244 | 244 | ||
245 | /* FIXME: what about aggregated packets ? */ | 245 | /* FIXME: what about aggregated packets ? */ |
246 | bat_dbg(DBG_BATMAN, bat_priv, | 246 | batadv_dbg(DBG_BATMAN, bat_priv, |
247 | "%s packet (originator %pM, seqno %u, TTL %d) on interface %s [%pM]\n", | 247 | "%s packet (originator %pM, seqno %u, TTL %d) on interface %s [%pM]\n", |
248 | (forw_packet->own ? "Sending own" : "Forwarding"), | 248 | (forw_packet->own ? "Sending own" : "Forwarding"), |
249 | batman_ogm_packet->orig, | 249 | batman_ogm_packet->orig, |
250 | ntohl(batman_ogm_packet->seqno), | 250 | ntohl(batman_ogm_packet->seqno), |
251 | batman_ogm_packet->header.ttl, | 251 | batman_ogm_packet->header.ttl, |
252 | forw_packet->if_incoming->net_dev->name, | 252 | forw_packet->if_incoming->net_dev->name, |
253 | forw_packet->if_incoming->net_dev->dev_addr); | 253 | forw_packet->if_incoming->net_dev->dev_addr); |
254 | 254 | ||
255 | /* skb is only used once and than forw_packet is free'd */ | 255 | /* skb is only used once and than forw_packet is free'd */ |
256 | batadv_send_skb_packet(forw_packet->skb, | 256 | batadv_send_skb_packet(forw_packet->skb, |
@@ -373,8 +373,8 @@ static void bat_iv_ogm_aggregate_new(const unsigned char *packet_buff, | |||
373 | /* own packet should always be scheduled */ | 373 | /* own packet should always be scheduled */ |
374 | if (!own_packet) { | 374 | if (!own_packet) { |
375 | if (!atomic_dec_not_zero(&bat_priv->batman_queue_left)) { | 375 | if (!atomic_dec_not_zero(&bat_priv->batman_queue_left)) { |
376 | bat_dbg(DBG_BATMAN, bat_priv, | 376 | batadv_dbg(DBG_BATMAN, bat_priv, |
377 | "batman packet queue full\n"); | 377 | "batman packet queue full\n"); |
378 | goto out; | 378 | goto out; |
379 | } | 379 | } |
380 | } | 380 | } |
@@ -521,7 +521,7 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node, | |||
521 | uint8_t tt_num_changes; | 521 | uint8_t tt_num_changes; |
522 | 522 | ||
523 | if (batman_ogm_packet->header.ttl <= 1) { | 523 | if (batman_ogm_packet->header.ttl <= 1) { |
524 | bat_dbg(DBG_BATMAN, bat_priv, "ttl exceeded\n"); | 524 | batadv_dbg(DBG_BATMAN, bat_priv, "ttl exceeded\n"); |
525 | return; | 525 | return; |
526 | } | 526 | } |
527 | 527 | ||
@@ -546,9 +546,9 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node, | |||
546 | /* apply hop penalty */ | 546 | /* apply hop penalty */ |
547 | batman_ogm_packet->tq = hop_penalty(batman_ogm_packet->tq, bat_priv); | 547 | batman_ogm_packet->tq = hop_penalty(batman_ogm_packet->tq, bat_priv); |
548 | 548 | ||
549 | bat_dbg(DBG_BATMAN, bat_priv, | 549 | batadv_dbg(DBG_BATMAN, bat_priv, |
550 | "Forwarding packet: tq: %i, ttl: %i\n", | 550 | "Forwarding packet: tq: %i, ttl: %i\n", |
551 | batman_ogm_packet->tq, batman_ogm_packet->header.ttl); | 551 | batman_ogm_packet->tq, batman_ogm_packet->header.ttl); |
552 | 552 | ||
553 | /* switch of primaries first hop flag when forwarding */ | 553 | /* switch of primaries first hop flag when forwarding */ |
554 | batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP; | 554 | batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP; |
@@ -625,16 +625,18 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, | |||
625 | struct orig_node *orig_node_tmp; | 625 | struct orig_node *orig_node_tmp; |
626 | struct hlist_node *node; | 626 | struct hlist_node *node; |
627 | uint8_t bcast_own_sum_orig, bcast_own_sum_neigh; | 627 | uint8_t bcast_own_sum_orig, bcast_own_sum_neigh; |
628 | uint8_t *neigh_addr; | ||
628 | 629 | ||
629 | bat_dbg(DBG_BATMAN, bat_priv, | 630 | batadv_dbg(DBG_BATMAN, bat_priv, |
630 | "update_originator(): Searching and updating originator entry of received packet\n"); | 631 | "update_originator(): Searching and updating originator entry of received packet\n"); |
631 | 632 | ||
632 | rcu_read_lock(); | 633 | rcu_read_lock(); |
633 | hlist_for_each_entry_rcu(tmp_neigh_node, node, | 634 | hlist_for_each_entry_rcu(tmp_neigh_node, node, |
634 | &orig_node->neigh_list, list) { | 635 | &orig_node->neigh_list, list) { |
635 | if (compare_eth(tmp_neigh_node->addr, ethhdr->h_source) && | 636 | neigh_addr = tmp_neigh_node->addr; |
636 | (tmp_neigh_node->if_incoming == if_incoming) && | 637 | if (batadv_compare_eth(neigh_addr, ethhdr->h_source) && |
637 | atomic_inc_not_zero(&tmp_neigh_node->refcount)) { | 638 | tmp_neigh_node->if_incoming == if_incoming && |
639 | atomic_inc_not_zero(&tmp_neigh_node->refcount)) { | ||
638 | if (neigh_node) | 640 | if (neigh_node) |
639 | batadv_neigh_node_free_ref(neigh_node); | 641 | batadv_neigh_node_free_ref(neigh_node); |
640 | neigh_node = tmp_neigh_node; | 642 | neigh_node = tmp_neigh_node; |
@@ -667,8 +669,8 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, | |||
667 | if (!neigh_node) | 669 | if (!neigh_node) |
668 | goto unlock; | 670 | goto unlock; |
669 | } else | 671 | } else |
670 | bat_dbg(DBG_BATMAN, bat_priv, | 672 | batadv_dbg(DBG_BATMAN, bat_priv, |
671 | "Updating existing last-hop neighbor of originator\n"); | 673 | "Updating existing last-hop neighbor of originator\n"); |
672 | 674 | ||
673 | rcu_read_unlock(); | 675 | rcu_read_unlock(); |
674 | 676 | ||
@@ -774,7 +776,8 @@ static int bat_iv_ogm_calc_tq(struct orig_node *orig_node, | |||
774 | hlist_for_each_entry_rcu(tmp_neigh_node, node, | 776 | hlist_for_each_entry_rcu(tmp_neigh_node, node, |
775 | &orig_neigh_node->neigh_list, list) { | 777 | &orig_neigh_node->neigh_list, list) { |
776 | 778 | ||
777 | if (!compare_eth(tmp_neigh_node->addr, orig_neigh_node->orig)) | 779 | if (!batadv_compare_eth(tmp_neigh_node->addr, |
780 | orig_neigh_node->orig)) | ||
778 | continue; | 781 | continue; |
779 | 782 | ||
780 | if (tmp_neigh_node->if_incoming != if_incoming) | 783 | if (tmp_neigh_node->if_incoming != if_incoming) |
@@ -844,10 +847,11 @@ static int bat_iv_ogm_calc_tq(struct orig_node *orig_node, | |||
844 | * tq_asym_penalty) / | 847 | * tq_asym_penalty) / |
845 | (TQ_MAX_VALUE * TQ_MAX_VALUE)); | 848 | (TQ_MAX_VALUE * TQ_MAX_VALUE)); |
846 | 849 | ||
847 | bat_dbg(DBG_BATMAN, bat_priv, | 850 | batadv_dbg(DBG_BATMAN, bat_priv, |
848 | "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n", | 851 | "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n", |
849 | orig_node->orig, orig_neigh_node->orig, total_count, | 852 | orig_node->orig, orig_neigh_node->orig, total_count, |
850 | neigh_rq_count, tq_own, tq_asym_penalty, batman_ogm_packet->tq); | 853 | neigh_rq_count, tq_own, |
854 | tq_asym_penalty, batman_ogm_packet->tq); | ||
851 | 855 | ||
852 | /* if link has the minimum required transmission quality | 856 | /* if link has the minimum required transmission quality |
853 | * consider it bidirectional | 857 | * consider it bidirectional |
@@ -883,6 +887,7 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
883 | int need_update = 0; | 887 | int need_update = 0; |
884 | int set_mark, ret = -1; | 888 | int set_mark, ret = -1; |
885 | uint32_t seqno = ntohl(batman_ogm_packet->seqno); | 889 | uint32_t seqno = ntohl(batman_ogm_packet->seqno); |
890 | uint8_t *neigh_addr; | ||
886 | 891 | ||
887 | orig_node = batadv_get_orig_node(bat_priv, batman_ogm_packet->orig); | 892 | orig_node = batadv_get_orig_node(bat_priv, batman_ogm_packet->orig); |
888 | if (!orig_node) | 893 | if (!orig_node) |
@@ -905,8 +910,9 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
905 | orig_node->last_real_seqno, | 910 | orig_node->last_real_seqno, |
906 | seqno); | 911 | seqno); |
907 | 912 | ||
908 | if (compare_eth(tmp_neigh_node->addr, ethhdr->h_source) && | 913 | neigh_addr = tmp_neigh_node->addr; |
909 | (tmp_neigh_node->if_incoming == if_incoming)) | 914 | if (batadv_compare_eth(neigh_addr, ethhdr->h_source) && |
915 | tmp_neigh_node->if_incoming == if_incoming) | ||
910 | set_mark = 1; | 916 | set_mark = 1; |
911 | else | 917 | else |
912 | set_mark = 0; | 918 | set_mark = 0; |
@@ -923,9 +929,9 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
923 | rcu_read_unlock(); | 929 | rcu_read_unlock(); |
924 | 930 | ||
925 | if (need_update) { | 931 | if (need_update) { |
926 | bat_dbg(DBG_BATMAN, bat_priv, | 932 | batadv_dbg(DBG_BATMAN, bat_priv, |
927 | "updating last_seqno: old %u, new %u\n", | 933 | "updating last_seqno: old %u, new %u\n", |
928 | orig_node->last_real_seqno, seqno); | 934 | orig_node->last_real_seqno, seqno); |
929 | orig_node->last_real_seqno = seqno; | 935 | orig_node->last_real_seqno = seqno; |
930 | } | 936 | } |
931 | 937 | ||
@@ -954,6 +960,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
954 | bool is_from_best_next_hop = false; | 960 | bool is_from_best_next_hop = false; |
955 | int is_duplicate; | 961 | int is_duplicate; |
956 | uint32_t if_incoming_seqno; | 962 | uint32_t if_incoming_seqno; |
963 | uint8_t *prev_sender; | ||
957 | 964 | ||
958 | /* Silently drop when the batman packet is actually not a | 965 | /* Silently drop when the batman packet is actually not a |
959 | * correct packet. | 966 | * correct packet. |
@@ -975,18 +982,19 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
975 | 982 | ||
976 | has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); | 983 | has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); |
977 | 984 | ||
978 | if (compare_eth(ethhdr->h_source, batman_ogm_packet->orig)) | 985 | if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig)) |
979 | is_single_hop_neigh = true; | 986 | is_single_hop_neigh = true; |
980 | 987 | ||
981 | bat_dbg(DBG_BATMAN, bat_priv, | 988 | batadv_dbg(DBG_BATMAN, bat_priv, |
982 | "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n", | 989 | "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n", |
983 | ethhdr->h_source, if_incoming->net_dev->name, | 990 | ethhdr->h_source, if_incoming->net_dev->name, |
984 | if_incoming->net_dev->dev_addr, batman_ogm_packet->orig, | 991 | if_incoming->net_dev->dev_addr, batman_ogm_packet->orig, |
985 | batman_ogm_packet->prev_sender, ntohl(batman_ogm_packet->seqno), | 992 | batman_ogm_packet->prev_sender, |
986 | batman_ogm_packet->ttvn, ntohs(batman_ogm_packet->tt_crc), | 993 | ntohl(batman_ogm_packet->seqno), batman_ogm_packet->ttvn, |
987 | batman_ogm_packet->tt_num_changes, batman_ogm_packet->tq, | 994 | ntohs(batman_ogm_packet->tt_crc), |
988 | batman_ogm_packet->header.ttl, | 995 | batman_ogm_packet->tt_num_changes, batman_ogm_packet->tq, |
989 | batman_ogm_packet->header.version, has_directlink_flag); | 996 | batman_ogm_packet->header.ttl, |
997 | batman_ogm_packet->header.version, has_directlink_flag); | ||
990 | 998 | ||
991 | rcu_read_lock(); | 999 | rcu_read_lock(); |
992 | list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { | 1000 | list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { |
@@ -996,16 +1004,16 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
996 | if (hard_iface->soft_iface != if_incoming->soft_iface) | 1004 | if (hard_iface->soft_iface != if_incoming->soft_iface) |
997 | continue; | 1005 | continue; |
998 | 1006 | ||
999 | if (compare_eth(ethhdr->h_source, | 1007 | if (batadv_compare_eth(ethhdr->h_source, |
1000 | hard_iface->net_dev->dev_addr)) | 1008 | hard_iface->net_dev->dev_addr)) |
1001 | is_my_addr = 1; | 1009 | is_my_addr = 1; |
1002 | 1010 | ||
1003 | if (compare_eth(batman_ogm_packet->orig, | 1011 | if (batadv_compare_eth(batman_ogm_packet->orig, |
1004 | hard_iface->net_dev->dev_addr)) | 1012 | hard_iface->net_dev->dev_addr)) |
1005 | is_my_orig = 1; | 1013 | is_my_orig = 1; |
1006 | 1014 | ||
1007 | if (compare_eth(batman_ogm_packet->prev_sender, | 1015 | if (batadv_compare_eth(batman_ogm_packet->prev_sender, |
1008 | hard_iface->net_dev->dev_addr)) | 1016 | hard_iface->net_dev->dev_addr)) |
1009 | is_my_oldorig = 1; | 1017 | is_my_oldorig = 1; |
1010 | 1018 | ||
1011 | if (is_broadcast_ether_addr(ethhdr->h_source)) | 1019 | if (is_broadcast_ether_addr(ethhdr->h_source)) |
@@ -1014,23 +1022,23 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1014 | rcu_read_unlock(); | 1022 | rcu_read_unlock(); |
1015 | 1023 | ||
1016 | if (batman_ogm_packet->header.version != COMPAT_VERSION) { | 1024 | if (batman_ogm_packet->header.version != COMPAT_VERSION) { |
1017 | bat_dbg(DBG_BATMAN, bat_priv, | 1025 | batadv_dbg(DBG_BATMAN, bat_priv, |
1018 | "Drop packet: incompatible batman version (%i)\n", | 1026 | "Drop packet: incompatible batman version (%i)\n", |
1019 | batman_ogm_packet->header.version); | 1027 | batman_ogm_packet->header.version); |
1020 | return; | 1028 | return; |
1021 | } | 1029 | } |
1022 | 1030 | ||
1023 | if (is_my_addr) { | 1031 | if (is_my_addr) { |
1024 | bat_dbg(DBG_BATMAN, bat_priv, | 1032 | batadv_dbg(DBG_BATMAN, bat_priv, |
1025 | "Drop packet: received my own broadcast (sender: %pM)\n", | 1033 | "Drop packet: received my own broadcast (sender: %pM)\n", |
1026 | ethhdr->h_source); | 1034 | ethhdr->h_source); |
1027 | return; | 1035 | return; |
1028 | } | 1036 | } |
1029 | 1037 | ||
1030 | if (is_broadcast) { | 1038 | if (is_broadcast) { |
1031 | bat_dbg(DBG_BATMAN, bat_priv, | 1039 | batadv_dbg(DBG_BATMAN, bat_priv, |
1032 | "Drop packet: ignoring all packets with broadcast source addr (sender: %pM)\n", | 1040 | "Drop packet: ignoring all packets with broadcast source addr (sender: %pM)\n", |
1033 | ethhdr->h_source); | 1041 | ethhdr->h_source); |
1034 | return; | 1042 | return; |
1035 | } | 1043 | } |
1036 | 1044 | ||
@@ -1049,8 +1057,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1049 | * save packet seqno for bidirectional check | 1057 | * save packet seqno for bidirectional check |
1050 | */ | 1058 | */ |
1051 | if (has_directlink_flag && | 1059 | if (has_directlink_flag && |
1052 | compare_eth(if_incoming->net_dev->dev_addr, | 1060 | batadv_compare_eth(if_incoming->net_dev->dev_addr, |
1053 | batman_ogm_packet->orig)) { | 1061 | batman_ogm_packet->orig)) { |
1054 | offset = if_incoming->if_num * NUM_WORDS; | 1062 | offset = if_incoming->if_num * NUM_WORDS; |
1055 | 1063 | ||
1056 | spin_lock_bh(&orig_neigh_node->ogm_cnt_lock); | 1064 | spin_lock_bh(&orig_neigh_node->ogm_cnt_lock); |
@@ -1063,23 +1071,23 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1063 | spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock); | 1071 | spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock); |
1064 | } | 1072 | } |
1065 | 1073 | ||
1066 | bat_dbg(DBG_BATMAN, bat_priv, | 1074 | batadv_dbg(DBG_BATMAN, bat_priv, |
1067 | "Drop packet: originator packet from myself (via neighbor)\n"); | 1075 | "Drop packet: originator packet from myself (via neighbor)\n"); |
1068 | batadv_orig_node_free_ref(orig_neigh_node); | 1076 | batadv_orig_node_free_ref(orig_neigh_node); |
1069 | return; | 1077 | return; |
1070 | } | 1078 | } |
1071 | 1079 | ||
1072 | if (is_my_oldorig) { | 1080 | if (is_my_oldorig) { |
1073 | bat_dbg(DBG_BATMAN, bat_priv, | 1081 | batadv_dbg(DBG_BATMAN, bat_priv, |
1074 | "Drop packet: ignoring all rebroadcast echos (sender: %pM)\n", | 1082 | "Drop packet: ignoring all rebroadcast echos (sender: %pM)\n", |
1075 | ethhdr->h_source); | 1083 | ethhdr->h_source); |
1076 | return; | 1084 | return; |
1077 | } | 1085 | } |
1078 | 1086 | ||
1079 | if (batman_ogm_packet->flags & NOT_BEST_NEXT_HOP) { | 1087 | if (batman_ogm_packet->flags & NOT_BEST_NEXT_HOP) { |
1080 | bat_dbg(DBG_BATMAN, bat_priv, | 1088 | batadv_dbg(DBG_BATMAN, bat_priv, |
1081 | "Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n", | 1089 | "Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n", |
1082 | ethhdr->h_source); | 1090 | ethhdr->h_source); |
1083 | return; | 1091 | return; |
1084 | } | 1092 | } |
1085 | 1093 | ||
@@ -1091,15 +1099,15 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1091 | if_incoming); | 1099 | if_incoming); |
1092 | 1100 | ||
1093 | if (is_duplicate == -1) { | 1101 | if (is_duplicate == -1) { |
1094 | bat_dbg(DBG_BATMAN, bat_priv, | 1102 | batadv_dbg(DBG_BATMAN, bat_priv, |
1095 | "Drop packet: packet within seqno protection time (sender: %pM)\n", | 1103 | "Drop packet: packet within seqno protection time (sender: %pM)\n", |
1096 | ethhdr->h_source); | 1104 | ethhdr->h_source); |
1097 | goto out; | 1105 | goto out; |
1098 | } | 1106 | } |
1099 | 1107 | ||
1100 | if (batman_ogm_packet->tq == 0) { | 1108 | if (batman_ogm_packet->tq == 0) { |
1101 | bat_dbg(DBG_BATMAN, bat_priv, | 1109 | batadv_dbg(DBG_BATMAN, bat_priv, |
1102 | "Drop packet: originator packet with tq equal 0\n"); | 1110 | "Drop packet: originator packet with tq equal 0\n"); |
1103 | goto out; | 1111 | goto out; |
1104 | } | 1112 | } |
1105 | 1113 | ||
@@ -1108,18 +1116,18 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1108 | router_router = batadv_orig_node_get_router(router->orig_node); | 1116 | router_router = batadv_orig_node_get_router(router->orig_node); |
1109 | 1117 | ||
1110 | if ((router && router->tq_avg != 0) && | 1118 | if ((router && router->tq_avg != 0) && |
1111 | (compare_eth(router->addr, ethhdr->h_source))) | 1119 | (batadv_compare_eth(router->addr, ethhdr->h_source))) |
1112 | is_from_best_next_hop = true; | 1120 | is_from_best_next_hop = true; |
1113 | 1121 | ||
1122 | prev_sender = batman_ogm_packet->prev_sender; | ||
1114 | /* avoid temporary routing loops */ | 1123 | /* avoid temporary routing loops */ |
1115 | if (router && router_router && | 1124 | if (router && router_router && |
1116 | (compare_eth(router->addr, batman_ogm_packet->prev_sender)) && | 1125 | (batadv_compare_eth(router->addr, prev_sender)) && |
1117 | !(compare_eth(batman_ogm_packet->orig, | 1126 | !(batadv_compare_eth(batman_ogm_packet->orig, prev_sender)) && |
1118 | batman_ogm_packet->prev_sender)) && | 1127 | (batadv_compare_eth(router->addr, router_router->addr))) { |
1119 | (compare_eth(router->addr, router_router->addr))) { | 1128 | batadv_dbg(DBG_BATMAN, bat_priv, |
1120 | bat_dbg(DBG_BATMAN, bat_priv, | 1129 | "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n", |
1121 | "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n", | 1130 | ethhdr->h_source); |
1122 | ethhdr->h_source); | ||
1123 | goto out; | 1131 | goto out; |
1124 | } | 1132 | } |
1125 | 1133 | ||
@@ -1138,8 +1146,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1138 | * don't route towards it | 1146 | * don't route towards it |
1139 | */ | 1147 | */ |
1140 | if (!is_single_hop_neigh && (!orig_neigh_router)) { | 1148 | if (!is_single_hop_neigh && (!orig_neigh_router)) { |
1141 | bat_dbg(DBG_BATMAN, bat_priv, | 1149 | batadv_dbg(DBG_BATMAN, bat_priv, |
1142 | "Drop packet: OGM via unknown neighbor!\n"); | 1150 | "Drop packet: OGM via unknown neighbor!\n"); |
1143 | goto out_neigh; | 1151 | goto out_neigh; |
1144 | } | 1152 | } |
1145 | 1153 | ||
@@ -1168,26 +1176,26 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1168 | is_single_hop_neigh, is_from_best_next_hop, | 1176 | is_single_hop_neigh, is_from_best_next_hop, |
1169 | if_incoming); | 1177 | if_incoming); |
1170 | 1178 | ||
1171 | bat_dbg(DBG_BATMAN, bat_priv, | 1179 | batadv_dbg(DBG_BATMAN, bat_priv, |
1172 | "Forwarding packet: rebroadcast neighbor packet with direct link flag\n"); | 1180 | "Forwarding packet: rebroadcast neighbor packet with direct link flag\n"); |
1173 | goto out_neigh; | 1181 | goto out_neigh; |
1174 | } | 1182 | } |
1175 | 1183 | ||
1176 | /* multihop originator */ | 1184 | /* multihop originator */ |
1177 | if (!is_bidirectional) { | 1185 | if (!is_bidirectional) { |
1178 | bat_dbg(DBG_BATMAN, bat_priv, | 1186 | batadv_dbg(DBG_BATMAN, bat_priv, |
1179 | "Drop packet: not received via bidirectional link\n"); | 1187 | "Drop packet: not received via bidirectional link\n"); |
1180 | goto out_neigh; | 1188 | goto out_neigh; |
1181 | } | 1189 | } |
1182 | 1190 | ||
1183 | if (is_duplicate) { | 1191 | if (is_duplicate) { |
1184 | bat_dbg(DBG_BATMAN, bat_priv, | 1192 | batadv_dbg(DBG_BATMAN, bat_priv, |
1185 | "Drop packet: duplicate packet received\n"); | 1193 | "Drop packet: duplicate packet received\n"); |
1186 | goto out_neigh; | 1194 | goto out_neigh; |
1187 | } | 1195 | } |
1188 | 1196 | ||
1189 | bat_dbg(DBG_BATMAN, bat_priv, | 1197 | batadv_dbg(DBG_BATMAN, bat_priv, |
1190 | "Forwarding packet: rebroadcast originator packet\n"); | 1198 | "Forwarding packet: rebroadcast originator packet\n"); |
1191 | bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, | 1199 | bat_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet, |
1192 | is_single_hop_neigh, is_from_best_next_hop, | 1200 | is_single_hop_neigh, is_from_best_next_hop, |
1193 | if_incoming); | 1201 | if_incoming); |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 0c7e22e4d5f3..7f464a9e9672 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -730,9 +730,9 @@ out: | |||
730 | batadv_hardif_free_ref(primary_if); | 730 | batadv_hardif_free_ref(primary_if); |
731 | 731 | ||
732 | if (ret) | 732 | if (ret) |
733 | bat_dbg(DBG_BATMAN, bat_priv, | 733 | batadv_dbg(DBG_BATMAN, bat_priv, |
734 | "Impossible to send uevent for (%s,%s,%s) event (err: %d)\n", | 734 | "Impossible to send uevent for (%s,%s,%s) event (err: %d)\n", |
735 | uev_type_str[type], uev_action_str[action], | 735 | uev_type_str[type], uev_action_str[action], |
736 | (action == UEV_DEL ? "NULL" : data), ret); | 736 | (action == UEV_DEL ? "NULL" : data), ret); |
737 | return ret; | 737 | return ret; |
738 | } | 738 | } |
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index 7a7065cc88cd..e195b9eed7ee 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c | |||
@@ -66,9 +66,9 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, | |||
66 | /* sequence number is much newer, probably missed a lot of packets */ | 66 | /* sequence number is much newer, probably missed a lot of packets */ |
67 | if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) && | 67 | if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) && |
68 | (seq_num_diff < EXPECTED_SEQNO_RANGE)) { | 68 | (seq_num_diff < EXPECTED_SEQNO_RANGE)) { |
69 | bat_dbg(DBG_BATMAN, bat_priv, | 69 | batadv_dbg(DBG_BATMAN, bat_priv, |
70 | "We missed a lot of packets (%i) !\n", | 70 | "We missed a lot of packets (%i) !\n", |
71 | seq_num_diff - 1); | 71 | seq_num_diff - 1); |
72 | bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE); | 72 | bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE); |
73 | if (set_mark) | 73 | if (set_mark) |
74 | batadv_set_bit(seq_bits, 0); | 74 | batadv_set_bit(seq_bits, 0); |
@@ -83,8 +83,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, | |||
83 | if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || | 83 | if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || |
84 | (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { | 84 | (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { |
85 | 85 | ||
86 | bat_dbg(DBG_BATMAN, bat_priv, | 86 | batadv_dbg(DBG_BATMAN, bat_priv, |
87 | "Other host probably restarted!\n"); | 87 | "Other host probably restarted!\n"); |
88 | 88 | ||
89 | bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE); | 89 | bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE); |
90 | if (set_mark) | 90 | if (set_mark) |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 1d143d5bb53e..b7d70845aa4a 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -294,25 +294,26 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
294 | * set Ethernet SRC to the clients mac | 294 | * set Ethernet SRC to the clients mac |
295 | */ | 295 | */ |
296 | memcpy(ethhdr->h_source, mac, ETH_ALEN); | 296 | memcpy(ethhdr->h_source, mac, ETH_ALEN); |
297 | bat_dbg(DBG_BLA, bat_priv, | 297 | batadv_dbg(DBG_BLA, bat_priv, |
298 | "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid); | 298 | "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid); |
299 | break; | 299 | break; |
300 | case CLAIM_TYPE_DEL: | 300 | case CLAIM_TYPE_DEL: |
301 | /* unclaim frame | 301 | /* unclaim frame |
302 | * set HW SRC to the clients mac | 302 | * set HW SRC to the clients mac |
303 | */ | 303 | */ |
304 | memcpy(hw_src, mac, ETH_ALEN); | 304 | memcpy(hw_src, mac, ETH_ALEN); |
305 | bat_dbg(DBG_BLA, bat_priv, | 305 | batadv_dbg(DBG_BLA, bat_priv, |
306 | "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, vid); | 306 | "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, |
307 | vid); | ||
307 | break; | 308 | break; |
308 | case CLAIM_TYPE_ANNOUNCE: | 309 | case CLAIM_TYPE_ANNOUNCE: |
309 | /* announcement frame | 310 | /* announcement frame |
310 | * set HW SRC to the special mac containg the crc | 311 | * set HW SRC to the special mac containg the crc |
311 | */ | 312 | */ |
312 | memcpy(hw_src, mac, ETH_ALEN); | 313 | memcpy(hw_src, mac, ETH_ALEN); |
313 | bat_dbg(DBG_BLA, bat_priv, | 314 | batadv_dbg(DBG_BLA, bat_priv, |
314 | "bla_send_claim(): ANNOUNCE of %pM on vid %d\n", | 315 | "bla_send_claim(): ANNOUNCE of %pM on vid %d\n", |
315 | ethhdr->h_source, vid); | 316 | ethhdr->h_source, vid); |
316 | break; | 317 | break; |
317 | case CLAIM_TYPE_REQUEST: | 318 | case CLAIM_TYPE_REQUEST: |
318 | /* request frame | 319 | /* request frame |
@@ -320,9 +321,9 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
320 | */ | 321 | */ |
321 | memcpy(hw_src, mac, ETH_ALEN); | 322 | memcpy(hw_src, mac, ETH_ALEN); |
322 | memcpy(ethhdr->h_dest, mac, ETH_ALEN); | 323 | memcpy(ethhdr->h_dest, mac, ETH_ALEN); |
323 | bat_dbg(DBG_BLA, bat_priv, | 324 | batadv_dbg(DBG_BLA, bat_priv, |
324 | "bla_send_claim(): REQUEST of %pM to %pMon vid %d\n", | 325 | "bla_send_claim(): REQUEST of %pM to %pMon vid %d\n", |
325 | ethhdr->h_source, ethhdr->h_dest, vid); | 326 | ethhdr->h_source, ethhdr->h_dest, vid); |
326 | break; | 327 | break; |
327 | 328 | ||
328 | } | 329 | } |
@@ -361,9 +362,9 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv, | |||
361 | if (entry) | 362 | if (entry) |
362 | return entry; | 363 | return entry; |
363 | 364 | ||
364 | bat_dbg(DBG_BLA, bat_priv, | 365 | batadv_dbg(DBG_BLA, bat_priv, |
365 | "bla_get_backbone_gw(): not found (%pM, %d), creating new entry\n", | 366 | "bla_get_backbone_gw(): not found (%pM, %d), creating new entry\n", |
366 | orig, vid); | 367 | orig, vid); |
367 | 368 | ||
368 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); | 369 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); |
369 | if (!entry) | 370 | if (!entry) |
@@ -433,8 +434,8 @@ static void bla_answer_request(struct bat_priv *bat_priv, | |||
433 | struct backbone_gw *backbone_gw; | 434 | struct backbone_gw *backbone_gw; |
434 | int i; | 435 | int i; |
435 | 436 | ||
436 | bat_dbg(DBG_BLA, bat_priv, | 437 | batadv_dbg(DBG_BLA, bat_priv, |
437 | "bla_answer_request(): received a claim request, send all of our own claims again\n"); | 438 | "bla_answer_request(): received a claim request, send all of our own claims again\n"); |
438 | 439 | ||
439 | backbone_gw = backbone_hash_find(bat_priv, | 440 | backbone_gw = backbone_hash_find(bat_priv, |
440 | primary_if->net_dev->dev_addr, vid); | 441 | primary_if->net_dev->dev_addr, vid); |
@@ -473,9 +474,8 @@ static void bla_send_request(struct backbone_gw *backbone_gw) | |||
473 | /* first, remove all old entries */ | 474 | /* first, remove all old entries */ |
474 | bla_del_backbone_claims(backbone_gw); | 475 | bla_del_backbone_claims(backbone_gw); |
475 | 476 | ||
476 | bat_dbg(DBG_BLA, backbone_gw->bat_priv, | 477 | batadv_dbg(DBG_BLA, backbone_gw->bat_priv, "Sending REQUEST to %pM\n", |
477 | "Sending REQUEST to %pM\n", | 478 | backbone_gw->orig); |
478 | backbone_gw->orig); | ||
479 | 479 | ||
480 | /* send request */ | 480 | /* send request */ |
481 | bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, | 481 | bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, |
@@ -538,9 +538,9 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, | |||
538 | claim->backbone_gw = backbone_gw; | 538 | claim->backbone_gw = backbone_gw; |
539 | 539 | ||
540 | atomic_set(&claim->refcount, 2); | 540 | atomic_set(&claim->refcount, 2); |
541 | bat_dbg(DBG_BLA, bat_priv, | 541 | batadv_dbg(DBG_BLA, bat_priv, |
542 | "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", | 542 | "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", |
543 | mac, vid); | 543 | mac, vid); |
544 | hash_added = batadv_hash_add(bat_priv->claim_hash, | 544 | hash_added = batadv_hash_add(bat_priv->claim_hash, |
545 | compare_claim, choose_claim, | 545 | compare_claim, choose_claim, |
546 | claim, &claim->hash_entry); | 546 | claim, &claim->hash_entry); |
@@ -556,9 +556,9 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, | |||
556 | /* no need to register a new backbone */ | 556 | /* no need to register a new backbone */ |
557 | goto claim_free_ref; | 557 | goto claim_free_ref; |
558 | 558 | ||
559 | bat_dbg(DBG_BLA, bat_priv, | 559 | batadv_dbg(DBG_BLA, bat_priv, |
560 | "bla_add_claim(): changing ownership for %pM, vid %d\n", | 560 | "bla_add_claim(): changing ownership for %pM, vid %d\n", |
561 | mac, vid); | 561 | mac, vid); |
562 | 562 | ||
563 | claim->backbone_gw->crc ^= | 563 | claim->backbone_gw->crc ^= |
564 | crc16(0, claim->addr, ETH_ALEN); | 564 | crc16(0, claim->addr, ETH_ALEN); |
@@ -590,7 +590,8 @@ static void bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac, | |||
590 | if (!claim) | 590 | if (!claim) |
591 | return; | 591 | return; |
592 | 592 | ||
593 | bat_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac, vid); | 593 | batadv_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac, |
594 | vid); | ||
594 | 595 | ||
595 | batadv_hash_remove(bat_priv->claim_hash, compare_claim, choose_claim, | 596 | batadv_hash_remove(bat_priv->claim_hash, compare_claim, choose_claim, |
596 | claim); | 597 | claim); |
@@ -622,15 +623,15 @@ static int handle_announce(struct bat_priv *bat_priv, | |||
622 | backbone_gw->lasttime = jiffies; | 623 | backbone_gw->lasttime = jiffies; |
623 | crc = ntohs(*((__be16 *)(&an_addr[4]))); | 624 | crc = ntohs(*((__be16 *)(&an_addr[4]))); |
624 | 625 | ||
625 | bat_dbg(DBG_BLA, bat_priv, | 626 | batadv_dbg(DBG_BLA, bat_priv, |
626 | "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %04x\n", | 627 | "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %04x\n", |
627 | vid, backbone_gw->orig, crc); | 628 | vid, backbone_gw->orig, crc); |
628 | 629 | ||
629 | if (backbone_gw->crc != crc) { | 630 | if (backbone_gw->crc != crc) { |
630 | bat_dbg(DBG_BLA, backbone_gw->bat_priv, | 631 | batadv_dbg(DBG_BLA, backbone_gw->bat_priv, |
631 | "handle_announce(): CRC FAILED for %pM/%d (my = %04x, sent = %04x)\n", | 632 | "handle_announce(): CRC FAILED for %pM/%d (my = %04x, sent = %04x)\n", |
632 | backbone_gw->orig, backbone_gw->vid, backbone_gw->crc, | 633 | backbone_gw->orig, backbone_gw->vid, |
633 | crc); | 634 | backbone_gw->crc, crc); |
634 | 635 | ||
635 | bla_send_request(backbone_gw); | 636 | bla_send_request(backbone_gw); |
636 | } else { | 637 | } else { |
@@ -654,18 +655,18 @@ static int handle_request(struct bat_priv *bat_priv, | |||
654 | struct ethhdr *ethhdr, short vid) | 655 | struct ethhdr *ethhdr, short vid) |
655 | { | 656 | { |
656 | /* check for REQUEST frame */ | 657 | /* check for REQUEST frame */ |
657 | if (!compare_eth(backbone_addr, ethhdr->h_dest)) | 658 | if (!batadv_compare_eth(backbone_addr, ethhdr->h_dest)) |
658 | return 0; | 659 | return 0; |
659 | 660 | ||
660 | /* sanity check, this should not happen on a normal switch, | 661 | /* sanity check, this should not happen on a normal switch, |
661 | * we ignore it in this case. | 662 | * we ignore it in this case. |
662 | */ | 663 | */ |
663 | if (!compare_eth(ethhdr->h_dest, primary_if->net_dev->dev_addr)) | 664 | if (!batadv_compare_eth(ethhdr->h_dest, primary_if->net_dev->dev_addr)) |
664 | return 1; | 665 | return 1; |
665 | 666 | ||
666 | bat_dbg(DBG_BLA, bat_priv, | 667 | batadv_dbg(DBG_BLA, bat_priv, |
667 | "handle_request(): REQUEST vid %d (sent by %pM)...\n", | 668 | "handle_request(): REQUEST vid %d (sent by %pM)...\n", |
668 | vid, ethhdr->h_source); | 669 | vid, ethhdr->h_source); |
669 | 670 | ||
670 | bla_answer_request(bat_priv, primary_if, vid); | 671 | bla_answer_request(bat_priv, primary_if, vid); |
671 | return 1; | 672 | return 1; |
@@ -680,8 +681,8 @@ static int handle_unclaim(struct bat_priv *bat_priv, | |||
680 | struct backbone_gw *backbone_gw; | 681 | struct backbone_gw *backbone_gw; |
681 | 682 | ||
682 | /* unclaim in any case if it is our own */ | 683 | /* unclaim in any case if it is our own */ |
683 | if (primary_if && compare_eth(backbone_addr, | 684 | if (primary_if && batadv_compare_eth(backbone_addr, |
684 | primary_if->net_dev->dev_addr)) | 685 | primary_if->net_dev->dev_addr)) |
685 | bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_DEL); | 686 | bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_DEL); |
686 | 687 | ||
687 | backbone_gw = backbone_hash_find(bat_priv, backbone_addr, vid); | 688 | backbone_gw = backbone_hash_find(bat_priv, backbone_addr, vid); |
@@ -690,9 +691,9 @@ static int handle_unclaim(struct bat_priv *bat_priv, | |||
690 | return 1; | 691 | return 1; |
691 | 692 | ||
692 | /* this must be an UNCLAIM frame */ | 693 | /* this must be an UNCLAIM frame */ |
693 | bat_dbg(DBG_BLA, bat_priv, | 694 | batadv_dbg(DBG_BLA, bat_priv, |
694 | "handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n", | 695 | "handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n", |
695 | claim_addr, vid, backbone_gw->orig); | 696 | claim_addr, vid, backbone_gw->orig); |
696 | 697 | ||
697 | bla_del_claim(bat_priv, claim_addr, vid); | 698 | bla_del_claim(bat_priv, claim_addr, vid); |
698 | backbone_gw_free_ref(backbone_gw); | 699 | backbone_gw_free_ref(backbone_gw); |
@@ -715,7 +716,7 @@ static int handle_claim(struct bat_priv *bat_priv, | |||
715 | 716 | ||
716 | /* this must be a CLAIM frame */ | 717 | /* this must be a CLAIM frame */ |
717 | bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); | 718 | bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); |
718 | if (compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) | 719 | if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) |
719 | bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_ADD); | 720 | bla_send_claim(bat_priv, claim_addr, vid, CLAIM_TYPE_ADD); |
720 | 721 | ||
721 | /* TODO: we could call something like tt_local_del() here. */ | 722 | /* TODO: we could call something like tt_local_del() here. */ |
@@ -772,7 +773,7 @@ static int check_claim_group(struct bat_priv *bat_priv, | |||
772 | } | 773 | } |
773 | 774 | ||
774 | /* don't accept claim frames from ourselves */ | 775 | /* don't accept claim frames from ourselves */ |
775 | if (compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) | 776 | if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) |
776 | return 0; | 777 | return 0; |
777 | 778 | ||
778 | /* if its already the same group, it is fine. */ | 779 | /* if its already the same group, it is fine. */ |
@@ -790,9 +791,9 @@ static int check_claim_group(struct bat_priv *bat_priv, | |||
790 | 791 | ||
791 | /* if our mesh friends mac is bigger, use it for ourselves. */ | 792 | /* if our mesh friends mac is bigger, use it for ourselves. */ |
792 | if (ntohs(bla_dst->group) > ntohs(bla_dst_own->group)) { | 793 | if (ntohs(bla_dst->group) > ntohs(bla_dst_own->group)) { |
793 | bat_dbg(DBG_BLA, bat_priv, | 794 | batadv_dbg(DBG_BLA, bat_priv, |
794 | "taking other backbones claim group: %04x\n", | 795 | "taking other backbones claim group: %04x\n", |
795 | ntohs(bla_dst->group)); | 796 | ntohs(bla_dst->group)); |
796 | bla_dst_own->group = bla_dst->group; | 797 | bla_dst_own->group = bla_dst->group; |
797 | } | 798 | } |
798 | 799 | ||
@@ -867,9 +868,9 @@ static int bla_process_claim(struct bat_priv *bat_priv, | |||
867 | /* check if it is a claim frame. */ | 868 | /* check if it is a claim frame. */ |
868 | ret = check_claim_group(bat_priv, primary_if, hw_src, hw_dst, ethhdr); | 869 | ret = check_claim_group(bat_priv, primary_if, hw_src, hw_dst, ethhdr); |
869 | if (ret == 1) | 870 | if (ret == 1) |
870 | bat_dbg(DBG_BLA, bat_priv, | 871 | batadv_dbg(DBG_BLA, bat_priv, |
871 | "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", | 872 | "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", |
872 | ethhdr->h_source, vid, hw_src, hw_dst); | 873 | ethhdr->h_source, vid, hw_src, hw_dst); |
873 | 874 | ||
874 | if (ret < 2) | 875 | if (ret < 2) |
875 | return ret; | 876 | return ret; |
@@ -900,9 +901,9 @@ static int bla_process_claim(struct bat_priv *bat_priv, | |||
900 | break; | 901 | break; |
901 | } | 902 | } |
902 | 903 | ||
903 | bat_dbg(DBG_BLA, bat_priv, | 904 | batadv_dbg(DBG_BLA, bat_priv, |
904 | "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", | 905 | "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", |
905 | ethhdr->h_source, vid, hw_src, hw_dst); | 906 | ethhdr->h_source, vid, hw_src, hw_dst); |
906 | return 1; | 907 | return 1; |
907 | } | 908 | } |
908 | 909 | ||
@@ -931,13 +932,13 @@ static void bla_purge_backbone_gw(struct bat_priv *bat_priv, int now) | |||
931 | head, hash_entry) { | 932 | head, hash_entry) { |
932 | if (now) | 933 | if (now) |
933 | goto purge_now; | 934 | goto purge_now; |
934 | if (!has_timed_out(backbone_gw->lasttime, | 935 | if (!batadv_has_timed_out(backbone_gw->lasttime, |
935 | BLA_BACKBONE_TIMEOUT)) | 936 | BLA_BACKBONE_TIMEOUT)) |
936 | continue; | 937 | continue; |
937 | 938 | ||
938 | bat_dbg(DBG_BLA, backbone_gw->bat_priv, | 939 | batadv_dbg(DBG_BLA, backbone_gw->bat_priv, |
939 | "bla_purge_backbone_gw(): backbone gw %pM timed out\n", | 940 | "bla_purge_backbone_gw(): backbone gw %pM timed out\n", |
940 | backbone_gw->orig); | 941 | backbone_gw->orig); |
941 | 942 | ||
942 | purge_now: | 943 | purge_now: |
943 | /* don't wait for the pending request anymore */ | 944 | /* don't wait for the pending request anymore */ |
@@ -980,16 +981,16 @@ static void bla_purge_claims(struct bat_priv *bat_priv, | |||
980 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { | 981 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { |
981 | if (now) | 982 | if (now) |
982 | goto purge_now; | 983 | goto purge_now; |
983 | if (!compare_eth(claim->backbone_gw->orig, | 984 | if (!batadv_compare_eth(claim->backbone_gw->orig, |
984 | primary_if->net_dev->dev_addr)) | 985 | primary_if->net_dev->dev_addr)) |
985 | continue; | 986 | continue; |
986 | if (!has_timed_out(claim->lasttime, | 987 | if (!batadv_has_timed_out(claim->lasttime, |
987 | BLA_CLAIM_TIMEOUT)) | 988 | BLA_CLAIM_TIMEOUT)) |
988 | continue; | 989 | continue; |
989 | 990 | ||
990 | bat_dbg(DBG_BLA, bat_priv, | 991 | batadv_dbg(DBG_BLA, bat_priv, |
991 | "bla_purge_claims(): %pM, vid %d, time out\n", | 992 | "bla_purge_claims(): %pM, vid %d, time out\n", |
992 | claim->addr, claim->vid); | 993 | claim->addr, claim->vid); |
993 | 994 | ||
994 | purge_now: | 995 | purge_now: |
995 | handle_unclaim(bat_priv, primary_if, | 996 | handle_unclaim(bat_priv, primary_if, |
@@ -1036,8 +1037,8 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv, | |||
1036 | rcu_read_lock(); | 1037 | rcu_read_lock(); |
1037 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 1038 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { |
1038 | /* own orig still holds the old value. */ | 1039 | /* own orig still holds the old value. */ |
1039 | if (!compare_eth(backbone_gw->orig, | 1040 | if (!batadv_compare_eth(backbone_gw->orig, |
1040 | oldif->net_dev->dev_addr)) | 1041 | oldif->net_dev->dev_addr)) |
1041 | continue; | 1042 | continue; |
1042 | 1043 | ||
1043 | memcpy(backbone_gw->orig, | 1044 | memcpy(backbone_gw->orig, |
@@ -1097,8 +1098,8 @@ static void bla_periodic_work(struct work_struct *work) | |||
1097 | 1098 | ||
1098 | rcu_read_lock(); | 1099 | rcu_read_lock(); |
1099 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 1100 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { |
1100 | if (!compare_eth(backbone_gw->orig, | 1101 | if (!batadv_compare_eth(backbone_gw->orig, |
1101 | primary_if->net_dev->dev_addr)) | 1102 | primary_if->net_dev->dev_addr)) |
1102 | continue; | 1103 | continue; |
1103 | 1104 | ||
1104 | backbone_gw->lasttime = jiffies; | 1105 | backbone_gw->lasttime = jiffies; |
@@ -1129,7 +1130,7 @@ int batadv_bla_init(struct bat_priv *bat_priv) | |||
1129 | uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00}; | 1130 | uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00}; |
1130 | struct hard_iface *primary_if; | 1131 | struct hard_iface *primary_if; |
1131 | 1132 | ||
1132 | bat_dbg(DBG_BLA, bat_priv, "bla hash registering\n"); | 1133 | batadv_dbg(DBG_BLA, bat_priv, "bla hash registering\n"); |
1133 | 1134 | ||
1134 | /* setting claim destination address */ | 1135 | /* setting claim destination address */ |
1135 | memcpy(&bat_priv->claim_dest.magic, claim_dest, 3); | 1136 | memcpy(&bat_priv->claim_dest.magic, claim_dest, 3); |
@@ -1164,7 +1165,7 @@ int batadv_bla_init(struct bat_priv *bat_priv) | |||
1164 | batadv_hash_set_lock_class(bat_priv->backbone_hash, | 1165 | batadv_hash_set_lock_class(bat_priv->backbone_hash, |
1165 | &backbone_hash_lock_class_key); | 1166 | &backbone_hash_lock_class_key); |
1166 | 1167 | ||
1167 | bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n"); | 1168 | batadv_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n"); |
1168 | 1169 | ||
1169 | bla_start_timer(bat_priv); | 1170 | bla_start_timer(bat_priv); |
1170 | return 0; | 1171 | return 0; |
@@ -1206,13 +1207,13 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv, | |||
1206 | /* we can stop searching if the entry is too old ; | 1207 | /* we can stop searching if the entry is too old ; |
1207 | * later entries will be even older | 1208 | * later entries will be even older |
1208 | */ | 1209 | */ |
1209 | if (has_timed_out(entry->entrytime, DUPLIST_TIMEOUT)) | 1210 | if (batadv_has_timed_out(entry->entrytime, DUPLIST_TIMEOUT)) |
1210 | break; | 1211 | break; |
1211 | 1212 | ||
1212 | if (entry->crc != crc) | 1213 | if (entry->crc != crc) |
1213 | continue; | 1214 | continue; |
1214 | 1215 | ||
1215 | if (compare_eth(entry->orig, bcast_packet->orig)) | 1216 | if (batadv_compare_eth(entry->orig, bcast_packet->orig)) |
1216 | continue; | 1217 | continue; |
1217 | 1218 | ||
1218 | /* this entry seems to match: same crc, not too old, | 1219 | /* this entry seems to match: same crc, not too old, |
@@ -1260,7 +1261,7 @@ int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig) | |||
1260 | 1261 | ||
1261 | rcu_read_lock(); | 1262 | rcu_read_lock(); |
1262 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { | 1263 | hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) { |
1263 | if (compare_eth(backbone_gw->orig, orig)) { | 1264 | if (batadv_compare_eth(backbone_gw->orig, orig)) { |
1264 | rcu_read_unlock(); | 1265 | rcu_read_unlock(); |
1265 | return 1; | 1266 | return 1; |
1266 | } | 1267 | } |
@@ -1387,8 +1388,8 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1387 | } | 1388 | } |
1388 | 1389 | ||
1389 | /* if it is our own claim ... */ | 1390 | /* if it is our own claim ... */ |
1390 | if (compare_eth(claim->backbone_gw->orig, | 1391 | if (batadv_compare_eth(claim->backbone_gw->orig, |
1391 | primary_if->net_dev->dev_addr)) { | 1392 | primary_if->net_dev->dev_addr)) { |
1392 | /* ... allow it in any case */ | 1393 | /* ... allow it in any case */ |
1393 | claim->lasttime = jiffies; | 1394 | claim->lasttime = jiffies; |
1394 | goto allow; | 1395 | goto allow; |
@@ -1474,8 +1475,8 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) | |||
1474 | goto allow; | 1475 | goto allow; |
1475 | 1476 | ||
1476 | /* check if we are responsible. */ | 1477 | /* check if we are responsible. */ |
1477 | if (compare_eth(claim->backbone_gw->orig, | 1478 | if (batadv_compare_eth(claim->backbone_gw->orig, |
1478 | primary_if->net_dev->dev_addr)) { | 1479 | primary_if->net_dev->dev_addr)) { |
1479 | /* if yes, the client has roamed and we have | 1480 | /* if yes, the client has roamed and we have |
1480 | * to unclaim it. | 1481 | * to unclaim it. |
1481 | */ | 1482 | */ |
@@ -1523,6 +1524,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) | |||
1523 | uint32_t i; | 1524 | uint32_t i; |
1524 | bool is_own; | 1525 | bool is_own; |
1525 | int ret = 0; | 1526 | int ret = 0; |
1527 | uint8_t *primary_addr; | ||
1526 | 1528 | ||
1527 | primary_if = batadv_primary_if_get_selected(bat_priv); | 1529 | primary_if = batadv_primary_if_get_selected(bat_priv); |
1528 | if (!primary_if) { | 1530 | if (!primary_if) { |
@@ -1539,9 +1541,10 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) | |||
1539 | goto out; | 1541 | goto out; |
1540 | } | 1542 | } |
1541 | 1543 | ||
1544 | primary_addr = primary_if->net_dev->dev_addr; | ||
1542 | seq_printf(seq, | 1545 | seq_printf(seq, |
1543 | "Claims announced for the mesh %s (orig %pM, group id %04x)\n", | 1546 | "Claims announced for the mesh %s (orig %pM, group id %04x)\n", |
1544 | net_dev->name, primary_if->net_dev->dev_addr, | 1547 | net_dev->name, primary_addr, |
1545 | ntohs(bat_priv->claim_dest.group)); | 1548 | ntohs(bat_priv->claim_dest.group)); |
1546 | seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n", | 1549 | seq_printf(seq, " %-17s %-5s %-17s [o] (%-4s)\n", |
1547 | "Client", "VID", "Originator", "CRC"); | 1550 | "Client", "VID", "Originator", "CRC"); |
@@ -1550,8 +1553,8 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) | |||
1550 | 1553 | ||
1551 | rcu_read_lock(); | 1554 | rcu_read_lock(); |
1552 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { | 1555 | hlist_for_each_entry_rcu(claim, node, head, hash_entry) { |
1553 | is_own = compare_eth(claim->backbone_gw->orig, | 1556 | is_own = batadv_compare_eth(claim->backbone_gw->orig, |
1554 | primary_if->net_dev->dev_addr); | 1557 | primary_addr); |
1555 | seq_printf(seq, " * %pM on % 5d by %pM [%c] (%04x)\n", | 1558 | seq_printf(seq, " * %pM on % 5d by %pM [%c] (%04x)\n", |
1556 | claim->addr, claim->vid, | 1559 | claim->addr, claim->vid, |
1557 | claim->backbone_gw->orig, | 1560 | claim->backbone_gw->orig, |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index c917a2ee1f39..318c112aa98c 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -217,20 +217,20 @@ void batadv_gw_election(struct bat_priv *bat_priv) | |||
217 | } | 217 | } |
218 | 218 | ||
219 | if ((curr_gw) && (!next_gw)) { | 219 | if ((curr_gw) && (!next_gw)) { |
220 | bat_dbg(DBG_BATMAN, bat_priv, | 220 | batadv_dbg(DBG_BATMAN, bat_priv, |
221 | "Removing selected gateway - no gateway in range\n"); | 221 | "Removing selected gateway - no gateway in range\n"); |
222 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_DEL, NULL); | 222 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_DEL, NULL); |
223 | } else if ((!curr_gw) && (next_gw)) { | 223 | } else if ((!curr_gw) && (next_gw)) { |
224 | bat_dbg(DBG_BATMAN, bat_priv, | 224 | batadv_dbg(DBG_BATMAN, bat_priv, |
225 | "Adding route to gateway %pM (gw_flags: %i, tq: %i)\n", | 225 | "Adding route to gateway %pM (gw_flags: %i, tq: %i)\n", |
226 | next_gw->orig_node->orig, next_gw->orig_node->gw_flags, | 226 | next_gw->orig_node->orig, |
227 | router->tq_avg); | 227 | next_gw->orig_node->gw_flags, router->tq_avg); |
228 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_ADD, gw_addr); | 228 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_ADD, gw_addr); |
229 | } else { | 229 | } else { |
230 | bat_dbg(DBG_BATMAN, bat_priv, | 230 | batadv_dbg(DBG_BATMAN, bat_priv, |
231 | "Changing route to gateway %pM (gw_flags: %i, tq: %i)\n", | 231 | "Changing route to gateway %pM (gw_flags: %i, tq: %i)\n", |
232 | next_gw->orig_node->orig, next_gw->orig_node->gw_flags, | 232 | next_gw->orig_node->orig, |
233 | router->tq_avg); | 233 | next_gw->orig_node->gw_flags, router->tq_avg); |
234 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr); | 234 | batadv_throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr); |
235 | } | 235 | } |
236 | 236 | ||
@@ -282,9 +282,9 @@ void batadv_gw_check_election(struct bat_priv *bat_priv, | |||
282 | (orig_tq_avg - gw_tq_avg < atomic_read(&bat_priv->gw_sel_class))) | 282 | (orig_tq_avg - gw_tq_avg < atomic_read(&bat_priv->gw_sel_class))) |
283 | goto out; | 283 | goto out; |
284 | 284 | ||
285 | bat_dbg(DBG_BATMAN, bat_priv, | 285 | batadv_dbg(DBG_BATMAN, bat_priv, |
286 | "Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i)\n", | 286 | "Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i)\n", |
287 | gw_tq_avg, orig_tq_avg); | 287 | gw_tq_avg, orig_tq_avg); |
288 | 288 | ||
289 | deselect: | 289 | deselect: |
290 | batadv_gw_deselect(bat_priv); | 290 | batadv_gw_deselect(bat_priv); |
@@ -318,13 +318,13 @@ static void gw_node_add(struct bat_priv *bat_priv, | |||
318 | spin_unlock_bh(&bat_priv->gw_list_lock); | 318 | spin_unlock_bh(&bat_priv->gw_list_lock); |
319 | 319 | ||
320 | batadv_gw_bandwidth_to_kbit(new_gwflags, &down, &up); | 320 | batadv_gw_bandwidth_to_kbit(new_gwflags, &down, &up); |
321 | bat_dbg(DBG_BATMAN, bat_priv, | 321 | batadv_dbg(DBG_BATMAN, bat_priv, |
322 | "Found new gateway %pM -> gw_class: %i - %i%s/%i%s\n", | 322 | "Found new gateway %pM -> gw_class: %i - %i%s/%i%s\n", |
323 | orig_node->orig, new_gwflags, | 323 | orig_node->orig, new_gwflags, |
324 | (down > 2048 ? down / 1024 : down), | 324 | (down > 2048 ? down / 1024 : down), |
325 | (down > 2048 ? "MBit" : "KBit"), | 325 | (down > 2048 ? "MBit" : "KBit"), |
326 | (up > 2048 ? up / 1024 : up), | 326 | (up > 2048 ? up / 1024 : up), |
327 | (up > 2048 ? "MBit" : "KBit")); | 327 | (up > 2048 ? "MBit" : "KBit")); |
328 | } | 328 | } |
329 | 329 | ||
330 | void batadv_gw_node_update(struct bat_priv *bat_priv, | 330 | void batadv_gw_node_update(struct bat_priv *bat_priv, |
@@ -345,18 +345,18 @@ void batadv_gw_node_update(struct bat_priv *bat_priv, | |||
345 | if (gw_node->orig_node != orig_node) | 345 | if (gw_node->orig_node != orig_node) |
346 | continue; | 346 | continue; |
347 | 347 | ||
348 | bat_dbg(DBG_BATMAN, bat_priv, | 348 | batadv_dbg(DBG_BATMAN, bat_priv, |
349 | "Gateway class of originator %pM changed from %i to %i\n", | 349 | "Gateway class of originator %pM changed from %i to %i\n", |
350 | orig_node->orig, gw_node->orig_node->gw_flags, | 350 | orig_node->orig, gw_node->orig_node->gw_flags, |
351 | new_gwflags); | 351 | new_gwflags); |
352 | 352 | ||
353 | gw_node->deleted = 0; | 353 | gw_node->deleted = 0; |
354 | 354 | ||
355 | if (new_gwflags == NO_FLAGS) { | 355 | if (new_gwflags == NO_FLAGS) { |
356 | gw_node->deleted = jiffies; | 356 | gw_node->deleted = jiffies; |
357 | bat_dbg(DBG_BATMAN, bat_priv, | 357 | batadv_dbg(DBG_BATMAN, bat_priv, |
358 | "Gateway %pM removed from gateway list\n", | 358 | "Gateway %pM removed from gateway list\n", |
359 | orig_node->orig); | 359 | orig_node->orig); |
360 | 360 | ||
361 | if (gw_node == curr_gw) | 361 | if (gw_node == curr_gw) |
362 | goto deselect; | 362 | goto deselect; |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 06f8d63d741d..6131d932b638 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -163,8 +163,8 @@ static void check_known_mac_addr(const struct net_device *net_dev) | |||
163 | if (hard_iface->net_dev == net_dev) | 163 | if (hard_iface->net_dev == net_dev) |
164 | continue; | 164 | continue; |
165 | 165 | ||
166 | if (!compare_eth(hard_iface->net_dev->dev_addr, | 166 | if (!batadv_compare_eth(hard_iface->net_dev->dev_addr, |
167 | net_dev->dev_addr)) | 167 | net_dev->dev_addr)) |
168 | continue; | 168 | continue; |
169 | 169 | ||
170 | pr_warn("The newly added mac address (%pM) already exists on: %s\n", | 170 | pr_warn("The newly added mac address (%pM) already exists on: %s\n", |
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 50a74dadb4d6..a3e80b6782af 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -158,8 +158,8 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, | |||
158 | size_t packet_len = sizeof(struct icmp_packet); | 158 | size_t packet_len = sizeof(struct icmp_packet); |
159 | 159 | ||
160 | if (len < sizeof(struct icmp_packet)) { | 160 | if (len < sizeof(struct icmp_packet)) { |
161 | bat_dbg(DBG_BATMAN, bat_priv, | 161 | batadv_dbg(DBG_BATMAN, bat_priv, |
162 | "Error - can't send packet from char device: invalid packet size\n"); | 162 | "Error - can't send packet from char device: invalid packet size\n"); |
163 | return -EINVAL; | 163 | return -EINVAL; |
164 | } | 164 | } |
165 | 165 | ||
@@ -188,15 +188,15 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, | |||
188 | } | 188 | } |
189 | 189 | ||
190 | if (icmp_packet->header.packet_type != BAT_ICMP) { | 190 | if (icmp_packet->header.packet_type != BAT_ICMP) { |
191 | bat_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 != ECHO_REQUEST) { |
198 | bat_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; |
201 | goto free_skb; | 201 | goto free_skb; |
202 | } | 202 | } |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index d56d6b2e1924..e4564306453c 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -180,7 +180,7 @@ int batadv_is_my_mac(const uint8_t *addr) | |||
180 | if (hard_iface->if_status != IF_ACTIVE) | 180 | if (hard_iface->if_status != IF_ACTIVE) |
181 | continue; | 181 | continue; |
182 | 182 | ||
183 | if (compare_eth(hard_iface->net_dev->dev_addr, addr)) { | 183 | if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) { |
184 | rcu_read_unlock(); | 184 | rcu_read_unlock(); |
185 | return 1; | 185 | return 1; |
186 | } | 186 | } |
@@ -238,9 +238,9 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
238 | batman_ogm_packet = (struct batman_ogm_packet *)skb->data; | 238 | batman_ogm_packet = (struct batman_ogm_packet *)skb->data; |
239 | 239 | ||
240 | if (batman_ogm_packet->header.version != COMPAT_VERSION) { | 240 | if (batman_ogm_packet->header.version != COMPAT_VERSION) { |
241 | bat_dbg(DBG_BATMAN, bat_priv, | 241 | batadv_dbg(DBG_BATMAN, bat_priv, |
242 | "Drop packet: incompatible batman version (%i)\n", | 242 | "Drop packet: incompatible batman version (%i)\n", |
243 | batman_ogm_packet->header.version); | 243 | batman_ogm_packet->header.version); |
244 | goto err_free; | 244 | goto err_free; |
245 | } | 245 | } |
246 | 246 | ||
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 4b06b7621e7a..28242642c3f1 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -175,7 +175,7 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset); | |||
175 | int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...) | 175 | int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...) |
176 | __printf(2, 3); | 176 | __printf(2, 3); |
177 | 177 | ||
178 | #define bat_dbg(type, bat_priv, fmt, arg...) \ | 178 | #define batadv_dbg(type, bat_priv, fmt, arg...) \ |
179 | do { \ | 179 | do { \ |
180 | if (atomic_read(&bat_priv->log_level) & type) \ | 180 | if (atomic_read(&bat_priv->log_level) & type) \ |
181 | batadv_debug_log(bat_priv, fmt, ## arg);\ | 181 | batadv_debug_log(bat_priv, fmt, ## arg);\ |
@@ -183,9 +183,9 @@ __printf(2, 3); | |||
183 | while (0) | 183 | while (0) |
184 | #else /* !CONFIG_BATMAN_ADV_DEBUG */ | 184 | #else /* !CONFIG_BATMAN_ADV_DEBUG */ |
185 | __printf(3, 4) | 185 | __printf(3, 4) |
186 | static inline void bat_dbg(int type __always_unused, | 186 | static inline void batadv_dbg(int type __always_unused, |
187 | struct bat_priv *bat_priv __always_unused, | 187 | struct bat_priv *bat_priv __always_unused, |
188 | const char *fmt __always_unused, ...) | 188 | const char *fmt __always_unused, ...) |
189 | { | 189 | { |
190 | } | 190 | } |
191 | #endif | 191 | #endif |
@@ -194,14 +194,14 @@ static inline void bat_dbg(int type __always_unused, | |||
194 | do { \ | 194 | do { \ |
195 | struct net_device *_netdev = (net_dev); \ | 195 | struct net_device *_netdev = (net_dev); \ |
196 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ | 196 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ |
197 | bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ | 197 | batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ |
198 | pr_info("%s: " fmt, _netdev->name, ## arg); \ | 198 | pr_info("%s: " fmt, _netdev->name, ## arg); \ |
199 | } while (0) | 199 | } while (0) |
200 | #define bat_err(net_dev, fmt, arg...) \ | 200 | #define bat_err(net_dev, fmt, arg...) \ |
201 | do { \ | 201 | do { \ |
202 | struct net_device *_netdev = (net_dev); \ | 202 | struct net_device *_netdev = (net_dev); \ |
203 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ | 203 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ |
204 | bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ | 204 | batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ |
205 | pr_err("%s: " fmt, _netdev->name, ## arg); \ | 205 | pr_err("%s: " fmt, _netdev->name, ## arg); \ |
206 | } while (0) | 206 | } while (0) |
207 | 207 | ||
@@ -209,7 +209,7 @@ static inline void bat_dbg(int type __always_unused, | |||
209 | * | 209 | * |
210 | * note: can't use compare_ether_addr() as it requires aligned memory | 210 | * note: can't use compare_ether_addr() as it requires aligned memory |
211 | */ | 211 | */ |
212 | static inline int compare_eth(const void *data1, const void *data2) | 212 | static inline int batadv_compare_eth(const void *data1, const void *data2) |
213 | { | 213 | { |
214 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 214 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
215 | } | 215 | } |
@@ -220,7 +220,8 @@ static inline int compare_eth(const void *data1, const void *data2) | |||
220 | * | 220 | * |
221 | * Returns true if current time is after timestamp + timeout | 221 | * Returns true if current time is after timestamp + timeout |
222 | */ | 222 | */ |
223 | static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout) | 223 | static inline bool batadv_has_timed_out(unsigned long timestamp, |
224 | unsigned int timeout) | ||
224 | { | 225 | { |
225 | return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); | 226 | return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); |
226 | } | 227 | } |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 36f5ee5cd195..1cd640e8dab9 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -102,9 +102,9 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface, | |||
102 | /* extra reference for return */ | 102 | /* extra reference for return */ |
103 | atomic_set(&neigh_node->refcount, 2); | 103 | atomic_set(&neigh_node->refcount, 2); |
104 | 104 | ||
105 | bat_dbg(DBG_BATMAN, bat_priv, | 105 | batadv_dbg(DBG_BATMAN, bat_priv, |
106 | "Creating new neighbor %pM, initial seqno %d\n", | 106 | "Creating new neighbor %pM, initial seqno %d\n", |
107 | neigh_addr, seqno); | 107 | neigh_addr, seqno); |
108 | 108 | ||
109 | out: | 109 | out: |
110 | return neigh_node; | 110 | return neigh_node; |
@@ -199,8 +199,8 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv, | |||
199 | if (orig_node) | 199 | if (orig_node) |
200 | return orig_node; | 200 | return orig_node; |
201 | 201 | ||
202 | bat_dbg(DBG_BATMAN, bat_priv, | 202 | batadv_dbg(DBG_BATMAN, bat_priv, "Creating new originator: %pM\n", |
203 | "Creating new originator: %pM\n", addr); | 203 | addr); |
204 | 204 | ||
205 | orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC); | 205 | orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC); |
206 | if (!orig_node) | 206 | if (!orig_node) |
@@ -272,6 +272,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, | |||
272 | struct neigh_node *neigh_node; | 272 | struct neigh_node *neigh_node; |
273 | bool neigh_purged = false; | 273 | bool neigh_purged = false; |
274 | unsigned long last_seen; | 274 | unsigned long last_seen; |
275 | struct hard_iface *if_incoming; | ||
275 | 276 | ||
276 | *best_neigh_node = NULL; | 277 | *best_neigh_node = NULL; |
277 | 278 | ||
@@ -281,28 +282,26 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, | |||
281 | hlist_for_each_entry_safe(neigh_node, node, node_tmp, | 282 | hlist_for_each_entry_safe(neigh_node, node, node_tmp, |
282 | &orig_node->neigh_list, list) { | 283 | &orig_node->neigh_list, list) { |
283 | 284 | ||
284 | if ((has_timed_out(neigh_node->last_seen, PURGE_TIMEOUT)) || | 285 | last_seen = neigh_node->last_seen; |
285 | (neigh_node->if_incoming->if_status == IF_INACTIVE) || | 286 | if_incoming = neigh_node->if_incoming; |
286 | (neigh_node->if_incoming->if_status == IF_NOT_IN_USE) || | 287 | |
287 | (neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) { | 288 | if ((batadv_has_timed_out(last_seen, PURGE_TIMEOUT)) || |
288 | 289 | (if_incoming->if_status == IF_INACTIVE) || | |
289 | last_seen = neigh_node->last_seen; | 290 | (if_incoming->if_status == IF_NOT_IN_USE) || |
290 | 291 | (if_incoming->if_status == IF_TO_BE_REMOVED)) { | |
291 | if ((neigh_node->if_incoming->if_status == | 292 | |
292 | IF_INACTIVE) || | 293 | if ((if_incoming->if_status == IF_INACTIVE) || |
293 | (neigh_node->if_incoming->if_status == | 294 | (if_incoming->if_status == IF_NOT_IN_USE) || |
294 | IF_NOT_IN_USE) || | 295 | (if_incoming->if_status == IF_TO_BE_REMOVED)) |
295 | (neigh_node->if_incoming->if_status == | 296 | batadv_dbg(DBG_BATMAN, bat_priv, |
296 | IF_TO_BE_REMOVED)) | 297 | "neighbor purge: originator %pM, neighbor: %pM, iface: %s\n", |
297 | bat_dbg(DBG_BATMAN, bat_priv, | 298 | orig_node->orig, neigh_node->addr, |
298 | "neighbor purge: originator %pM, neighbor: %pM, iface: %s\n", | 299 | if_incoming->net_dev->name); |
299 | orig_node->orig, neigh_node->addr, | ||
300 | neigh_node->if_incoming->net_dev->name); | ||
301 | else | 300 | else |
302 | bat_dbg(DBG_BATMAN, bat_priv, | 301 | batadv_dbg(DBG_BATMAN, bat_priv, |
303 | "neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n", | 302 | "neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n", |
304 | orig_node->orig, neigh_node->addr, | 303 | orig_node->orig, neigh_node->addr, |
305 | jiffies_to_msecs(last_seen)); | 304 | jiffies_to_msecs(last_seen)); |
306 | 305 | ||
307 | neigh_purged = true; | 306 | neigh_purged = true; |
308 | 307 | ||
@@ -325,11 +324,11 @@ static bool purge_orig_node(struct bat_priv *bat_priv, | |||
325 | { | 324 | { |
326 | struct neigh_node *best_neigh_node; | 325 | struct neigh_node *best_neigh_node; |
327 | 326 | ||
328 | if (has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) { | 327 | if (batadv_has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) { |
329 | bat_dbg(DBG_BATMAN, bat_priv, | 328 | batadv_dbg(DBG_BATMAN, bat_priv, |
330 | "Originator timeout: originator %pM, last_seen %u\n", | 329 | "Originator timeout: originator %pM, last_seen %u\n", |
331 | orig_node->orig, | 330 | orig_node->orig, |
332 | jiffies_to_msecs(orig_node->last_seen)); | 331 | jiffies_to_msecs(orig_node->last_seen)); |
333 | return true; | 332 | return true; |
334 | } else { | 333 | } else { |
335 | if (purge_orig_neighbors(bat_priv, orig_node, | 334 | if (purge_orig_neighbors(bat_priv, orig_node, |
@@ -370,8 +369,8 @@ static void _purge_orig(struct bat_priv *bat_priv) | |||
370 | continue; | 369 | continue; |
371 | } | 370 | } |
372 | 371 | ||
373 | if (has_timed_out(orig_node->last_frag_packet, | 372 | if (batadv_has_timed_out(orig_node->last_frag_packet, |
374 | FRAG_TIMEOUT)) | 373 | FRAG_TIMEOUT)) |
375 | batadv_frag_list_free(&orig_node->frag_list); | 374 | batadv_frag_list_free(&orig_node->frag_list); |
376 | } | 375 | } |
377 | spin_unlock_bh(list_lock); | 376 | spin_unlock_bh(list_lock); |
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index c4f63b4d54a7..35f67eb4073f 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h | |||
@@ -77,7 +77,7 @@ static inline struct orig_node *batadv_orig_hash_find(struct bat_priv *bat_priv, | |||
77 | 77 | ||
78 | rcu_read_lock(); | 78 | rcu_read_lock(); |
79 | hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { | 79 | hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { |
80 | if (!compare_eth(orig_node, data)) | 80 | if (!batadv_compare_eth(orig_node, data)) |
81 | continue; | 81 | continue; |
82 | 82 | ||
83 | if (!atomic_inc_not_zero(&orig_node->refcount)) | 83 | if (!atomic_inc_not_zero(&orig_node->refcount)) |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 3eb4a2e121a6..57ff85178216 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -71,23 +71,23 @@ static void _update_route(struct bat_priv *bat_priv, | |||
71 | 71 | ||
72 | /* route deleted */ | 72 | /* route deleted */ |
73 | if ((curr_router) && (!neigh_node)) { | 73 | if ((curr_router) && (!neigh_node)) { |
74 | bat_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n", | 74 | batadv_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n", |
75 | orig_node->orig); | 75 | orig_node->orig); |
76 | batadv_tt_global_del_orig(bat_priv, orig_node, | 76 | batadv_tt_global_del_orig(bat_priv, orig_node, |
77 | "Deleted route towards originator"); | 77 | "Deleted route towards originator"); |
78 | 78 | ||
79 | /* route added */ | 79 | /* route added */ |
80 | } else if ((!curr_router) && (neigh_node)) { | 80 | } else if ((!curr_router) && (neigh_node)) { |
81 | 81 | ||
82 | bat_dbg(DBG_ROUTES, bat_priv, | 82 | batadv_dbg(DBG_ROUTES, bat_priv, |
83 | "Adding route towards: %pM (via %pM)\n", | 83 | "Adding route towards: %pM (via %pM)\n", |
84 | orig_node->orig, neigh_node->addr); | 84 | orig_node->orig, neigh_node->addr); |
85 | /* route changed */ | 85 | /* route changed */ |
86 | } else if (neigh_node && curr_router) { | 86 | } else if (neigh_node && curr_router) { |
87 | bat_dbg(DBG_ROUTES, bat_priv, | 87 | batadv_dbg(DBG_ROUTES, bat_priv, |
88 | "Changing route towards: %pM (now via %pM - was via %pM)\n", | 88 | "Changing route towards: %pM (now via %pM - was via %pM)\n", |
89 | orig_node->orig, neigh_node->addr, | 89 | orig_node->orig, neigh_node->addr, |
90 | curr_router->addr); | 90 | curr_router->addr); |
91 | } | 91 | } |
92 | 92 | ||
93 | if (curr_router) | 93 | if (curr_router) |
@@ -151,8 +151,8 @@ void batadv_bonding_candidate_add(struct orig_node *orig_node, | |||
151 | spin_lock_bh(&orig_node->neigh_list_lock); | 151 | spin_lock_bh(&orig_node->neigh_list_lock); |
152 | 152 | ||
153 | /* only consider if it has the same primary address ... */ | 153 | /* only consider if it has the same primary address ... */ |
154 | if (!compare_eth(orig_node->orig, | 154 | if (!batadv_compare_eth(orig_node->orig, |
155 | neigh_node->orig_node->primary_addr)) | 155 | neigh_node->orig_node->primary_addr)) |
156 | goto candidate_del; | 156 | goto candidate_del; |
157 | 157 | ||
158 | router = batadv_orig_node_get_router(orig_node); | 158 | router = batadv_orig_node_get_router(orig_node); |
@@ -180,7 +180,8 @@ void batadv_bonding_candidate_add(struct orig_node *orig_node, | |||
180 | continue; | 180 | continue; |
181 | 181 | ||
182 | if ((neigh_node->if_incoming == tmp_neigh_node->if_incoming) || | 182 | if ((neigh_node->if_incoming == tmp_neigh_node->if_incoming) || |
183 | (compare_eth(neigh_node->addr, tmp_neigh_node->addr))) { | 183 | (batadv_compare_eth(neigh_node->addr, |
184 | tmp_neigh_node->addr))) { | ||
184 | interference_candidate = 1; | 185 | interference_candidate = 1; |
185 | break; | 186 | break; |
186 | } | 187 | } |
@@ -233,12 +234,12 @@ int batadv_window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, | |||
233 | { | 234 | { |
234 | if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || | 235 | if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) || |
235 | (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { | 236 | (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { |
236 | if (!has_timed_out(*last_reset, RESET_PROTECTION_MS)) | 237 | if (!batadv_has_timed_out(*last_reset, RESET_PROTECTION_MS)) |
237 | return 1; | 238 | return 1; |
238 | 239 | ||
239 | *last_reset = jiffies; | 240 | *last_reset = jiffies; |
240 | bat_dbg(DBG_BATMAN, bat_priv, | 241 | batadv_dbg(DBG_BATMAN, bat_priv, |
241 | "old packet received, start protection\n"); | 242 | "old packet received, start protection\n"); |
242 | } | 243 | } |
243 | 244 | ||
244 | return 0; | 245 | return 0; |
@@ -578,6 +579,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
578 | struct tt_query_packet *tt_query; | 579 | struct tt_query_packet *tt_query; |
579 | uint16_t tt_size; | 580 | uint16_t tt_size; |
580 | struct ethhdr *ethhdr; | 581 | struct ethhdr *ethhdr; |
582 | char tt_flag; | ||
581 | 583 | ||
582 | /* drop packet if it has not necessary minimum size */ | 584 | /* drop packet if it has not necessary minimum size */ |
583 | if (unlikely(!pskb_may_pull(skb, sizeof(struct tt_query_packet)))) | 585 | if (unlikely(!pskb_may_pull(skb, sizeof(struct tt_query_packet)))) |
@@ -607,10 +609,11 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
607 | * forwarded | 609 | * forwarded |
608 | */ | 610 | */ |
609 | if (!batadv_send_tt_response(bat_priv, tt_query)) { | 611 | if (!batadv_send_tt_response(bat_priv, tt_query)) { |
610 | bat_dbg(DBG_TT, bat_priv, | 612 | tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.'; |
611 | "Routing TT_REQUEST to %pM [%c]\n", | 613 | batadv_dbg(DBG_TT, bat_priv, |
612 | tt_query->dst, | 614 | "Routing TT_REQUEST to %pM [%c]\n", |
613 | (tt_query->flags & TT_FULL_TABLE ? 'F' : '.')); | 615 | tt_query->dst, |
616 | tt_flag); | ||
614 | return route_unicast_packet(skb, recv_if); | 617 | return route_unicast_packet(skb, recv_if); |
615 | } | 618 | } |
616 | break; | 619 | break; |
@@ -635,10 +638,11 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) | |||
635 | 638 | ||
636 | batadv_handle_tt_response(bat_priv, tt_query); | 639 | batadv_handle_tt_response(bat_priv, tt_query); |
637 | } else { | 640 | } else { |
638 | bat_dbg(DBG_TT, bat_priv, | 641 | tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.'; |
639 | "Routing TT_RESPONSE to %pM [%c]\n", | 642 | batadv_dbg(DBG_TT, bat_priv, |
640 | tt_query->dst, | 643 | "Routing TT_RESPONSE to %pM [%c]\n", |
641 | (tt_query->flags & TT_FULL_TABLE ? 'F' : '.')); | 644 | tt_query->dst, |
645 | tt_flag); | ||
642 | return route_unicast_packet(skb, recv_if); | 646 | return route_unicast_packet(skb, recv_if); |
643 | } | 647 | } |
644 | break; | 648 | break; |
@@ -688,9 +692,9 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if) | |||
688 | if (!orig_node) | 692 | if (!orig_node) |
689 | goto out; | 693 | goto out; |
690 | 694 | ||
691 | bat_dbg(DBG_TT, bat_priv, | 695 | batadv_dbg(DBG_TT, bat_priv, |
692 | "Received ROAMING_ADV from %pM (client %pM)\n", | 696 | "Received ROAMING_ADV from %pM (client %pM)\n", |
693 | roam_adv_packet->src, roam_adv_packet->client); | 697 | roam_adv_packet->src, roam_adv_packet->client); |
694 | 698 | ||
695 | batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client, | 699 | batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client, |
696 | atomic_read(&orig_node->last_ttvn) + 1, true, | 700 | atomic_read(&orig_node->last_ttvn) + 1, true, |
@@ -749,13 +753,13 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv, | |||
749 | /* if we have something in the primary_addr, we can search | 753 | /* if we have something in the primary_addr, we can search |
750 | * for a potential bonding candidate. | 754 | * for a potential bonding candidate. |
751 | */ | 755 | */ |
752 | if (compare_eth(primary_addr, zero_mac)) | 756 | if (batadv_compare_eth(primary_addr, zero_mac)) |
753 | goto return_router; | 757 | goto return_router; |
754 | 758 | ||
755 | /* find the orig_node which has the primary interface. might | 759 | /* find the orig_node which has the primary interface. might |
756 | * even be the same as our router_orig in many cases | 760 | * even be the same as our router_orig in many cases |
757 | */ | 761 | */ |
758 | if (compare_eth(primary_addr, router_orig->orig)) { | 762 | if (batadv_compare_eth(primary_addr, router_orig->orig)) { |
759 | primary_orig_node = router_orig; | 763 | primary_orig_node = router_orig; |
760 | } else { | 764 | } else { |
761 | primary_orig_node = batadv_orig_hash_find(bat_priv, | 765 | primary_orig_node = batadv_orig_hash_find(bat_priv, |
@@ -974,10 +978,10 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv, | |||
974 | batadv_orig_node_free_ref(orig_node); | 978 | batadv_orig_node_free_ref(orig_node); |
975 | } | 979 | } |
976 | 980 | ||
977 | bat_dbg(DBG_ROUTES, bat_priv, | 981 | batadv_dbg(DBG_ROUTES, bat_priv, |
978 | "TTVN mismatch (old_ttvn %u new_ttvn %u)! Rerouting unicast packet (for %pM) to %pM\n", | 982 | "TTVN mismatch (old_ttvn %u new_ttvn %u)! Rerouting unicast packet (for %pM) to %pM\n", |
979 | unicast_packet->ttvn, curr_ttvn, ethhdr->h_dest, | 983 | unicast_packet->ttvn, curr_ttvn, ethhdr->h_dest, |
980 | unicast_packet->dest); | 984 | unicast_packet->dest); |
981 | 985 | ||
982 | unicast_packet->ttvn = curr_ttvn; | 986 | unicast_packet->ttvn = curr_ttvn; |
983 | } | 987 | } |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 54091db9d5ff..47c3a41cd854 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -142,7 +142,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
142 | struct sk_buff *newskb; | 142 | struct sk_buff *newskb; |
143 | 143 | ||
144 | if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { | 144 | if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { |
145 | bat_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); | 145 | batadv_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); |
146 | goto out; | 146 | goto out; |
147 | } | 147 | } |
148 | 148 | ||
@@ -271,12 +271,12 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv, | |||
271 | bool pending; | 271 | bool pending; |
272 | 272 | ||
273 | if (hard_iface) | 273 | if (hard_iface) |
274 | bat_dbg(DBG_BATMAN, bat_priv, | 274 | batadv_dbg(DBG_BATMAN, bat_priv, |
275 | "purge_outstanding_packets(): %s\n", | 275 | "purge_outstanding_packets(): %s\n", |
276 | hard_iface->net_dev->name); | 276 | hard_iface->net_dev->name); |
277 | else | 277 | else |
278 | bat_dbg(DBG_BATMAN, bat_priv, | 278 | batadv_dbg(DBG_BATMAN, bat_priv, |
279 | "purge_outstanding_packets()\n"); | 279 | "purge_outstanding_packets()\n"); |
280 | 280 | ||
281 | /* free bcast list */ | 281 | /* free bcast list */ |
282 | spin_lock_bh(&bat_priv->forw_bcast_list_lock); | 282 | spin_lock_bh(&bat_priv->forw_bcast_list_lock); |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 85fe9c1ce5bc..af676b818637 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -168,7 +168,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
168 | /* don't accept stp packets. STP does not help in meshes. | 168 | /* don't accept stp packets. STP does not help in meshes. |
169 | * better use the bridge loop avoidance ... | 169 | * better use the bridge loop avoidance ... |
170 | */ | 170 | */ |
171 | if (compare_eth(ethhdr->h_dest, stp_addr)) | 171 | if (batadv_compare_eth(ethhdr->h_dest, stp_addr)) |
172 | goto dropped; | 172 | goto dropped; |
173 | 173 | ||
174 | if (is_multicast_ether_addr(ethhdr->h_dest)) { | 174 | if (is_multicast_ether_addr(ethhdr->h_dest)) { |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 1dfa2311bb1b..2eff22f9fdaa 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -66,7 +66,7 @@ static struct tt_common_entry *tt_hash_find(struct hashtable_t *hash, | |||
66 | 66 | ||
67 | rcu_read_lock(); | 67 | rcu_read_lock(); |
68 | hlist_for_each_entry_rcu(tt_common_entry, node, head, hash_entry) { | 68 | hlist_for_each_entry_rcu(tt_common_entry, node, head, hash_entry) { |
69 | if (!compare_eth(tt_common_entry, data)) | 69 | if (!batadv_compare_eth(tt_common_entry, data)) |
70 | continue; | 70 | continue; |
71 | 71 | ||
72 | if (!atomic_inc_not_zero(&tt_common_entry->refcount)) | 72 | if (!atomic_inc_not_zero(&tt_common_entry->refcount)) |
@@ -213,9 +213,9 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
213 | if (!tt_local_entry) | 213 | if (!tt_local_entry) |
214 | goto out; | 214 | goto out; |
215 | 215 | ||
216 | bat_dbg(DBG_TT, bat_priv, | 216 | batadv_dbg(DBG_TT, bat_priv, |
217 | "Creating new local tt entry: %pM (ttvn: %d)\n", addr, | 217 | "Creating new local tt entry: %pM (ttvn: %d)\n", addr, |
218 | (uint8_t)atomic_read(&bat_priv->ttvn)); | 218 | (uint8_t)atomic_read(&bat_priv->ttvn)); |
219 | 219 | ||
220 | memcpy(tt_local_entry->common.addr, addr, ETH_ALEN); | 220 | memcpy(tt_local_entry->common.addr, addr, ETH_ALEN); |
221 | tt_local_entry->common.flags = NO_FLAGS; | 221 | tt_local_entry->common.flags = NO_FLAGS; |
@@ -225,7 +225,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
225 | tt_local_entry->last_seen = jiffies; | 225 | tt_local_entry->last_seen = jiffies; |
226 | 226 | ||
227 | /* the batman interface mac address should never be purged */ | 227 | /* the batman interface mac address should never be purged */ |
228 | if (compare_eth(addr, soft_iface->dev_addr)) | 228 | if (batadv_compare_eth(addr, soft_iface->dev_addr)) |
229 | tt_local_entry->common.flags |= TT_CLIENT_NOPURGE; | 229 | tt_local_entry->common.flags |= TT_CLIENT_NOPURGE; |
230 | 230 | ||
231 | /* The local entry has to be marked as NEW to avoid to send it in | 231 | /* The local entry has to be marked as NEW to avoid to send it in |
@@ -441,9 +441,9 @@ static void tt_local_set_pending(struct bat_priv *bat_priv, | |||
441 | */ | 441 | */ |
442 | tt_local_entry->common.flags |= TT_CLIENT_PENDING; | 442 | tt_local_entry->common.flags |= TT_CLIENT_PENDING; |
443 | 443 | ||
444 | bat_dbg(DBG_TT, bat_priv, | 444 | batadv_dbg(DBG_TT, bat_priv, |
445 | "Local tt entry (%pM) pending to be removed: %s\n", | 445 | "Local tt entry (%pM) pending to be removed: %s\n", |
446 | tt_local_entry->common.addr, message); | 446 | tt_local_entry->common.addr, message); |
447 | } | 447 | } |
448 | 448 | ||
449 | void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, | 449 | void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, |
@@ -489,8 +489,8 @@ static void tt_local_purge(struct bat_priv *bat_priv) | |||
489 | if (tt_local_entry->common.flags & TT_CLIENT_PENDING) | 489 | if (tt_local_entry->common.flags & TT_CLIENT_PENDING) |
490 | continue; | 490 | continue; |
491 | 491 | ||
492 | if (!has_timed_out(tt_local_entry->last_seen, | 492 | if (!batadv_has_timed_out(tt_local_entry->last_seen, |
493 | TT_LOCAL_TIMEOUT)) | 493 | TT_LOCAL_TIMEOUT)) |
494 | continue; | 494 | continue; |
495 | 495 | ||
496 | tt_local_set_pending(bat_priv, tt_local_entry, | 496 | tt_local_set_pending(bat_priv, tt_local_entry, |
@@ -674,9 +674,9 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, | |||
674 | if (wifi) | 674 | if (wifi) |
675 | tt_global_entry->common.flags |= TT_CLIENT_WIFI; | 675 | tt_global_entry->common.flags |= TT_CLIENT_WIFI; |
676 | 676 | ||
677 | bat_dbg(DBG_TT, bat_priv, | 677 | batadv_dbg(DBG_TT, bat_priv, |
678 | "Creating new global tt entry: %pM (via %pM)\n", | 678 | "Creating new global tt entry: %pM (via %pM)\n", |
679 | tt_global_entry->common.addr, orig_node->orig); | 679 | tt_global_entry->common.addr, orig_node->orig); |
680 | 680 | ||
681 | out_remove: | 681 | out_remove: |
682 | /* remove address from local hash if present */ | 682 | /* remove address from local hash if present */ |
@@ -800,10 +800,10 @@ static void tt_global_del_orig_entry(struct bat_priv *bat_priv, | |||
800 | head = &tt_global_entry->orig_list; | 800 | head = &tt_global_entry->orig_list; |
801 | hlist_for_each_entry_safe(orig_entry, node, safe, head, list) { | 801 | hlist_for_each_entry_safe(orig_entry, node, safe, head, list) { |
802 | if (orig_entry->orig_node == orig_node) { | 802 | if (orig_entry->orig_node == orig_node) { |
803 | bat_dbg(DBG_TT, bat_priv, | 803 | batadv_dbg(DBG_TT, bat_priv, |
804 | "Deleting %pM from global tt entry %pM: %s\n", | 804 | "Deleting %pM from global tt entry %pM: %s\n", |
805 | orig_node->orig, tt_global_entry->common.addr, | 805 | orig_node->orig, |
806 | message); | 806 | tt_global_entry->common.addr, message); |
807 | hlist_del_rcu(node); | 807 | hlist_del_rcu(node); |
808 | tt_orig_list_entry_free_ref(orig_entry); | 808 | tt_orig_list_entry_free_ref(orig_entry); |
809 | } | 809 | } |
@@ -815,9 +815,8 @@ static void tt_global_del_struct(struct bat_priv *bat_priv, | |||
815 | struct tt_global_entry *tt_global_entry, | 815 | struct tt_global_entry *tt_global_entry, |
816 | const char *message) | 816 | const char *message) |
817 | { | 817 | { |
818 | bat_dbg(DBG_TT, bat_priv, | 818 | batadv_dbg(DBG_TT, bat_priv, "Deleting global tt entry %pM: %s\n", |
819 | "Deleting global tt entry %pM: %s\n", | 819 | tt_global_entry->common.addr, message); |
820 | tt_global_entry->common.addr, message); | ||
821 | 820 | ||
822 | batadv_hash_remove(bat_priv->tt_global_hash, compare_tt, | 821 | batadv_hash_remove(bat_priv->tt_global_hash, compare_tt, |
823 | batadv_choose_orig, tt_global_entry->common.addr); | 822 | batadv_choose_orig, tt_global_entry->common.addr); |
@@ -951,10 +950,10 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv, | |||
951 | orig_node, message); | 950 | orig_node, message); |
952 | 951 | ||
953 | if (hlist_empty(&tt_global_entry->orig_list)) { | 952 | if (hlist_empty(&tt_global_entry->orig_list)) { |
954 | bat_dbg(DBG_TT, bat_priv, | 953 | batadv_dbg(DBG_TT, bat_priv, |
955 | "Deleting global tt entry %pM: %s\n", | 954 | "Deleting global tt entry %pM: %s\n", |
956 | tt_global_entry->common.addr, | 955 | tt_global_entry->common.addr, |
957 | message); | 956 | message); |
958 | hlist_del_rcu(node); | 957 | hlist_del_rcu(node); |
959 | tt_global_entry_free_ref(tt_global_entry); | 958 | tt_global_entry_free_ref(tt_global_entry); |
960 | } | 959 | } |
@@ -987,13 +986,13 @@ static void tt_global_roam_purge(struct bat_priv *bat_priv) | |||
987 | common); | 986 | common); |
988 | if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM)) | 987 | if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM)) |
989 | continue; | 988 | continue; |
990 | if (!has_timed_out(tt_global_entry->roam_at, | 989 | if (!batadv_has_timed_out(tt_global_entry->roam_at, |
991 | TT_CLIENT_ROAM_TIMEOUT)) | 990 | TT_CLIENT_ROAM_TIMEOUT)) |
992 | continue; | 991 | continue; |
993 | 992 | ||
994 | bat_dbg(DBG_TT, bat_priv, | 993 | batadv_dbg(DBG_TT, bat_priv, |
995 | "Deleting global tt entry (%pM): Roaming timeout\n", | 994 | "Deleting global tt entry (%pM): Roaming timeout\n", |
996 | tt_global_entry->common.addr); | 995 | tt_global_entry->common.addr); |
997 | 996 | ||
998 | hlist_del_rcu(node); | 997 | hlist_del_rcu(node); |
999 | tt_global_entry_free_ref(tt_global_entry); | 998 | tt_global_entry_free_ref(tt_global_entry); |
@@ -1234,7 +1233,7 @@ static void tt_req_purge(struct bat_priv *bat_priv) | |||
1234 | 1233 | ||
1235 | spin_lock_bh(&bat_priv->tt_req_list_lock); | 1234 | spin_lock_bh(&bat_priv->tt_req_list_lock); |
1236 | list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) { | 1235 | list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) { |
1237 | if (has_timed_out(node->issued_at, TT_REQUEST_TIMEOUT)) { | 1236 | if (batadv_has_timed_out(node->issued_at, TT_REQUEST_TIMEOUT)) { |
1238 | list_del(&node->list); | 1237 | list_del(&node->list); |
1239 | kfree(node); | 1238 | kfree(node); |
1240 | } | 1239 | } |
@@ -1252,9 +1251,9 @@ static struct tt_req_node *new_tt_req_node(struct bat_priv *bat_priv, | |||
1252 | 1251 | ||
1253 | spin_lock_bh(&bat_priv->tt_req_list_lock); | 1252 | spin_lock_bh(&bat_priv->tt_req_list_lock); |
1254 | list_for_each_entry(tt_req_node_tmp, &bat_priv->tt_req_list, list) { | 1253 | list_for_each_entry(tt_req_node_tmp, &bat_priv->tt_req_list, list) { |
1255 | if (compare_eth(tt_req_node_tmp, orig_node) && | 1254 | if (batadv_compare_eth(tt_req_node_tmp, orig_node) && |
1256 | !has_timed_out(tt_req_node_tmp->issued_at, | 1255 | !batadv_has_timed_out(tt_req_node_tmp->issued_at, |
1257 | TT_REQUEST_TIMEOUT)) | 1256 | TT_REQUEST_TIMEOUT)) |
1258 | goto unlock; | 1257 | goto unlock; |
1259 | } | 1258 | } |
1260 | 1259 | ||
@@ -1409,10 +1408,10 @@ static int send_tt_request(struct bat_priv *bat_priv, | |||
1409 | if (!neigh_node) | 1408 | if (!neigh_node) |
1410 | goto out; | 1409 | goto out; |
1411 | 1410 | ||
1412 | bat_dbg(DBG_TT, bat_priv, | 1411 | batadv_dbg(DBG_TT, bat_priv, |
1413 | "Sending TT_REQUEST to %pM via %pM [%c]\n", | 1412 | "Sending TT_REQUEST to %pM via %pM [%c]\n", |
1414 | dst_orig_node->orig, neigh_node->addr, | 1413 | dst_orig_node->orig, neigh_node->addr, |
1415 | (full_table ? 'F' : '.')); | 1414 | (full_table ? 'F' : '.')); |
1416 | 1415 | ||
1417 | batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_TX); | 1416 | batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_TX); |
1418 | 1417 | ||
@@ -1449,10 +1448,10 @@ static bool send_other_tt_response(struct bat_priv *bat_priv, | |||
1449 | struct sk_buff *skb = NULL; | 1448 | struct sk_buff *skb = NULL; |
1450 | struct tt_query_packet *tt_response; | 1449 | struct tt_query_packet *tt_response; |
1451 | 1450 | ||
1452 | bat_dbg(DBG_TT, bat_priv, | 1451 | batadv_dbg(DBG_TT, bat_priv, |
1453 | "Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n", | 1452 | "Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n", |
1454 | tt_request->src, tt_request->ttvn, tt_request->dst, | 1453 | tt_request->src, tt_request->ttvn, tt_request->dst, |
1455 | (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); | 1454 | (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); |
1456 | 1455 | ||
1457 | /* Let's get the orig node of the REAL destination */ | 1456 | /* Let's get the orig node of the REAL destination */ |
1458 | req_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->dst); | 1457 | req_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->dst); |
@@ -1536,10 +1535,10 @@ static bool send_other_tt_response(struct bat_priv *bat_priv, | |||
1536 | if (full_table) | 1535 | if (full_table) |
1537 | tt_response->flags |= TT_FULL_TABLE; | 1536 | tt_response->flags |= TT_FULL_TABLE; |
1538 | 1537 | ||
1539 | bat_dbg(DBG_TT, bat_priv, | 1538 | batadv_dbg(DBG_TT, bat_priv, |
1540 | "Sending TT_RESPONSE %pM via %pM for %pM (ttvn: %u)\n", | 1539 | "Sending TT_RESPONSE %pM via %pM for %pM (ttvn: %u)\n", |
1541 | res_dst_orig_node->orig, neigh_node->addr, | 1540 | res_dst_orig_node->orig, neigh_node->addr, |
1542 | req_dst_orig_node->orig, req_ttvn); | 1541 | req_dst_orig_node->orig, req_ttvn); |
1543 | 1542 | ||
1544 | batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_TX); | 1543 | batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_TX); |
1545 | 1544 | ||
@@ -1578,10 +1577,10 @@ static bool send_my_tt_response(struct bat_priv *bat_priv, | |||
1578 | struct sk_buff *skb = NULL; | 1577 | struct sk_buff *skb = NULL; |
1579 | struct tt_query_packet *tt_response; | 1578 | struct tt_query_packet *tt_response; |
1580 | 1579 | ||
1581 | bat_dbg(DBG_TT, bat_priv, | 1580 | batadv_dbg(DBG_TT, bat_priv, |
1582 | "Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n", | 1581 | "Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n", |
1583 | tt_request->src, tt_request->ttvn, | 1582 | tt_request->src, tt_request->ttvn, |
1584 | (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); | 1583 | (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); |
1585 | 1584 | ||
1586 | 1585 | ||
1587 | my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn); | 1586 | my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn); |
@@ -1656,10 +1655,10 @@ static bool send_my_tt_response(struct bat_priv *bat_priv, | |||
1656 | if (full_table) | 1655 | if (full_table) |
1657 | tt_response->flags |= TT_FULL_TABLE; | 1656 | tt_response->flags |= TT_FULL_TABLE; |
1658 | 1657 | ||
1659 | bat_dbg(DBG_TT, bat_priv, | 1658 | batadv_dbg(DBG_TT, bat_priv, |
1660 | "Sending TT_RESPONSE to %pM via %pM [%c]\n", | 1659 | "Sending TT_RESPONSE to %pM via %pM [%c]\n", |
1661 | orig_node->orig, neigh_node->addr, | 1660 | orig_node->orig, neigh_node->addr, |
1662 | (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); | 1661 | (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); |
1663 | 1662 | ||
1664 | batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_TX); | 1663 | batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_TX); |
1665 | 1664 | ||
@@ -1795,11 +1794,11 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, | |||
1795 | struct tt_req_node *node, *safe; | 1794 | struct tt_req_node *node, *safe; |
1796 | struct orig_node *orig_node = NULL; | 1795 | struct orig_node *orig_node = NULL; |
1797 | 1796 | ||
1798 | bat_dbg(DBG_TT, bat_priv, | 1797 | batadv_dbg(DBG_TT, bat_priv, |
1799 | "Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n", | 1798 | "Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n", |
1800 | tt_response->src, tt_response->ttvn, | 1799 | tt_response->src, tt_response->ttvn, |
1801 | ntohs(tt_response->tt_data), | 1800 | ntohs(tt_response->tt_data), |
1802 | (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); | 1801 | (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); |
1803 | 1802 | ||
1804 | /* we should have never asked a backbone gw */ | 1803 | /* we should have never asked a backbone gw */ |
1805 | if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_response->src)) | 1804 | if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_response->src)) |
@@ -1820,7 +1819,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, | |||
1820 | /* Delete the tt_req_node from pending tt_requests list */ | 1819 | /* Delete the tt_req_node from pending tt_requests list */ |
1821 | spin_lock_bh(&bat_priv->tt_req_list_lock); | 1820 | spin_lock_bh(&bat_priv->tt_req_list_lock); |
1822 | list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) { | 1821 | list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) { |
1823 | if (!compare_eth(node->addr, tt_response->src)) | 1822 | if (!batadv_compare_eth(node->addr, tt_response->src)) |
1824 | continue; | 1823 | continue; |
1825 | list_del(&node->list); | 1824 | list_del(&node->list); |
1826 | kfree(node); | 1825 | kfree(node); |
@@ -1875,7 +1874,7 @@ static void tt_roam_purge(struct bat_priv *bat_priv) | |||
1875 | 1874 | ||
1876 | spin_lock_bh(&bat_priv->tt_roam_list_lock); | 1875 | spin_lock_bh(&bat_priv->tt_roam_list_lock); |
1877 | list_for_each_entry_safe(node, safe, &bat_priv->tt_roam_list, list) { | 1876 | list_for_each_entry_safe(node, safe, &bat_priv->tt_roam_list, list) { |
1878 | if (!has_timed_out(node->first_time, ROAMING_MAX_TIME)) | 1877 | if (!batadv_has_timed_out(node->first_time, ROAMING_MAX_TIME)) |
1879 | continue; | 1878 | continue; |
1880 | 1879 | ||
1881 | list_del(&node->list); | 1880 | list_del(&node->list); |
@@ -1901,10 +1900,11 @@ static bool tt_check_roam_count(struct bat_priv *bat_priv, | |||
1901 | * reply from the same orig_node yet | 1900 | * reply from the same orig_node yet |
1902 | */ | 1901 | */ |
1903 | list_for_each_entry(tt_roam_node, &bat_priv->tt_roam_list, list) { | 1902 | list_for_each_entry(tt_roam_node, &bat_priv->tt_roam_list, list) { |
1904 | if (!compare_eth(tt_roam_node->addr, client)) | 1903 | if (!batadv_compare_eth(tt_roam_node->addr, client)) |
1905 | continue; | 1904 | continue; |
1906 | 1905 | ||
1907 | if (has_timed_out(tt_roam_node->first_time, ROAMING_MAX_TIME)) | 1906 | if (batadv_has_timed_out(tt_roam_node->first_time, |
1907 | ROAMING_MAX_TIME)) | ||
1908 | continue; | 1908 | continue; |
1909 | 1909 | ||
1910 | if (!atomic_dec_not_zero(&tt_roam_node->counter)) | 1910 | if (!atomic_dec_not_zero(&tt_roam_node->counter)) |
@@ -1971,9 +1971,9 @@ static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, | |||
1971 | if (!neigh_node) | 1971 | if (!neigh_node) |
1972 | goto out; | 1972 | goto out; |
1973 | 1973 | ||
1974 | bat_dbg(DBG_TT, bat_priv, | 1974 | batadv_dbg(DBG_TT, bat_priv, |
1975 | "Sending ROAMING_ADV to %pM (client %pM) via %pM\n", | 1975 | "Sending ROAMING_ADV to %pM (client %pM) via %pM\n", |
1976 | orig_node->orig, client, neigh_node->addr); | 1976 | orig_node->orig, client, neigh_node->addr); |
1977 | 1977 | ||
1978 | batadv_inc_counter(bat_priv, BAT_CNT_TT_ROAM_ADV_TX); | 1978 | batadv_inc_counter(bat_priv, BAT_CNT_TT_ROAM_ADV_TX); |
1979 | 1979 | ||
@@ -2078,9 +2078,9 @@ static void tt_local_purge_pending_clients(struct bat_priv *bat_priv) | |||
2078 | if (!(tt_common_entry->flags & TT_CLIENT_PENDING)) | 2078 | if (!(tt_common_entry->flags & TT_CLIENT_PENDING)) |
2079 | continue; | 2079 | continue; |
2080 | 2080 | ||
2081 | bat_dbg(DBG_TT, bat_priv, | 2081 | batadv_dbg(DBG_TT, bat_priv, |
2082 | "Deleting local tt entry (%pM): pending\n", | 2082 | "Deleting local tt entry (%pM): pending\n", |
2083 | tt_common_entry->addr); | 2083 | tt_common_entry->addr); |
2084 | 2084 | ||
2085 | atomic_dec(&bat_priv->num_local_tt); | 2085 | atomic_dec(&bat_priv->num_local_tt); |
2086 | hlist_del_rcu(node); | 2086 | hlist_del_rcu(node); |
@@ -2113,8 +2113,9 @@ static int tt_commit_changes(struct bat_priv *bat_priv, | |||
2113 | 2113 | ||
2114 | /* Increment the TTVN only once per OGM interval */ | 2114 | /* Increment the TTVN only once per OGM interval */ |
2115 | atomic_inc(&bat_priv->ttvn); | 2115 | atomic_inc(&bat_priv->ttvn); |
2116 | bat_dbg(DBG_TT, bat_priv, "Local changes committed, updating to ttvn %u\n", | 2116 | batadv_dbg(DBG_TT, bat_priv, |
2117 | (uint8_t)atomic_read(&bat_priv->ttvn)); | 2117 | "Local changes committed, updating to ttvn %u\n", |
2118 | (uint8_t)atomic_read(&bat_priv->ttvn)); | ||
2118 | bat_priv->tt_poss_change = false; | 2119 | bat_priv->tt_poss_change = false; |
2119 | 2120 | ||
2120 | /* reset the sending counter */ | 2121 | /* reset the sending counter */ |
@@ -2235,10 +2236,10 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv, | |||
2235 | if (!orig_node->tt_initialised || ttvn != orig_ttvn || | 2236 | if (!orig_node->tt_initialised || ttvn != orig_ttvn || |
2236 | orig_node->tt_crc != tt_crc) { | 2237 | orig_node->tt_crc != tt_crc) { |
2237 | request_table: | 2238 | request_table: |
2238 | bat_dbg(DBG_TT, bat_priv, | 2239 | batadv_dbg(DBG_TT, bat_priv, |
2239 | "TT inconsistency for %pM. Need to retrieve the correct information (ttvn: %u last_ttvn: %u crc: %u last_crc: %u num_changes: %u)\n", | 2240 | "TT inconsistency for %pM. Need to retrieve the correct information (ttvn: %u last_ttvn: %u crc: %u last_crc: %u num_changes: %u)\n", |
2240 | orig_node->orig, ttvn, orig_ttvn, tt_crc, | 2241 | orig_node->orig, ttvn, orig_ttvn, tt_crc, |
2241 | orig_node->tt_crc, tt_num_changes); | 2242 | orig_node->tt_crc, tt_num_changes); |
2242 | send_tt_request(bat_priv, orig_node, ttvn, tt_crc, | 2243 | send_tt_request(bat_priv, orig_node, ttvn, tt_crc, |
2243 | full_table); | 2244 | full_table); |
2244 | return; | 2245 | return; |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index bf72c5248662..d45989e0bbd7 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -59,7 +59,7 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2) | |||
59 | d2 = data2; | 59 | d2 = data2; |
60 | p1 = (struct vis_packet *)d1->skb_packet->data; | 60 | p1 = (struct vis_packet *)d1->skb_packet->data; |
61 | p2 = (struct vis_packet *)d2->skb_packet->data; | 61 | p2 = (struct vis_packet *)d2->skb_packet->data; |
62 | return compare_eth(p1->vis_orig, p2->vis_orig); | 62 | return batadv_compare_eth(p1->vis_orig, p2->vis_orig); |
63 | } | 63 | } |
64 | 64 | ||
65 | /* hash function to choose an entry in a hash table of given size | 65 | /* hash function to choose an entry in a hash table of given size |
@@ -127,7 +127,7 @@ static void vis_data_insert_interface(const uint8_t *interface, | |||
127 | struct hlist_node *pos; | 127 | struct hlist_node *pos; |
128 | 128 | ||
129 | hlist_for_each_entry(entry, pos, if_list, list) { | 129 | hlist_for_each_entry(entry, pos, if_list, list) { |
130 | if (compare_eth(entry->addr, interface)) | 130 | if (batadv_compare_eth(entry->addr, interface)) |
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | 133 | ||
@@ -181,7 +181,7 @@ static ssize_t vis_data_read_entry(char *buff, | |||
181 | /* maximal length: max(4+17+2, 3+17+1+3+2) == 26 */ | 181 | /* maximal length: max(4+17+2, 3+17+1+3+2) == 26 */ |
182 | if (primary && entry->quality == 0) | 182 | if (primary && entry->quality == 0) |
183 | return sprintf(buff, "TT %pM, ", entry->dest); | 183 | return sprintf(buff, "TT %pM, ", entry->dest); |
184 | else if (compare_eth(entry->src, src)) | 184 | else if (batadv_compare_eth(entry->src, src)) |
185 | return sprintf(buff, "TQ %pM %d, ", entry->dest, | 185 | return sprintf(buff, "TQ %pM %d, ", entry->dest, |
186 | entry->quality); | 186 | entry->quality); |
187 | 187 | ||
@@ -233,8 +233,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | |||
233 | for (j = 0; j < packet->entries; j++) { | 233 | for (j = 0; j < packet->entries; j++) { |
234 | if (entries[j].quality == 0) | 234 | if (entries[j].quality == 0) |
235 | continue; | 235 | continue; |
236 | if (compare_eth(entries[j].src, | 236 | if (batadv_compare_eth(entries[j].src, |
237 | packet->vis_orig)) | 237 | packet->vis_orig)) |
238 | continue; | 238 | continue; |
239 | vis_data_insert_interface(entries[j].src, | 239 | vis_data_insert_interface(entries[j].src, |
240 | &vis_if_list, | 240 | &vis_if_list, |
@@ -245,7 +245,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | |||
245 | buf_size += 18 + 26 * packet->entries; | 245 | buf_size += 18 + 26 * packet->entries; |
246 | 246 | ||
247 | /* add primary/secondary records */ | 247 | /* add primary/secondary records */ |
248 | if (compare_eth(entry->addr, packet->vis_orig)) | 248 | if (batadv_compare_eth(entry->addr, |
249 | packet->vis_orig)) | ||
249 | buf_size += | 250 | buf_size += |
250 | vis_data_count_prim_sec(&vis_if_list); | 251 | vis_data_count_prim_sec(&vis_if_list); |
251 | 252 | ||
@@ -285,8 +286,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | |||
285 | for (j = 0; j < packet->entries; j++) { | 286 | for (j = 0; j < packet->entries; j++) { |
286 | if (entries[j].quality == 0) | 287 | if (entries[j].quality == 0) |
287 | continue; | 288 | continue; |
288 | if (compare_eth(entries[j].src, | 289 | if (batadv_compare_eth(entries[j].src, |
289 | packet->vis_orig)) | 290 | packet->vis_orig)) |
290 | continue; | 291 | continue; |
291 | vis_data_insert_interface(entries[j].src, | 292 | vis_data_insert_interface(entries[j].src, |
292 | &vis_if_list, | 293 | &vis_if_list, |
@@ -305,7 +306,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | |||
305 | entry->primary); | 306 | entry->primary); |
306 | 307 | ||
307 | /* add primary/secondary records */ | 308 | /* add primary/secondary records */ |
308 | if (compare_eth(entry->addr, packet->vis_orig)) | 309 | if (batadv_compare_eth(entry->addr, |
310 | packet->vis_orig)) | ||
309 | buff_pos += | 311 | buff_pos += |
310 | vis_data_read_prim_sec(buff + buff_pos, | 312 | vis_data_read_prim_sec(buff + buff_pos, |
311 | &vis_if_list); | 313 | &vis_if_list); |
@@ -379,7 +381,7 @@ static int recv_list_is_in(struct bat_priv *bat_priv, | |||
379 | 381 | ||
380 | spin_lock_bh(&bat_priv->vis_list_lock); | 382 | spin_lock_bh(&bat_priv->vis_list_lock); |
381 | list_for_each_entry(entry, recv_list, list) { | 383 | list_for_each_entry(entry, recv_list, list) { |
382 | if (compare_eth(entry->mac, mac)) { | 384 | if (batadv_compare_eth(entry->mac, mac)) { |
383 | spin_unlock_bh(&bat_priv->vis_list_lock); | 385 | spin_unlock_bh(&bat_priv->vis_list_lock); |
384 | return 1; | 386 | return 1; |
385 | } | 387 | } |
@@ -651,7 +653,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv) | |||
651 | if (!router) | 653 | if (!router) |
652 | continue; | 654 | continue; |
653 | 655 | ||
654 | if (!compare_eth(router->addr, orig_node->orig)) | 656 | if (!batadv_compare_eth(router->addr, orig_node->orig)) |
655 | goto next; | 657 | goto next; |
656 | 658 | ||
657 | if (router->if_incoming->if_status != IF_ACTIVE) | 659 | if (router->if_incoming->if_status != IF_ACTIVE) |
@@ -728,7 +730,8 @@ static void purge_vis_packets(struct bat_priv *bat_priv) | |||
728 | if (info == bat_priv->my_vis_info) | 730 | if (info == bat_priv->my_vis_info) |
729 | continue; | 731 | continue; |
730 | 732 | ||
731 | if (has_timed_out(info->first_seen, VIS_TIMEOUT)) { | 733 | if (batadv_has_timed_out(info->first_seen, |
734 | VIS_TIMEOUT)) { | ||
732 | hlist_del(node); | 735 | hlist_del(node); |
733 | send_list_del(info); | 736 | send_list_del(info); |
734 | kref_put(&info->refcount, free_info); | 737 | kref_put(&info->refcount, free_info); |