diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-06-03 22:19:21 +0200 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-07-01 22:47:19 +0200 |
commit | acd34afa89772f6379b642bb979d0a112328c769 (patch) | |
tree | dc72002fdefbd521253f651a53bbed762d3af899 /net/batman-adv/translation-table.c | |
parent | d69909d2fc9e00bd8149cc8df9b18c35008e3e62 (diff) |
batman-adv: Prefix packet enum with BATADV_
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 191 |
1 files changed, 98 insertions, 93 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index f36d1d52bff..309d691abe6 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -169,7 +169,7 @@ static void batadv_tt_local_event(struct bat_priv *bat_priv, tt_change_node->change.flags = flags; memcpy(tt_change_node->change.addr, addr, ETH_ALEN); - del_op_requested = flags & TT_CLIENT_DEL; + del_op_requested = flags & BATADV_TT_CLIENT_DEL; /* check for ADD+DEL or DEL+ADD events */ spin_lock_bh(&bat_priv->tt_changes_list_lock); @@ -185,7 +185,7 @@ static void batadv_tt_local_event(struct bat_priv *bat_priv, * now possible due to automatically recognition of "temporary" * clients */ - del_op_entry = entry->change.flags & TT_CLIENT_DEL; + del_op_entry = entry->change.flags & BATADV_TT_CLIENT_DEL; if (!del_op_requested && del_op_entry) goto del; if (del_op_requested && !del_op_entry) @@ -243,8 +243,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, if (tt_local_entry) { tt_local_entry->last_seen = jiffies; - /* possibly unset the TT_CLIENT_PENDING flag */ - tt_local_entry->common.flags &= ~TT_CLIENT_PENDING; + /* possibly unset the BATADV_TT_CLIENT_PENDING flag */ + tt_local_entry->common.flags &= ~BATADV_TT_CLIENT_PENDING; goto out; } @@ -259,19 +259,19 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, memcpy(tt_local_entry->common.addr, addr, ETH_ALEN); tt_local_entry->common.flags = BATADV_NO_FLAGS; if (batadv_is_wifi_iface(ifindex)) - tt_local_entry->common.flags |= TT_CLIENT_WIFI; + tt_local_entry->common.flags |= BATADV_TT_CLIENT_WIFI; atomic_set(&tt_local_entry->common.refcount, 2); tt_local_entry->last_seen = jiffies; /* the batman interface mac address should never be purged */ if (batadv_compare_eth(addr, soft_iface->dev_addr)) - tt_local_entry->common.flags |= TT_CLIENT_NOPURGE; + tt_local_entry->common.flags |= BATADV_TT_CLIENT_NOPURGE; /* The local entry has to be marked as NEW to avoid to send it in * a full table response going out before the next ttvn increment * (consistency check) */ - tt_local_entry->common.flags |= TT_CLIENT_NEW; + tt_local_entry->common.flags |= BATADV_TT_CLIENT_NEW; hash_added = batadv_hash_add(bat_priv->tt_local_hash, batadv_compare_tt, batadv_choose_orig, @@ -305,7 +305,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, /* The global entry has to be marked as ROAMING and * has to be kept for consistency purpose */ - tt_global_entry->common.flags |= TT_CLIENT_ROAM; + tt_global_entry->common.flags |= BATADV_TT_CLIENT_ROAM; tt_global_entry->roam_at = jiffies; } out: @@ -453,15 +453,15 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) seq_printf(seq, " * %pM [%c%c%c%c%c]\n", tt_common_entry->addr, (tt_common_entry->flags & - TT_CLIENT_ROAM ? 'R' : '.'), + BATADV_TT_CLIENT_ROAM ? 'R' : '.'), (tt_common_entry->flags & - TT_CLIENT_NOPURGE ? 'P' : '.'), + BATADV_TT_CLIENT_NOPURGE ? 'P' : '.'), (tt_common_entry->flags & - TT_CLIENT_NEW ? 'N' : '.'), + BATADV_TT_CLIENT_NEW ? 'N' : '.'), (tt_common_entry->flags & - TT_CLIENT_PENDING ? 'X' : '.'), + BATADV_TT_CLIENT_PENDING ? 'X' : '.'), (tt_common_entry->flags & - TT_CLIENT_WIFI ? 'W' : '.')); + BATADV_TT_CLIENT_WIFI ? 'W' : '.')); } rcu_read_unlock(); } @@ -482,7 +482,7 @@ static void batadv_tt_local_set_pending(struct bat_priv *bat_priv, * to be kept in the table in order to send it in a full table * response issued before the net ttvn increment (consistency check) */ - tt_local_entry->common.flags |= TT_CLIENT_PENDING; + tt_local_entry->common.flags |= BATADV_TT_CLIENT_PENDING; batadv_dbg(DBG_TT, bat_priv, "Local tt entry (%pM) pending to be removed: %s\n", @@ -499,9 +499,9 @@ void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, if (!tt_local_entry) goto out; - flags = TT_CLIENT_DEL; + flags = BATADV_TT_CLIENT_DEL; if (roaming) - flags |= TT_CLIENT_ROAM; + flags |= BATADV_TT_CLIENT_ROAM; batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message); out: @@ -509,12 +509,36 @@ out: batadv_tt_local_entry_free_ref(tt_local_entry); } -static void batadv_tt_local_purge(struct bat_priv *bat_priv) +static void batadv_tt_local_purge_list(struct bat_priv *bat_priv, + struct hlist_head *head) { - struct hashtable_t *hash = bat_priv->tt_local_hash; struct tt_local_entry *tt_local_entry; struct tt_common_entry *tt_common_entry; struct hlist_node *node, *node_tmp; + + hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, + hash_entry) { + tt_local_entry = container_of(tt_common_entry, + struct tt_local_entry, common); + if (tt_local_entry->common.flags & BATADV_TT_CLIENT_NOPURGE) + continue; + + /* entry already marked for deletion */ + if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING) + continue; + + if (!batadv_has_timed_out(tt_local_entry->last_seen, + BATADV_TT_LOCAL_TIMEOUT)) + continue; + + batadv_tt_local_set_pending(bat_priv, tt_local_entry, + BATADV_TT_CLIENT_DEL, "timed out"); + } +} + +static void batadv_tt_local_purge(struct bat_priv *bat_priv) +{ + struct hashtable_t *hash = bat_priv->tt_local_hash; struct hlist_head *head; spinlock_t *list_lock; /* protects write access to the hash lists */ uint32_t i; @@ -524,25 +548,7 @@ static void batadv_tt_local_purge(struct bat_priv *bat_priv) list_lock = &hash->list_locks[i]; spin_lock_bh(list_lock); - hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, - head, hash_entry) { - tt_local_entry = container_of(tt_common_entry, - struct tt_local_entry, - common); - if (tt_local_entry->common.flags & TT_CLIENT_NOPURGE) - continue; - - /* entry already marked for deletion */ - if (tt_local_entry->common.flags & TT_CLIENT_PENDING) - continue; - - if (!batadv_has_timed_out(tt_local_entry->last_seen, - BATADV_TT_LOCAL_TIMEOUT)) - continue; - - batadv_tt_local_set_pending(bat_priv, tt_local_entry, - TT_CLIENT_DEL, "timed out"); - } + batadv_tt_local_purge_list(bat_priv, head); spin_unlock_bh(list_lock); } @@ -701,16 +707,16 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, } else { /* there is already a global entry, use this one. */ - /* If there is the TT_CLIENT_ROAM flag set, there is only one - * originator left in the list and we previously received a + /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only + * one originator left in the list and we previously received a * delete + roaming change for this originator. * * We should first delete the old originator before adding the * new one. */ - if (tt_global_entry->common.flags & TT_CLIENT_ROAM) { + if (tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM) { batadv_tt_global_del_orig_list(tt_global_entry); - tt_global_entry->common.flags &= ~TT_CLIENT_ROAM; + tt_global_entry->common.flags &= ~BATADV_TT_CLIENT_ROAM; tt_global_entry->roam_at = 0; } @@ -727,7 +733,8 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, out_remove: /* remove address from local hash if present */ batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr, - "global tt received", flags & TT_CLIENT_ROAM); + "global tt received", + flags & BATADV_TT_CLIENT_ROAM); ret = 1; out: if (tt_global_entry) @@ -759,8 +766,8 @@ batadv_tt_global_print_entry(struct tt_global_entry *tt_global_entry, seq_printf(seq, " * %pM (%3u) via %pM (%3u) [%c%c]\n", tt_global_entry->common.addr, orig_entry->ttvn, orig_entry->orig_node->orig, last_ttvn, - (flags & TT_CLIENT_ROAM ? 'R' : '.'), - (flags & TT_CLIENT_WIFI ? 'W' : '.')); + (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), + (flags & BATADV_TT_CLIENT_WIFI ? 'W' : '.')); } } @@ -874,8 +881,8 @@ static void batadv_tt_global_del_struct(struct bat_priv *bat_priv, } /* If the client is to be deleted, we check if it is the last origantor entry - * within tt_global entry. If yes, we set the TT_CLIENT_ROAM flag and the timer, - * otherwise we simply remove the originator scheduled for deletion. + * within tt_global entry. If yes, we set the BATADV_TT_CLIENT_ROAM flag and the + * timer, otherwise we simply remove the originator scheduled for deletion. */ static void batadv_tt_global_del_roaming(struct bat_priv *bat_priv, @@ -903,7 +910,7 @@ batadv_tt_global_del_roaming(struct bat_priv *bat_priv, if (last_entry) { /* its the last one, mark for roaming. */ - tt_global_entry->common.flags |= TT_CLIENT_ROAM; + tt_global_entry->common.flags |= BATADV_TT_CLIENT_ROAM; tt_global_entry->roam_at = jiffies; } else /* there is another entry, we can simply delete this @@ -942,7 +949,7 @@ static void batadv_tt_global_del(struct bat_priv *bat_priv, * event, there are two possibilities: * 1) the client roamed from node A to node B => if there * is only one originator left for this client, we mark - * it with TT_CLIENT_ROAM, we start a timer and we + * it with BATADV_TT_CLIENT_ROAM, we start a timer and we * wait for node B to claim it. In case of timeout * the entry is purged. * @@ -1022,7 +1029,7 @@ static void batadv_tt_global_roam_purge_list(struct bat_priv *bat_priv, hash_entry) { tt_global_entry = container_of(tt_common_entry, struct tt_global_entry, common); - if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM)) + if (!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM)) continue; if (!batadv_has_timed_out(tt_global_entry->roam_at, BATADV_TT_CLIENT_ROAM_TIMEOUT)) @@ -1096,8 +1103,8 @@ static bool _batadv_is_ap_isolated(struct tt_local_entry *tt_local_entry, { bool ret = false; - if (tt_local_entry->common.flags & TT_CLIENT_WIFI && - tt_global_entry->common.flags & TT_CLIENT_WIFI) + if (tt_local_entry->common.flags & BATADV_TT_CLIENT_WIFI && + tt_global_entry->common.flags & BATADV_TT_CLIENT_WIFI) ret = true; return ret; @@ -1167,7 +1174,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, { uint16_t total = 0, total_one; struct hashtable_t *hash = bat_priv->tt_global_hash; - struct tt_common_entry *tt_common_entry; + struct tt_common_entry *tt_common; struct tt_global_entry *tt_global_entry; struct hlist_node *node; struct hlist_head *head; @@ -1178,9 +1185,8 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, head = &hash->table[i]; rcu_read_lock(); - hlist_for_each_entry_rcu(tt_common_entry, node, - head, hash_entry) { - tt_global_entry = container_of(tt_common_entry, + hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { + tt_global_entry = container_of(tt_common, struct tt_global_entry, common); /* Roaming clients are in the global table for @@ -1188,7 +1194,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, * taken into account while computing the * global crc */ - if (tt_global_entry->common.flags & TT_CLIENT_ROAM) + if (tt_common->flags & BATADV_TT_CLIENT_ROAM) continue; /* find out if this global entry is announced by this @@ -1201,7 +1207,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv, total_one = 0; for (j = 0; j < ETH_ALEN; j++) total_one = crc16_byte(total_one, - tt_global_entry->common.addr[j]); + tt_common->addr[j]); total ^= total_one; } rcu_read_unlock(); @@ -1215,7 +1221,7 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv) { uint16_t total = 0, total_one; struct hashtable_t *hash = bat_priv->tt_local_hash; - struct tt_common_entry *tt_common_entry; + struct tt_common_entry *tt_common; struct hlist_node *node; struct hlist_head *head; uint32_t i; @@ -1225,17 +1231,16 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv) head = &hash->table[i]; rcu_read_lock(); - hlist_for_each_entry_rcu(tt_common_entry, node, - head, hash_entry) { + hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { /* not yet committed clients have not to be taken into * account while computing the CRC */ - if (tt_common_entry->flags & TT_CLIENT_NEW) + if (tt_common->flags & BATADV_TT_CLIENT_NEW) continue; total_one = 0; for (j = 0; j < ETH_ALEN; j++) total_one = crc16_byte(total_one, - tt_common_entry->addr[j]); + tt_common->addr[j]); total ^= total_one; } rcu_read_unlock(); @@ -1331,7 +1336,7 @@ static int batadv_tt_local_valid_entry(const void *entry_ptr, { const struct tt_common_entry *tt_common_entry = entry_ptr; - if (tt_common_entry->flags & TT_CLIENT_NEW) + if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) return 0; return 1; } @@ -1343,7 +1348,7 @@ static int batadv_tt_global_valid(const void *entry_ptr, const struct tt_global_entry *tt_global_entry; const struct orig_node *orig_node = data_ptr; - if (tt_common_entry->flags & TT_CLIENT_ROAM) + if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM) return 0; tt_global_entry = container_of(tt_common_entry, struct tt_global_entry, @@ -1450,17 +1455,17 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv, tt_request = (struct tt_query_packet *)skb_put(skb, sizeof(struct tt_query_packet)); - tt_request->header.packet_type = BAT_TT_QUERY; + tt_request->header.packet_type = BATADV_TT_QUERY; tt_request->header.version = BATADV_COMPAT_VERSION; memcpy(tt_request->src, primary_if->net_dev->dev_addr, ETH_ALEN); memcpy(tt_request->dst, dst_orig_node->orig, ETH_ALEN); tt_request->header.ttl = BATADV_TTL; tt_request->ttvn = ttvn; tt_request->tt_data = htons(tt_crc); - tt_request->flags = TT_REQUEST; + tt_request->flags = BATADV_TT_REQUEST; if (full_table) - tt_request->flags |= TT_FULL_TABLE; + tt_request->flags |= BATADV_TT_FULL_TABLE; neigh_node = batadv_orig_node_get_router(dst_orig_node); if (!neigh_node) @@ -1509,7 +1514,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv, batadv_dbg(DBG_TT, bat_priv, "Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n", tt_request->src, tt_request->ttvn, tt_request->dst, - (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); + (tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); /* Let's get the orig node of the REAL destination */ req_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->dst); @@ -1537,7 +1542,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv, goto out; /* If the full table has been explicitly requested */ - if (tt_request->flags & TT_FULL_TABLE || + if (tt_request->flags & BATADV_TT_FULL_TABLE || !req_dst_orig_node->tt_buff) full_table = true; else @@ -1584,15 +1589,15 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv, tt_response = (struct tt_query_packet *)skb->data; } - tt_response->header.packet_type = BAT_TT_QUERY; + tt_response->header.packet_type = BATADV_TT_QUERY; tt_response->header.version = BATADV_COMPAT_VERSION; tt_response->header.ttl = BATADV_TTL; memcpy(tt_response->src, req_dst_orig_node->orig, ETH_ALEN); memcpy(tt_response->dst, tt_request->src, ETH_ALEN); - tt_response->flags = TT_RESPONSE; + tt_response->flags = BATADV_TT_RESPONSE; if (full_table) - tt_response->flags |= TT_FULL_TABLE; + tt_response->flags |= BATADV_TT_FULL_TABLE; batadv_dbg(DBG_TT, bat_priv, "Sending TT_RESPONSE %pM via %pM for %pM (ttvn: %u)\n", @@ -1639,7 +1644,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv, batadv_dbg(DBG_TT, bat_priv, "Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n", tt_request->src, tt_request->ttvn, - (tt_request->flags & TT_FULL_TABLE ? 'F' : '.')); + (tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn); @@ -1660,7 +1665,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv, /* If the full table has been explicitly requested or the gap * is too big send the whole local translation table */ - if (tt_request->flags & TT_FULL_TABLE || my_ttvn != req_ttvn || + if (tt_request->flags & BATADV_TT_FULL_TABLE || my_ttvn != req_ttvn || !bat_priv->tt_buff) full_table = true; else @@ -1705,20 +1710,20 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv, tt_response = (struct tt_query_packet *)skb->data; } - tt_response->header.packet_type = BAT_TT_QUERY; + tt_response->header.packet_type = BATADV_TT_QUERY; tt_response->header.version = BATADV_COMPAT_VERSION; tt_response->header.ttl = BATADV_TTL; memcpy(tt_response->src, primary_if->net_dev->dev_addr, ETH_ALEN); memcpy(tt_response->dst, tt_request->src, ETH_ALEN); - tt_response->flags = TT_RESPONSE; + tt_response->flags = BATADV_TT_RESPONSE; if (full_table) - tt_response->flags |= TT_FULL_TABLE; + tt_response->flags |= BATADV_TT_FULL_TABLE; batadv_dbg(DBG_TT, bat_priv, "Sending TT_RESPONSE to %pM via %pM [%c]\n", orig_node->orig, neigh_node->addr, - (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); + (tt_response->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); @@ -1764,8 +1769,8 @@ static void _batadv_tt_update_changes(struct bat_priv *bat_priv, int roams; for (i = 0; i < tt_num_changes; i++) { - if ((tt_change + i)->flags & TT_CLIENT_DEL) { - roams = (tt_change + i)->flags & TT_CLIENT_ROAM; + if ((tt_change + i)->flags & BATADV_TT_CLIENT_DEL) { + roams = (tt_change + i)->flags & BATADV_TT_CLIENT_ROAM; batadv_tt_global_del(bat_priv, orig_node, (tt_change + i)->addr, "tt removed by changes", @@ -1840,7 +1845,7 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) /* Check if the client has been logically deleted (but is kept for * consistency purpose) */ - if (tt_local_entry->common.flags & TT_CLIENT_PENDING) + if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING) goto out; ret = true; out: @@ -1859,7 +1864,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, "Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n", tt_response->src, tt_response->ttvn, ntohs(tt_response->tt_data), - (tt_response->flags & TT_FULL_TABLE ? 'F' : '.')); + (tt_response->flags & BATADV_TT_FULL_TABLE ? 'F' : '.')); /* we should have never asked a backbone gw */ if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_response->src)) @@ -1869,7 +1874,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, if (!orig_node) goto out; - if (tt_response->flags & TT_FULL_TABLE) + if (tt_response->flags & BATADV_TT_FULL_TABLE) batadv_tt_fill_gtable(bat_priv, tt_response); else batadv_tt_update_changes(bat_priv, orig_node, @@ -2019,7 +2024,7 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, roam_adv_packet = (struct roam_adv_packet *)skb_put(skb, sizeof(struct roam_adv_packet)); - roam_adv_packet->header.packet_type = BAT_ROAM_ADV; + roam_adv_packet->header.packet_type = BATADV_ROAM_ADV; roam_adv_packet->header.version = BATADV_COMPAT_VERSION; roam_adv_packet->header.ttl = BATADV_TTL; primary_if = batadv_primary_if_get_selected(bat_priv); @@ -2117,11 +2122,11 @@ out: return changed_num; } -/* Purge out all the tt local entries marked with TT_CLIENT_PENDING */ +/* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */ static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv) { struct hashtable_t *hash = bat_priv->tt_local_hash; - struct tt_common_entry *tt_common_entry; + struct tt_common_entry *tt_common; struct tt_local_entry *tt_local_entry; struct hlist_node *node, *node_tmp; struct hlist_head *head; @@ -2136,18 +2141,18 @@ static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv) list_lock = &hash->list_locks[i]; spin_lock_bh(list_lock); - hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, - head, hash_entry) { - if (!(tt_common_entry->flags & TT_CLIENT_PENDING)) + hlist_for_each_entry_safe(tt_common, node, node_tmp, head, + hash_entry) { + if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING)) continue; batadv_dbg(DBG_TT, bat_priv, "Deleting local tt entry (%pM): pending\n", - tt_common_entry->addr); + tt_common->addr); atomic_dec(&bat_priv->num_local_tt); hlist_del_rcu(node); - tt_local_entry = container_of(tt_common_entry, + tt_local_entry = container_of(tt_common, struct tt_local_entry, common); batadv_tt_local_entry_free_ref(tt_local_entry); @@ -2167,7 +2172,7 @@ static int batadv_tt_commit_changes(struct bat_priv *bat_priv, return -ENOENT; changed_num = batadv_tt_set_flags(bat_priv->tt_local_hash, - TT_CLIENT_NEW, false); + BATADV_TT_CLIENT_NEW, false); /* all reset entries have to be counted as local entries */ atomic_add(changed_num, &bat_priv->num_local_tt); @@ -2326,7 +2331,7 @@ bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv, if (!tt_global_entry) goto out; - ret = tt_global_entry->common.flags & TT_CLIENT_ROAM; + ret = tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM; batadv_tt_global_entry_free_ref(tt_global_entry); out: return ret; |