From patchwork Tue Oct 18 21:01:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1289 Return-Path: Received: from nm6-vm0.bullet.mail.ukl.yahoo.com (nm6-vm0.bullet.mail.ukl.yahoo.com [217.146.183.234]) by open-mesh.org (Postfix) with SMTP id 9930560083D for ; Tue, 18 Oct 2011 23:01:29 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.217] by nm6.bullet.mail.ukl.yahoo.com with NNFMP; 18 Oct 2011 21:01:29 -0000 Received: from [77.238.184.71] by tm10.bullet.mail.ukl.yahoo.com with NNFMP; 18 Oct 2011 21:01:29 -0000 Received: from [127.0.0.1] by smtp140.mail.ukl.yahoo.com with NNFMP; 18 Oct 2011 21:01:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1318971689; bh=7/RinQq21urIxNp/5fukOQtZGJpwllGznrPYSTO05lw=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=TYQrARgarslZMZyrNr0dATeU3jIhD8lv4E9PR4DPrL7RQ4Dr3iVExNoLY1DTUMAG/NOrD5GlZDPCXGAaQetFLyAUOuIKcxEO0HRd5jP2+P9g58zMR/F903dbg91HKaH+kLgxaEBEyp3g4Bl2aNRfQCGGYvrF1W8ez7ztEn5IkM8= X-Yahoo-Newman-Id: 403568.16250.bm@smtp140.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 1nrjNysVM1lKCYXZBq98rLMqsn8fhYI7di7e98xKwCv7uin Ybc5WYfWbQbXZpoqUoJDq.Cyrbs0vCpsjIHr7lo6QdnBjKz8HO_f6xtlymaL ZGw5PwtiA8LxSpIIyEzdNTBiLL3bLuL4kPNbBQQw0hRRHh2nSMvWuUlP3xZf 8rqSw09cY940gF6qqVnyCa_zmQ32Z6qN.9VdycrN_r8nHQL5Xv62yVnNlCOj qyj7kJ2sQb4Gts8Q8ky6E.t97rq0tsqQLGK85i9.385pD1gtL2jrK4arBP9g ppq_oJ4qiD8oRorGwFwJcxdlBT_.Sx_N9mcGh1ejMzRFbIsjwh6p2rGSJs0Y c8hhEL2A__vvsonjvx7Srtfb5soF6bvN5eBeZCt3OSzAliV5IwzgyyA-- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@93.193.17.48 with plain) by smtp140.mail.ukl.yahoo.com with SMTP; 18 Oct 2011 21:01:29 +0000 GMT From: Marek Lindner To: davem@davemloft.net Date: Tue, 18 Oct 2011 23:01:09 +0200 Message-Id: <1318971669-941-3-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1318971669-941-1-git-send-email-lindner_marek@yahoo.de> References: <1318971669-941-1-git-send-email-lindner_marek@yahoo.de> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: correctly set the data field in the TT_REPONSE packet X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2011 21:01:29 -0000 From: Antonio Quartulli 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 Signed-off-by: Marek Lindner --- net/batman-adv/translation-table.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index f599db9..ef1acfd 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -999,7 +999,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; @@ -1025,6 +1024,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; }