From patchwork Thu Oct 13 13:42:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1287 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id D33CC6007BC for ; Thu, 13 Oct 2011 15:43:45 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [217.150.252.179] (confino [217.150.252.179]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 103EAC8661; Thu, 13 Oct 2011 13:43:43 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org 103EAC8661 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1318513425; bh=ez+fzQyTYMUrWp8PATIhrjvG/jmKdI7tDgKGWBw0oD0=; h=From:To:Cc:Subject:Date:Message-Id; b=XE4Id6oFWn6lG+VqstZfQkCHLI1SKYqnswZIHEU7efQLl3hwwOFu+UiNg8SNRmnIa lxgUCTT314ZMTK5x4aNKF+nXMb8g8S+pML4dVxcqZRwsdBpyTIUQmX5V07s2wxMp5Y 9T9+fRUKBvOZGLH03+BADNcgaqWwsN0V9kvh7EU0= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 13 Oct 2011 15:42:50 +0200 Message-Id: <1318513370-9868-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: correctly set the data field in the TT_REPONSE message 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: Thu, 13 Oct 2011 13:43:46 -0000 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 --- 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; }