[2/2] batman-adv: convert the tt_crc to network order

Message ID 1334402127-5211-3-git-send-email-ordex@autistici.org (mailing list archive)
State Accepted, archived
Commit ffcc504a02f8ca3a55b29c1a4824f38e5275e85a
Headers

Commit Message

Antonio Quartulli April 14, 2012, 11:15 a.m. UTC
  Before sending out a TT_Request packet we must convert the tt_crc field value
to network order (since it is 16bits long).

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 translation-table.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Marek Lindner April 17, 2012, 8:48 a.m. UTC | #1
On Saturday, April 14, 2012 13:15:27 Antonio Quartulli wrote:
> Before sending out a TT_Request packet we must convert the tt_crc field
> value to network order (since it is 16bits long).

Applied in revision ffcc504.

Thanks,
Marek
  

Patch

diff --git a/translation-table.c b/translation-table.c
index 72dfbe1..88e4c8e 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1341,7 +1341,7 @@  static int send_tt_request(struct bat_priv *bat_priv,
 	memcpy(tt_request->dst, dst_orig_node->orig, ETH_ALEN);
 	tt_request->header.ttl = TTL;
 	tt_request->ttvn = ttvn;
-	tt_request->tt_data = tt_crc;
+	tt_request->tt_data = htons(tt_crc);
 	tt_request->flags = TT_REQUEST;
 
 	if (full_table)