Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278751
b: refs/heads/master
c: 80b3f58
h: refs/heads/master
i:
  278749: ff7004d
  278747: 8fd2503
  278743: 0c3a0e5
  278735: b1f3c69
  278719: 5beb26c
v: v3
  • Loading branch information
Simon Wunderlich authored and Sven Eckelmann committed Nov 20, 2011
1 parent 6dec22d commit eb7549b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 697f25314a923f75deef0d3b10991dd103f59d93
refs/heads/master: 80b3f58cf416770ae89b30734d252d641a56d289
28 changes: 22 additions & 6 deletions trunk/net/batman-adv/translation-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
struct bat_priv *bat_priv = netdev_priv(soft_iface);
struct tt_local_entry *tt_local_entry = NULL;
struct tt_global_entry *tt_global_entry = NULL;
int hash_added;

tt_local_entry = tt_local_hash_find(bat_priv, addr);

Expand Down Expand Up @@ -217,16 +218,23 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
if (compare_eth(addr, soft_iface->dev_addr))
tt_local_entry->common.flags |= TT_CLIENT_NOPURGE;

hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig,
&tt_local_entry->common,
&tt_local_entry->common.hash_entry);

if (unlikely(hash_added != 0)) {
/* remove the reference for the hash */
tt_local_entry_free_ref(tt_local_entry);
goto out;
}

tt_local_event(bat_priv, addr, tt_local_entry->common.flags);

/* 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;

hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig,
&tt_local_entry->common, &tt_local_entry->common.hash_entry);

/* remove address from global hash if present */
tt_global_entry = tt_global_hash_find(bat_priv, addr);

Expand Down Expand Up @@ -499,6 +507,7 @@ int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
struct tt_global_entry *tt_global_entry;
struct orig_node *orig_node_tmp;
int ret = 0;
int hash_added;

tt_global_entry = tt_global_hash_find(bat_priv, tt_addr);

Expand All @@ -518,9 +527,15 @@ int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
tt_global_entry->ttvn = ttvn;
tt_global_entry->roam_at = 0;

hash_add(bat_priv->tt_global_hash, compare_tt,
choose_orig, &tt_global_entry->common,
&tt_global_entry->common.hash_entry);
hash_added = hash_add(bat_priv->tt_global_hash, compare_tt,
choose_orig, &tt_global_entry->common,
&tt_global_entry->common.hash_entry);

if (unlikely(hash_added != 0)) {
/* remove the reference for the hash */
tt_global_entry_free_ref(tt_global_entry);
goto out_remove;
}
atomic_inc(&orig_node->tt_size);
} else {
if (tt_global_entry->orig_node != orig_node) {
Expand All @@ -543,6 +558,7 @@ int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
"Creating new global tt entry: %pM (via %pM)\n",
tt_global_entry->common.addr, orig_node->orig);

out_remove:
/* remove address from local hash if present */
tt_local_remove(bat_priv, tt_global_entry->common.addr,
"global tt received", roaming);
Expand Down

0 comments on commit eb7549b

Please sign in to comment.