batman-adv: yet another critical bug fix
[feed/routing.git] / patches / batman-adv_correctly_set_the_data_field_in_the_TT_REPONSE_packet.patch
1 From: Antonio Quartulli <ordex@autistici.org>
2
3 In the TT_RESPONSE packet, the number of carried entries is not correctly set.
4 This leads to a wrong interpretation of the packet payload on the receiver side
5 causing random entries to be added to the global translation table. Therefore
6 the latter gets always corrupted, triggering a table recovery all the time.
7
8 Signed-off-by: Antonio Quartulli <ordex@autistici.org>
9 ---
10 translation-table.c | 5 ++++-
11 1 files changed, 4 insertions(+), 1 deletions(-)
12
13 --- a/translation-table.c
14 +++ b/translation-table.c
15 @@ -1054,7 +1054,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
16 tt_response = (struct tt_query_packet *)skb_put(skb,
17 tt_query_size + tt_len);
18 tt_response->ttvn = ttvn;
19 - tt_response->tt_data = htons(tt_tot);
20
21 tt_change = (struct tt_change *)(skb->data + tt_query_size);
22 tt_count = 0;
23 @@ -1080,6 +1079,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
24 }
25 rcu_read_unlock();
26
27 + /* store in the message the number of entries we have successfully
28 + * copied */
29 + tt_response->tt_data = htons(tt_count);
30 +
31 out:
32 return skb;
33 }
34 --
35 1.7.3.4
36