From patchwork Mon Oct 29 08:58:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 194904 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 4DCCC2C008B for ; Mon, 29 Oct 2012 20:00:06 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758239Ab2J2I7n (ORCPT ); Mon, 29 Oct 2012 04:59:43 -0400 Received: from contumacia.investici.org ([178.255.144.35]:54254 "EHLO contumacia.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758196Ab2J2I7F (ORCPT ); Mon, 29 Oct 2012 04:59:05 -0400 Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 3784DE86C3; Mon, 29 Oct 2012 08:59:04 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org 3784DE86C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1351501144; bh=T5pXrGDynE+Y1klRGQSFM3zr5xBLKsYqzfbVZF92uj0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=rnN7vrjKjsgiTFBTmKYQfP8MZ272hSMZZO95Hq9JARtFf8TlpgbeU5t+9VN7BBf9e MXSFnFd8Yc4pJxiSmsOgMHQYzwNPN25b5yZJAa2a1UKVJxcF4GpqnvXRVUErWapDHk IgDz3jCdd4h+cd6qbvgK5Tw6/0H7iAO07SVbsyY4= From: Antonio Quartulli To: davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Antonio Quartulli Subject: [PATCH 11/16] batman-adv: properly store the roaming time Date: Mon, 29 Oct 2012 09:58:12 +0100 Message-Id: <1351501097-1289-12-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1351501097-1289-1-git-send-email-ordex@autistici.org> References: <1351501097-1289-1-git-send-email-ordex@autistici.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org in case of a new global entry added because of roaming, the roam_at field must be properly initiated with the current time. This value will be later use to purge this entry out on time out (if nobody claims it). Instead roam_at field is now set to zero in this situation leading to an immediate purging of the related entry. Signed-off-by: Antonio Quartulli --- net/batman-adv/translation-table.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 42a74e3..0ac39d5 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -726,6 +726,12 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, common->flags = flags; tt_global_entry->roam_at = 0; + /* node must store current time in case of roaming. This is + * needed to purge this entry out on timeout (if nobody claims + * it) + */ + if (flags & BATADV_TT_CLIENT_ROAM) + tt_global_entry->roam_at = jiffies; atomic_set(&common->refcount, 2); common->added_at = jiffies;