b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07
@ 2011-12-07  5:36 Marek Lindner
  2011-12-07  5:42 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM Marek Lindner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Lindner @ 2011-12-07  5:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

David,

we have to more fixes that we would like to get pulled into net-next/linux-3.2.
Both patches address TT protocol misbehavior. Upon merging these patches into
net-next you'll run into merge conflicts.

Patch1:
++<<<<<<< 
 +              tt_global_entry->common.flags |= TT_CLIENT_PENDING;
 +              send_roam_adv(bat_priv, tt_global_entry->common.addr,
++=======
+               tt_global_entry->flags |= TT_CLIENT_ROAM;
+               tt_global_entry->roam_at = jiffies;
+ 
+               send_roam_adv(bat_priv, tt_global_entry->addr,
++>>>>>>> 

Resolution1:
+======
		tt_global_entry->common.flags |= TT_CLIENT_ROAM;
		tt_global_entry->roam_at = jiffies;
		send_roam_adv(bat_priv, tt_global_entry->common.addr,
+======

Patch2:
++<<<<<<< 
 +                      tt_global_entry->common.flags |= TT_CLIENT_ROAM;
 +                      tt_global_entry->roam_at = jiffies;
 +                      goto out;
++=======
+                       /* if we are deleting a global entry due to a roam
+                        * event, there are two possibilities:
+                        * 1) the client roamed from node A to node B => we mark
+                        *    it with TT_CLIENT_ROAM, we start a timer and we
+                        *    wait for node B to claim it. In case of timeout
+                        *    the entry is purged.
+                        * 2) the client roamed to us => we can directly delete
+                        *    the global entry, since it is useless now. */
+                       tt_local_entry = tt_local_hash_find(bat_priv,
+                                                       tt_global_entry->addr);
+                       if (!tt_local_entry) {
+                               tt_global_entry->flags |= TT_CLIENT_ROAM;
+                               tt_global_entry->roam_at = jiffies;
+                               goto out;
+                       }
++>>>>>>>

Resolution2:
+======
			 /* if we are deleting a global entry due to a roam
			 * event, there are two possibilities:
			 * 1) the client roamed from node A to node B => we mark
			 *    it with TT_CLIENT_ROAM, we start a timer and we
			 *    wait for node B to claim it. In case of timeout
			 *    the entry is purged.
			 * 2) the client roamed to us => we can directly delete
			 *    the global entry, since it is useless now. */
			tt_local_entry = tt_local_hash_find(bat_priv,
						tt_global_entry->common.addr);
			if (!tt_local_entry) {
				tt_global_entry->common.flags |= TT_CLIENT_ROAM;
				tt_global_entry->roam_at = jiffies;
				goto out;
			}
+======

Let me know if you have any further question.

Thanks,
Marek

The following changes since commit 1ea6b8f48918282bdca0b32a34095504ee65bab5:

  Linux 3.2-rc1 (2011-11-07 16:16:02 -0800)

are available in the git repository at:
  git://git.open-mesh.org/linux-merge.git batman-adv/maint

Antonio Quartulli (2):
      batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM
      batman-adv: delete global entry in case of roaming

 net/batman-adv/translation-table.c |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM
  2011-12-07  5:36 [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07 Marek Lindner
@ 2011-12-07  5:42 ` Marek Lindner
  2011-12-07  5:42 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: delete global entry in case of roaming Marek Lindner
  2011-12-07 20:07 ` [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2011-12-07  5:42 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, stable

From: Antonio Quartulli <ordex@autistici.org>

In case of a client roaming from node A to node B, the latter have to mark the
corresponding global entry with TT_CLIENT_ROAM (instead of TT_CLIENT_PENDING).

Marking a global entry with TT_CLIENT_PENDING will end up in keeping such entry
forever (because this flag is only meant to be used with local entries and it is
never checked on global ones).

In the worst case (all the clients roaming to the same node A) the local and the
global table will contain exactly the same clients. Batman-adv will continue to
work, but the memory usage is duplicated.

Cc: stable@vger.kernel.org
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/translation-table.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index c7aafc7..c46b140 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -245,9 +245,11 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
 	if (tt_global_entry) {
 		/* This node is probably going to update its tt table */
 		tt_global_entry->orig_node->tt_poss_change = true;
-		/* The global entry has to be marked as PENDING and has to be
+		/* The global entry has to be marked as ROAMING and has to be
 		 * kept for consistency purpose */
-		tt_global_entry->flags |= TT_CLIENT_PENDING;
+		tt_global_entry->flags |= TT_CLIENT_ROAM;
+		tt_global_entry->roam_at = jiffies;
+
 		send_roam_adv(bat_priv, tt_global_entry->addr,
 			      tt_global_entry->orig_node);
 	}
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: delete global entry in case of roaming
  2011-12-07  5:36 [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07 Marek Lindner
  2011-12-07  5:42 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM Marek Lindner
@ 2011-12-07  5:42 ` Marek Lindner
  2011-12-07 20:07 ` [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2011-12-07  5:42 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

From: Antonio Quartulli <ordex@autistici.org>

When receiving a DEL change for a client due to a roaming event (change is
marked with TT_CLIENT_ROAM), each node  has to check if the client roamed
to itself or somewhere else.

In the latter case the global entry is kept to avoid having no route at all
otherwise we can safely delete the global entry

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/translation-table.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index c46b140..5f09a57 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -696,6 +696,7 @@ void tt_global_del(struct bat_priv *bat_priv,
 		   const char *message, bool roaming)
 {
 	struct tt_global_entry *tt_global_entry = NULL;
+	struct tt_local_entry *tt_local_entry = NULL;
 
 	tt_global_entry = tt_global_hash_find(bat_priv, addr);
 	if (!tt_global_entry)
@@ -703,15 +704,29 @@ void tt_global_del(struct bat_priv *bat_priv,
 
 	if (tt_global_entry->orig_node == orig_node) {
 		if (roaming) {
-			tt_global_entry->flags |= TT_CLIENT_ROAM;
-			tt_global_entry->roam_at = jiffies;
-			goto out;
+			/* if we are deleting a global entry due to a roam
+			 * event, there are two possibilities:
+			 * 1) the client roamed from node A to node B => we mark
+			 *    it with TT_CLIENT_ROAM, we start a timer and we
+			 *    wait for node B to claim it. In case of timeout
+			 *    the entry is purged.
+			 * 2) the client roamed to us => we can directly delete
+			 *    the global entry, since it is useless now. */
+			tt_local_entry = tt_local_hash_find(bat_priv,
+							tt_global_entry->addr);
+			if (!tt_local_entry) {
+				tt_global_entry->flags |= TT_CLIENT_ROAM;
+				tt_global_entry->roam_at = jiffies;
+				goto out;
+			}
 		}
 		_tt_global_del(bat_priv, tt_global_entry, message);
 	}
 out:
 	if (tt_global_entry)
 		tt_global_entry_free_ref(tt_global_entry);
+	if (tt_local_entry)
+		tt_local_entry_free_ref(tt_local_entry);
 }
 
 void tt_global_del_orig(struct bat_priv *bat_priv,
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07
  2011-12-07  5:36 [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07 Marek Lindner
  2011-12-07  5:42 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM Marek Lindner
  2011-12-07  5:42 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: delete global entry in case of roaming Marek Lindner
@ 2011-12-07 20:07 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-12-07 20:07 UTC (permalink / raw)
  To: lindner_marek; +Cc: netdev, b.a.t.m.a.n

From: Marek Lindner <lindner_marek@yahoo.de>
Date: Wed,  7 Dec 2011 13:36:40 +0800

> The following changes since commit 1ea6b8f48918282bdca0b32a34095504ee65bab5:
> 
>   Linux 3.2-rc1 (2011-11-07 16:16:02 -0800)
> 
> are available in the git repository at:
>   git://git.open-mesh.org/linux-merge.git batman-adv/maint
> 
> Antonio Quartulli (2):
>       batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM
>       batman-adv: delete global entry in case of roaming

Pulled, thanks.

And also thanks for the heads-up about the conflicts.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-07 20:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07  5:36 [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07 Marek Lindner
2011-12-07  5:42 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: in case of roaming mark the client with TT_CLIENT_ROAM Marek Lindner
2011-12-07  5:42 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: delete global entry in case of roaming Marek Lindner
2011-12-07 20:07 ` [B.A.T.M.A.N.] pull request: batman-adv 2011-12-07 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).