* [B.A.T.M.A.N.] [PATCH] batman-adv: Fix symmetry check / route flapping in multi interface setups
@ 2012-09-15 21:51 Linus Lüssing
2012-09-16 10:12 ` Antonio Quartulli
0 siblings, 1 reply; 7+ messages in thread
From: Linus Lüssing @ 2012-09-15 21:51 UTC (permalink / raw)
To: b.a.t.m.a.n
If receiving an OGM from a neighbor other than the currently selected
and if it has the same TQ then we are supposed to switch if this
neighbor provides a more symmetric link than the currently selected one.
However this symmetry check currently is broken if the interface of the
neighbor we received the OGM from and the one of the currently selected
neighbor differ: We are currently trying to determine the symmetry of the
link towards the selected router via the link we received the OGM from
instead of just checking via the link towards the currently selected
router.
This leads to way more route switches than necessary and can lead to
permanent route flapping in many common multi interface setups.
This patch fixes this issue by using the right interface for this
symmetry check.
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
This fixes the route flapping observed in ticket 163 (but unfortunately
doesn't fix the main issue of this ticket, the starving routes, yet).
bat_iv_ogm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 7f0adad..2c6b560 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -743,7 +743,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
if (router && (neigh_node->tq_avg == router->tq_avg)) {
orig_node_tmp = router->orig_node;
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
- sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
+ sum_orig = orig_node_tmp->
+ bcast_own_sum[router->if_incoming->if_num];
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
orig_node_tmp = neigh_node->orig_node;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Fix symmetry check / route flapping in multi interface setups
2012-09-15 21:51 [B.A.T.M.A.N.] [PATCH] batman-adv: Fix symmetry check / route flapping in multi interface setups Linus Lüssing
@ 2012-09-16 10:12 ` Antonio Quartulli
2012-09-18 1:01 ` [B.A.T.M.A.N.] [PATCHv2] " Linus Lüssing
0 siblings, 1 reply; 7+ messages in thread
From: Antonio Quartulli @ 2012-09-16 10:12 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 1934 bytes --]
On Sat, Sep 15, 2012 at 11:51:46 +0200, Linus Lüssing wrote:
> If receiving an OGM from a neighbor other than the currently selected
> and if it has the same TQ then we are supposed to switch if this
> neighbor provides a more symmetric link than the currently selected one.
>
> However this symmetry check currently is broken if the interface of the
> neighbor we received the OGM from and the one of the currently selected
> neighbor differ: We are currently trying to determine the symmetry of the
> link towards the selected router via the link we received the OGM from
> instead of just checking via the link towards the currently selected
> router.
>
> This leads to way more route switches than necessary and can lead to
> permanent route flapping in many common multi interface setups.
>
> This patch fixes this issue by using the right interface for this
> symmetry check.
>
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---
> This fixes the route flapping observed in ticket 163 (but unfortunately
> doesn't fix the main issue of this ticket, the starving routes, yet).
>
> bat_iv_ogm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
> index 7f0adad..2c6b560 100644
> --- a/bat_iv_ogm.c
> +++ b/bat_iv_ogm.c
> @@ -743,7 +743,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
> if (router && (neigh_node->tq_avg == router->tq_avg)) {
> orig_node_tmp = router->orig_node;
> spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
> - sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
> + sum_orig = orig_node_tmp->
> + bcast_own_sum[router->if_incoming->if_num];
what about:
int if_num;
...
if_num = router->if_incoming->if_num;
sum_orig = orig_node_tmp->bcast_own_sum[if_num];
?
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread* [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix symmetry check / route flapping in multi interface setups
2012-09-16 10:12 ` Antonio Quartulli
@ 2012-09-18 1:01 ` Linus Lüssing
2012-09-23 9:15 ` Marek Lindner
0 siblings, 1 reply; 7+ messages in thread
From: Linus Lüssing @ 2012-09-18 1:01 UTC (permalink / raw)
To: b.a.t.m.a.n
If receiving an OGM from a neighbor other than the currently selected
and if it has the same TQ then we are supposed to switch if this
neighbor provides a more symmetric link than the currently selected one.
However this symmetry check currently is broken if the interface of the
neighbor we received the OGM from and the one of the currently selected
neighbor differ: We are currently trying to determine the symmetry of the
link towards the selected router via the link we received the OGM from
instead of just checking via the link towards the currently selected
router.
This leads to way more route switches than necessary and can lead to
permanent route flapping in many common multi interface setups.
This patch fixes this issue by using the right interface for this
symmetry check.
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
bat_iv_ogm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 7f0adad..a92a663 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -657,6 +657,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
struct batadv_neigh_node *router = NULL;
struct batadv_orig_node *orig_node_tmp;
struct hlist_node *node;
+ int if_num;
uint8_t sum_orig, sum_neigh;
uint8_t *neigh_addr;
uint8_t tq_avg;
@@ -743,7 +744,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
if (router && (neigh_node->tq_avg == router->tq_avg)) {
orig_node_tmp = router->orig_node;
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
- sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
+ if_num = router->if_incoming->if_num;
+ sum_orig = orig_node_tmp->bcast_own_sum[if_num];
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
orig_node_tmp = neigh_node->orig_node;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix symmetry check / route flapping in multi interface setups
2012-09-18 1:01 ` [B.A.T.M.A.N.] [PATCHv2] " Linus Lüssing
@ 2012-09-23 9:15 ` Marek Lindner
2012-09-23 9:16 ` [B.A.T.M.A.N.] [PATCHv3] " Marek Lindner
0 siblings, 1 reply; 7+ messages in thread
From: Marek Lindner @ 2012-09-23 9:15 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Tuesday, September 18, 2012 09:01:08 Linus Lüssing wrote:
> @@ -743,7 +744,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
> if (router && (neigh_node->tq_avg == router->tq_avg)) {
> orig_node_tmp = router->orig_node;
> spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
> - sum_orig =
> orig_node_tmp->bcast_own_sum[if_incoming->if_num]; + if_num
> = router->if_incoming->if_num;
> + sum_orig = orig_node_tmp->bcast_own_sum[if_num];
> spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
>
> orig_node_tmp = neigh_node->orig_node;
Good catch! May I suggest another modifcation to make this section easier to
understand ? It won't change any behavior it just makes it easier to see where
if_num is coming from.
Cheers,
Marek
^ permalink raw reply [flat|nested] 7+ messages in thread* [B.A.T.M.A.N.] [PATCHv3] batman-adv: Fix symmetry check / route flapping in multi interface setups
2012-09-23 9:15 ` Marek Lindner
@ 2012-09-23 9:16 ` Marek Lindner
2012-09-23 10:44 ` "Linus Lüssing"
0 siblings, 1 reply; 7+ messages in thread
From: Marek Lindner @ 2012-09-23 9:16 UTC (permalink / raw)
To: b.a.t.m.a.n
From: Linus Lüssing <linus.luessing@web.de>
If receiving an OGM from a neighbor other than the currently selected
and if it has the same TQ then we are supposed to switch if this
neighbor provides a more symmetric link than the currently selected one.
However this symmetry check currently is broken if the interface of the
neighbor we received the OGM from and the one of the currently selected
neighbor differ: We are currently trying to determine the symmetry of the
link towards the selected router via the link we received the OGM from
instead of just checking via the link towards the currently selected
router.
This leads to way more route switches than necessary and can lead to
permanent route flapping in many common multi interface setups.
This patch fixes this issue by using the right interface for this
symmetry check.
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
bat_iv_ogm.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 7f0adad..75403a4 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -657,6 +657,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
struct batadv_neigh_node *router = NULL;
struct batadv_orig_node *orig_node_tmp;
struct hlist_node *node;
+ int if_num;
uint8_t sum_orig, sum_neigh;
uint8_t *neigh_addr;
uint8_t tq_avg;
@@ -743,12 +744,14 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
if (router && (neigh_node->tq_avg == router->tq_avg)) {
orig_node_tmp = router->orig_node;
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
- sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
+ if_num = router->if_incoming->if_num;
+ sum_orig = orig_node_tmp->bcast_own_sum[if_num];
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
orig_node_tmp = neigh_node->orig_node;
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
- sum_neigh = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
+ if_num = neigh_node->if_incoming->if_num;
+ sum_neigh = orig_node_tmp->bcast_own_sum[if_num];
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
if (sum_orig >= sum_neigh)
--
1.7.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [B.A.T.M.A.N.] [PATCHv3] batman-adv: Fix symmetry check / route flapping in multi interface setups
2012-09-23 9:16 ` [B.A.T.M.A.N.] [PATCHv3] " Marek Lindner
@ 2012-09-23 10:44 ` "Linus Lüssing"
2012-09-23 15:18 ` Marek Lindner
0 siblings, 1 reply; 7+ messages in thread
From: "Linus Lüssing" @ 2012-09-23 10:44 UTC (permalink / raw)
To: Marek Lindner; +Cc: b.a.t.m.a.n
Yes, looks good. Makes the symmetry patch look more, ehm, "symmetric".
> Gesendet: Sonntag, 23. September 2012 um 11:16 Uhr
> Von: "Marek Lindner" <lindner_marek@yahoo.de>
> An: b.a.t.m.a.n@lists.open-mesh.org
> Cc: "Linus Lüssing" <linus.luessing@web.de>
> Betreff: [PATCHv3] batman-adv: Fix symmetry check / route flapping in multi interface setups
>
> From: Linus Lüssing <linus.luessing@web.de>
>
> If receiving an OGM from a neighbor other than the currently selected
> and if it has the same TQ then we are supposed to switch if this
> neighbor provides a more symmetric link than the currently selected one.
>
> However this symmetry check currently is broken if the interface of the
> neighbor we received the OGM from and the one of the currently selected
> neighbor differ: We are currently trying to determine the symmetry of the
> link towards the selected router via the link we received the OGM from
> instead of just checking via the link towards the currently selected
> router.
>
> This leads to way more route switches than necessary and can lead to
> permanent route flapping in many common multi interface setups.
>
> This patch fixes this issue by using the right interface for this
> symmetry check.
>
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---
> bat_iv_ogm.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
> index 7f0adad..75403a4 100644
> --- a/bat_iv_ogm.c
> +++ b/bat_iv_ogm.c
> @@ -657,6 +657,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
> struct batadv_neigh_node *router = NULL;
> struct batadv_orig_node *orig_node_tmp;
> struct hlist_node *node;
> + int if_num;
> uint8_t sum_orig, sum_neigh;
> uint8_t *neigh_addr;
> uint8_t tq_avg;
> @@ -743,12 +744,14 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
> if (router && (neigh_node->tq_avg == router->tq_avg)) {
> orig_node_tmp = router->orig_node;
> spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
> - sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
> + if_num = router->if_incoming->if_num;
> + sum_orig = orig_node_tmp->bcast_own_sum[if_num];
> spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
>
> orig_node_tmp = neigh_node->orig_node;
> spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
> - sum_neigh = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
> + if_num = neigh_node->if_incoming->if_num;
> + sum_neigh = orig_node_tmp->bcast_own_sum[if_num];
> spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
>
> if (sum_orig >= sum_neigh)
> --
> 1.7.9.1
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-09-23 15:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15 21:51 [B.A.T.M.A.N.] [PATCH] batman-adv: Fix symmetry check / route flapping in multi interface setups Linus Lüssing
2012-09-16 10:12 ` Antonio Quartulli
2012-09-18 1:01 ` [B.A.T.M.A.N.] [PATCHv2] " Linus Lüssing
2012-09-23 9:15 ` Marek Lindner
2012-09-23 9:16 ` [B.A.T.M.A.N.] [PATCHv3] " Marek Lindner
2012-09-23 10:44 ` "Linus Lüssing"
2012-09-23 15:18 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox