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: 120513 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 13AB1B71A0 for ; Wed, 19 Oct 2011 08:01:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753926Ab1JRVBb (ORCPT ); Tue, 18 Oct 2011 17:01:31 -0400 Received: from nm6-vm0.bullet.mail.ukl.yahoo.com ([217.146.183.234]:46678 "HELO nm6-vm0.bullet.mail.ukl.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752471Ab1JRVBa (ORCPT ); Tue, 18 Oct 2011 17:01:30 -0400 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 Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Antonio Quartulli , Marek Lindner Subject: [PATCH 2/2] batman-adv: correctly set the data field in the TT_REPONSE packet 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> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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; }