All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: correctly set the data field in the TT_REPONSE message
@ 2011-10-13 13:42 Antonio Quartulli
  2011-10-17 12:25 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: correctly set the data field in the TT_REPONSE packet Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2011-10-13 13:42 UTC (permalink / raw)
  To: b.a.t.m.a.n

In the TT_RESPONSE message, the number of carried entries was not correctly set.
In case of TT_QUERY message of type TT_RESPONSE the data field represents the
number of entries that are going to be sent. Such number has to be set *after*
counting the number of successfully copied entries.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 translation-table.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index 6102cd2..b3e670b 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1050,7 +1050,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
 	tt_response = (struct tt_query_packet *)skb_put(skb,
 						     tt_query_size + tt_len);
 	tt_response->ttvn = ttvn;
-	tt_response->tt_data = htons(tt_tot);
 
 	tt_change = (struct tt_change *)(skb->data + tt_query_size);
 	tt_count = 0;
@@ -1076,6 +1075,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
 	}
 	rcu_read_unlock();
 
+	/* store in the message the number of entries we have successfully
+	 * copied */
+	tt_response->tt_data = htons(tt_count);
+
 out:
 	return skb;
 }
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2] batman-adv: correctly set the data field in the TT_REPONSE packet
  2011-10-13 13:42 [B.A.T.M.A.N.] [PATCH] batman-adv: correctly set the data field in the TT_REPONSE message Antonio Quartulli
@ 2011-10-17 12:25 ` Antonio Quartulli
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2011-10-17 12:25 UTC (permalink / raw)
  To: b.a.t.m.a.n

In the TT_RESPONSE packet, the number of carried entries is not correctly set.
This leads to a wrong interpretation of the packet payload on the receiver side
causing random entries to be added to the global translation table. Therefore
the latter gets always corrupted, triggering a table recovery all the time.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 translation-table.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index 2d2cfc1..1867336 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1054,7 +1054,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
 	tt_response = (struct tt_query_packet *)skb_put(skb,
 						     tt_query_size + tt_len);
 	tt_response->ttvn = ttvn;
-	tt_response->tt_data = htons(tt_tot);
 
 	tt_change = (struct tt_change *)(skb->data + tt_query_size);
 	tt_count = 0;
@@ -1080,6 +1079,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
 	}
 	rcu_read_unlock();
 
+	/* store in the message the number of entries we have successfully
+	 * copied */
+	tt_response->tt_data = htons(tt_count);
+
 out:
 	return skb;
 }
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: correctly set the data field in the TT_REPONSE packet
@ 2011-10-17 12:46 Marek Lindner
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2011-10-17 12:46 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday, October 17, 2011 14:25:13 Antonio Quartulli wrote:
> In the TT_RESPONSE packet, the number of carried entries is not correctly
> set. This leads to a wrong interpretation of the packet payload on the
> receiver side causing random entries to be added to the global translation
> table. Therefore the latter gets always corrupted, triggering a table
> recovery all the time.

Applied in revision ff7887c.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-17 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-13 13:42 [B.A.T.M.A.N.] [PATCH] batman-adv: correctly set the data field in the TT_REPONSE message Antonio Quartulli
2011-10-17 12:25 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: correctly set the data field in the TT_REPONSE packet Antonio Quartulli
2011-10-17 12:46 Marek Lindner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.