diff options
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 68 |
1 files changed, 36 insertions, 32 deletions
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 | } |