* [B.A.T.M.A.N.] [PATCHv2 0/5] TT "fixing" campaign
@ 2012-11-06 11:05 Antonio Quartulli
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 1/5] batman-adv: fix TT packet rerouting Antonio Quartulli
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Antonio Quartulli @ 2012-11-06 11:05 UTC (permalink / raw)
To: b.a.t.m.a.n
Hello,
This is a second version of the TT patchset I recently sent.
In this case I decided to rearrange the patches. Pathces listed here are not
improvements, but they are fixes that should go into batman-adv/next.
The remaining patches, which are improvements intended for batman-adv/master,
will be sent in another patchset soon.
Thank you,
Antonio Quartulli (5):
batman-adv: fix TT packet rerouting
batman-adv: fix debug message
batman-adv: remove useless goto
batman-adv: send ROAMING_ADV once
batman-adv: fix local client recognition in is_my_client()
routing.c | 36 ++++++++++++++++++++++++++----------
translation-table.c | 10 ++++++----
2 files changed, 32 insertions(+), 14 deletions(-)
--
1.8.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [B.A.T.M.A.N.] [PATCHv2 1/5] batman-adv: fix TT packet rerouting
2012-11-06 11:05 [B.A.T.M.A.N.] [PATCHv2 0/5] TT "fixing" campaign Antonio Quartulli
@ 2012-11-06 11:05 ` Antonio Quartulli
2012-11-07 15:41 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 2/5] batman-adv: fix debug message Antonio Quartulli
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Antonio Quartulli @ 2012-11-06 11:05 UTC (permalink / raw)
To: b.a.t.m.a.n
When the node checks for a packet to be re-routed or not, first it
should consider whether the destination is a local client. Only after
this check, the node can eventually search the global table.
This was introduced by ("batman-adv: substitute tt_poss_change with a
per-tt_entry flag")
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
routing.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/routing.c b/routing.c
index d5a01d1..c190c73 100644
--- a/routing.c
+++ b/routing.c
@@ -890,22 +890,37 @@ batadv_reroute_unicast_packet(struct batadv_priv *bat_priv,
struct batadv_unicast_packet *unicast_packet,
uint8_t *dst_addr)
{
- struct batadv_orig_node *orig_node;
+ struct batadv_orig_node *orig_node = NULL;
+ struct batadv_hard_iface *primary_if = NULL;
bool ret = false;
+ uint8_t *orig_addr, orig_ttvn;
- orig_node = batadv_transtable_search(bat_priv, NULL, dst_addr);
- if (!orig_node)
- goto out;
+ if (batadv_is_my_client(bat_priv, dst_addr)) {
+ primary_if = batadv_primary_if_get_selected(bat_priv);
+ if (!primary_if)
+ goto out;
+ orig_addr = primary_if->net_dev->dev_addr;
+ orig_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn);
+ } else {
+ orig_node = batadv_transtable_search(bat_priv, NULL, dst_addr);
+ if (!orig_node)
+ goto out;
- if (batadv_compare_eth(orig_node->orig, unicast_packet->dest))
- goto out;
+ if (batadv_compare_eth(orig_node->orig, unicast_packet->dest))
+ goto out;
+
+ orig_addr = orig_node->orig;
+ orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
+ }
/* update the packet header */
- memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
- unicast_packet->ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
+ memcpy(unicast_packet->dest, orig_addr, ETH_ALEN);
+ unicast_packet->ttvn = orig_ttvn;
ret = true;
out:
+ if (primary_if)
+ batadv_hardif_free_ref(primary_if);
if (orig_node)
batadv_orig_node_free_ref(orig_node);
--
1.8.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [B.A.T.M.A.N.] [PATCHv2 2/5] batman-adv: fix debug message
2012-11-06 11:05 [B.A.T.M.A.N.] [PATCHv2 0/5] TT "fixing" campaign Antonio Quartulli
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 1/5] batman-adv: fix TT packet rerouting Antonio Quartulli
@ 2012-11-06 11:05 ` Antonio Quartulli
2012-11-07 15:43 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 3/5] batman-adv: remove useless goto Antonio Quartulli
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Antonio Quartulli @ 2012-11-06 11:05 UTC (permalink / raw)
To: b.a.t.m.a.n
In case of re-routing, the old_ttvn must be saved before being
overwritten, otherwise the debug message will obviously print the
new one.
This was introduced by ("batman-adv: substitute tt_poss_change with a
per-tt_entry flag")
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
routing.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/routing.c b/routing.c
index c190c73..63ff456 100644
--- a/routing.c
+++ b/routing.c
@@ -929,7 +929,7 @@ out:
static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
struct sk_buff *skb) {
- uint8_t curr_ttvn;
+ uint8_t curr_ttvn, old_ttvn;
struct batadv_orig_node *orig_node;
struct ethhdr *ethhdr;
struct batadv_hard_iface *primary_if;
@@ -994,6 +994,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
if (!is_old_ttvn)
return 1;
+ old_ttvn = unicast_packet->ttvn;
/* the packet was forged based on outdated network information. Its
* destination can possibly be updated and forwarded towards the new
* target host
@@ -1003,7 +1004,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, bat_priv,
"Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n",
unicast_packet->dest, ethhdr->h_dest,
- unicast_packet->ttvn, curr_ttvn);
+ old_ttvn, curr_ttvn);
return 1;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [B.A.T.M.A.N.] [PATCHv2 3/5] batman-adv: remove useless goto
2012-11-06 11:05 [B.A.T.M.A.N.] [PATCHv2 0/5] TT "fixing" campaign Antonio Quartulli
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 1/5] batman-adv: fix TT packet rerouting Antonio Quartulli
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 2/5] batman-adv: fix debug message Antonio Quartulli
@ 2012-11-06 11:05 ` Antonio Quartulli
2012-11-07 15:44 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 4/5] batman-adv: send ROAMING_ADV once Antonio Quartulli
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 5/5] batman-adv: fix local client recognition in is_my_client() Antonio Quartulli
4 siblings, 1 reply; 11+ messages in thread
From: Antonio Quartulli @ 2012-11-06 11:05 UTC (permalink / raw)
To: b.a.t.m.a.n
This was introduced by ("batman-adv: roaming handling mechanism redesign")
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
translation-table.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/translation-table.c b/translation-table.c
index 6fecb94..59e64bc 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -292,7 +292,6 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
*/
tt_local->common.flags &= ~BATADV_TT_CLIENT_ROAM;
roamed_back = true;
- goto check_roaming;
}
goto check_roaming;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [B.A.T.M.A.N.] [PATCHv2 4/5] batman-adv: send ROAMING_ADV once
2012-11-06 11:05 [B.A.T.M.A.N.] [PATCHv2 0/5] TT "fixing" campaign Antonio Quartulli
` (2 preceding siblings ...)
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 3/5] batman-adv: remove useless goto Antonio Quartulli
@ 2012-11-06 11:05 ` Antonio Quartulli
2012-11-07 20:14 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 5/5] batman-adv: fix local client recognition in is_my_client() Antonio Quartulli
4 siblings, 1 reply; 11+ messages in thread
From: Antonio Quartulli @ 2012-11-06 11:05 UTC (permalink / raw)
To: b.a.t.m.a.n
If a client roaming has already been advertised, the node should
prevent it from doing the same more than once. To achieve this, the
node has to check the ROAM flag on the global client: if this is set
already, then the ROAMING_ADV for this client has already been sent.
This should be merged with changes done by ("batman-adv: roaming
handling mechanism redesign")
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
translation-table.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/translation-table.c b/translation-table.c
index 59e64bc..517324a 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -336,8 +336,10 @@ add_event:
batadv_tt_local_event(bat_priv, addr, tt_local->common.flags);
check_roaming:
- /* Check whether it is a roaming! */
- if (tt_global) {
+ /* Check whether it is a roaming, but don't do anything if the roaming
+ * process has already been handled
+ */
+ if (tt_global && !(tt_global->common.flags & BATADV_TT_CLIENT_ROAM)) {
/* These node are probably going to update their tt table */
head = &tt_global->orig_list;
rcu_read_lock();
--
1.8.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [B.A.T.M.A.N.] [PATCHv2 5/5] batman-adv: fix local client recognition in is_my_client()
2012-11-06 11:05 [B.A.T.M.A.N.] [PATCHv2 0/5] TT "fixing" campaign Antonio Quartulli
` (3 preceding siblings ...)
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 4/5] batman-adv: send ROAMING_ADV once Antonio Quartulli
@ 2012-11-06 11:05 ` Antonio Quartulli
2012-11-07 20:31 ` Marek Lindner
4 siblings, 1 reply; 11+ messages in thread
From: Antonio Quartulli @ 2012-11-06 11:05 UTC (permalink / raw)
To: b.a.t.m.a.n
A tt_local_entry which ROAM flag is set cannot be considered a local
client anymore. Having the ROAM flag set means that the client roamed
away and that the nodes received a ROAMING_ADV for such event
This was introduced by ("batman-adv: roaming handling mechanism
redesign")
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
translation-table.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/translation-table.c b/translation-table.c
index 517324a..fdcb726 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -2044,7 +2044,8 @@ bool batadv_is_my_client(struct batadv_priv *bat_priv, const uint8_t *addr)
/* Check if the client has been logically deleted (but is kept for
* consistency purpose)
*/
- if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING)
+ if ((tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING) ||
+ (tt_local_entry->common.flags & BATADV_TT_CLIENT_ROAM))
goto out;
ret = true;
out:
--
1.8.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv2 1/5] batman-adv: fix TT packet rerouting
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 1/5] batman-adv: fix TT packet rerouting Antonio Quartulli
@ 2012-11-07 15:41 ` Marek Lindner
0 siblings, 0 replies; 11+ messages in thread
From: Marek Lindner @ 2012-11-07 15:41 UTC (permalink / raw)
To: b.a.t.m.a.n
On Tuesday, November 06, 2012 19:05:19 Antonio Quartulli wrote:
> When the node checks for a packet to be re-routed or not, first it
> should consider whether the destination is a local client. Only after
> this check, the node can eventually search the global table.
>
> This was introduced by ("batman-adv: substitute tt_poss_change with a
> per-tt_entry flag")
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> routing.c | 31 +++++++++++++++++++++++--------
> 1 file changed, 23 insertions(+), 8 deletions(-)
Applied in revision 3bd73df.
Thanks,
Marek
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv2 2/5] batman-adv: fix debug message
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 2/5] batman-adv: fix debug message Antonio Quartulli
@ 2012-11-07 15:43 ` Marek Lindner
0 siblings, 0 replies; 11+ messages in thread
From: Marek Lindner @ 2012-11-07 15:43 UTC (permalink / raw)
To: b.a.t.m.a.n
On Tuesday, November 06, 2012 19:05:20 Antonio Quartulli wrote:
> In case of re-routing, the old_ttvn must be saved before being
> overwritten, otherwise the debug message will obviously print the
> new one.
>
> This was introduced by ("batman-adv: substitute tt_poss_change with a
> per-tt_entry flag")
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> routing.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied in revision 44d6e4a.
Thanks,
Marek
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv2 3/5] batman-adv: remove useless goto
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 3/5] batman-adv: remove useless goto Antonio Quartulli
@ 2012-11-07 15:44 ` Marek Lindner
0 siblings, 0 replies; 11+ messages in thread
From: Marek Lindner @ 2012-11-07 15:44 UTC (permalink / raw)
To: b.a.t.m.a.n
On Tuesday, November 06, 2012 19:05:21 Antonio Quartulli wrote:
> This was introduced by ("batman-adv: roaming handling mechanism redesign")
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> translation-table.c | 1 -
> 1 file changed, 1 deletion(-)
Applied in revision fe43315.
Thanks,
Marek
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv2 4/5] batman-adv: send ROAMING_ADV once
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 4/5] batman-adv: send ROAMING_ADV once Antonio Quartulli
@ 2012-11-07 20:14 ` Marek Lindner
0 siblings, 0 replies; 11+ messages in thread
From: Marek Lindner @ 2012-11-07 20:14 UTC (permalink / raw)
To: b.a.t.m.a.n
On Tuesday, November 06, 2012 19:05:22 Antonio Quartulli wrote:
> If a client roaming has already been advertised, the node should
> prevent it from doing the same more than once. To achieve this, the
> node has to check the ROAM flag on the global client: if this is set
> already, then the ROAMING_ADV for this client has already been sent.
>
> This should be merged with changes done by ("batman-adv: roaming
> handling mechanism redesign")
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> translation-table.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Applied in revision b8416c2.
Thanks,
Marek
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv2 5/5] batman-adv: fix local client recognition in is_my_client()
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 5/5] batman-adv: fix local client recognition in is_my_client() Antonio Quartulli
@ 2012-11-07 20:31 ` Marek Lindner
0 siblings, 0 replies; 11+ messages in thread
From: Marek Lindner @ 2012-11-07 20:31 UTC (permalink / raw)
To: b.a.t.m.a.n
On Tuesday, November 06, 2012 19:05:23 Antonio Quartulli wrote:
> A tt_local_entry which ROAM flag is set cannot be considered a local
> client anymore. Having the ROAM flag set means that the client roamed
> away and that the nodes received a ROAMING_ADV for such event
>
> This was introduced by ("batman-adv: roaming handling mechanism
> redesign")
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> translation-table.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied in revision 7cfe135.
Thanks,
Marek
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-11-07 20:31 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-06 11:05 [B.A.T.M.A.N.] [PATCHv2 0/5] TT "fixing" campaign Antonio Quartulli
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 1/5] batman-adv: fix TT packet rerouting Antonio Quartulli
2012-11-07 15:41 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 2/5] batman-adv: fix debug message Antonio Quartulli
2012-11-07 15:43 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 3/5] batman-adv: remove useless goto Antonio Quartulli
2012-11-07 15:44 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 4/5] batman-adv: send ROAMING_ADV once Antonio Quartulli
2012-11-07 20:14 ` Marek Lindner
2012-11-06 11:05 ` [B.A.T.M.A.N.] [PATCHv2 5/5] batman-adv: fix local client recognition in is_my_client() Antonio Quartulli
2012-11-07 20:31 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox