[v2] batman-adv: use orig_hash_find() instead of get_orig_node() in TT code

Message ID 1318424090-22862-1-git-send-email-ordex@autistici.org (mailing list archive)
State Accepted, archived
Headers

Commit Message

Antonio Quartulli Oct. 12, 2011, 12:54 p.m. UTC
  get_orig_node() tries to retrieves an orig_node object and possibly creates it if
not present. This is not the wanted behaviours in the translation-table code,
instead we want to get the orig_node only if it really exists, without creating
it.

Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 translation-table.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Marek Lindner Oct. 12, 2011, 3:11 p.m. UTC | #1
On Wednesday, October 12, 2011 14:54:50 Antonio Quartulli wrote:
> get_orig_node() tries to retrieves an orig_node object and possibly creates
> it if not present. This is not the wanted behaviours in the
> translation-table code, instead we want to get the orig_node only if it
> really exists, without creating it.

Applied in revision 62c7140.

Thanks,
Marek
  

Patch

diff --git a/translation-table.c b/translation-table.c
index 7de9960..6102cd2 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1170,11 +1170,11 @@  static bool send_other_tt_response(struct bat_priv *bat_priv,
 		(tt_request->flags & TT_FULL_TABLE ? 'F' : '.'));
 
 	/* Let's get the orig node of the REAL destination */
-	req_dst_orig_node = get_orig_node(bat_priv, tt_request->dst);
+	req_dst_orig_node = orig_hash_find(bat_priv, tt_request->dst);
 	if (!req_dst_orig_node)
 		goto out;
 
-	res_dst_orig_node = get_orig_node(bat_priv, tt_request->src);
+	res_dst_orig_node = orig_hash_find(bat_priv, tt_request->src);
 	if (!res_dst_orig_node)
 		goto out;
 
@@ -1300,7 +1300,7 @@  static bool send_my_tt_response(struct bat_priv *bat_priv,
 	my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
 	req_ttvn = tt_request->ttvn;
 
-	orig_node = get_orig_node(bat_priv, tt_request->src);
+	orig_node = orig_hash_find(bat_priv, tt_request->src);
 	if (!orig_node)
 		goto out;