From patchwork Sun Jun 26 23:14:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1188 Return-Path: Received: from contumacia.investici.org (contumacia.investici.org [178.255.144.35]) by open-mesh.org (Postfix) with ESMTPS id 6AF901543D2 for ; Mon, 27 Jun 2011 01:15:14 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 3E82FE82B2; Sun, 26 Jun 2011 23:15:11 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org 3E82FE82B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1309130111; bh=Xj6XckeYQx8Bj/Zvs+KZ7F0rZ5K7p0MJVjUzIlDC8HY=; h=From:To:Cc:Subject:Date:Message-Id; b=J1snrCcFIcO2OOluDfIpwbJkEGrsVkAwgG36XHauqm1q0S+NlfdThXLsFaTgPuSqm QIIR+3W+9ae6ThzdsbgWO0rsv2QJyfX38u0eSFTNNTHWc7+doc38/TAkZhf2I9N9ou 4mIPVQVBAI+QPPolz+PxwzZHCfyh1sgrja50ncOs= From: Antonio Quartulli To: "B.A.T.M.A.N" Date: Mon, 27 Jun 2011 01:14:54 +0200 Message-Id: <1309130094-12861-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: TT_RESPONSE with full table must contain only announced clients 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: Sun, 26 Jun 2011 23:15:14 -0000 In case of TT_RESPONSE containing a full table, only clients already announced can be sent. Therefore, clients added after the last OGM sending must not be sent. Signed-off-by: Antonio Quartulli --- translation-table.c | 12 +++++++++++- types.h | 1 + 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/translation-table.c b/translation-table.c index 4208dc7..6382955 100644 --- a/translation-table.c +++ b/translation-table.c @@ -211,6 +211,7 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) memcpy(tt_local_entry->addr, addr, ETH_ALEN); tt_local_entry->last_seen = jiffies; + tt_local_entry->ttvn = (uint8_t)(atomic_read(&bat_priv->ttvn) + 1); tt_local_entry->flags = NO_FLAGS; atomic_set(&tt_local_entry->refcount, 2); @@ -936,6 +937,14 @@ unlock: return tt_req_node; } +static int tt_local_valid_entry(const void *entry_ptr, const void *data_ptr) +{ + const struct tt_local_entry *tt_local_entry = entry_ptr; + const struct bat_priv *bat_priv = data_ptr; + + return (tt_local_entry->ttvn <= (uint8_t)atomic_read(&bat_priv->ttvn)); +} + static int tt_global_valid_entry(const void *entry_ptr, const void *data_ptr) { const struct tt_global_entry *tt_global_entry = entry_ptr; @@ -1276,7 +1285,8 @@ static bool send_my_tt_response(struct bat_priv *bat_priv, skb = tt_response_fill_table(tt_len, ttvn, bat_priv->tt_local_hash, - primary_if, NULL, NULL); + primary_if, tt_local_valid_entry, + bat_priv); if (!skb) goto out; diff --git a/types.h b/types.h index 582283a..b470c67 100644 --- a/types.h +++ b/types.h @@ -224,6 +224,7 @@ struct socket_packet { struct tt_local_entry { uint8_t addr[ETH_ALEN]; unsigned long last_seen; + uint8_t ttvn; uint8_t flags; atomic_t refcount; struct rcu_head rcu;