aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2012-09-13 18:18:46 +0200
committerAntonio Quartulli <ordex@autistici.org>2012-11-14 21:00:35 +0100
commit28709878b6a7d15362ba63bde01d42c38f88be9d (patch)
tree3c5c13c4cf6fe61bec2e7d5ae2b8a3d20a40cac9 /net/batman-adv
parentbatman-adv: allow bla traffic only after first worker period (diff)
downloadlinux-dev-28709878b6a7d15362ba63bde01d42c38f88be9d.tar.xz
linux-dev-28709878b6a7d15362ba63bde01d42c38f88be9d.zip
batman-adv: wait multiple periods before activating bla
For some reasons (bridge forward delay, network device setup order, etc) the initial bridge loop avoidance announcement packets may be lost. This may lead to problems in finding other backbone gws, and therfore create loops in the startup time. Fix this by extending the waiting periods to 3 (define can be changed) before allowing broadcast traffic. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c9
-rw-r--r--net/batman-adv/main.h1
-rw-r--r--net/batman-adv/types.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 8cd97d59ee61..bda8b1710806 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -378,6 +378,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
entry->crc = BATADV_BLA_CRC_INIT;
entry->bat_priv = bat_priv;
atomic_set(&entry->request_sent, 0);
+ atomic_set(&entry->wait_periods, 0);
memcpy(entry->orig, orig, ETH_ALEN);
/* one for the hash, one for returning */
@@ -407,6 +408,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
/* this will be decreased in the worker thread */
atomic_inc(&entry->request_sent);
+ atomic_set(&entry->wait_periods, BATADV_BLA_WAIT_PERIODS);
atomic_inc(&bat_priv->bla.num_requests);
}
@@ -1148,12 +1150,17 @@ static void batadv_bla_periodic_work(struct work_struct *work)
* problems when we are not yet known as backbone gw
* in the backbone.
*
- * We can reset this now and allow traffic again.
+ * We can reset this now after we waited some periods
+ * to give bridge forward delays and bla group forming
+ * some grace time.
*/
if (atomic_read(&backbone_gw->request_sent) == 0)
continue;
+ if (!atomic_dec_and_test(&backbone_gw->wait_periods))
+ continue;
+
atomic_dec(&backbone_gw->bat_priv->bla.num_requests);
atomic_set(&backbone_gw->request_sent, 0);
}
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 240c74ffeb93..8f149bb66817 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -95,6 +95,7 @@
#define BATADV_BLA_PERIOD_LENGTH 10000 /* 10 seconds */
#define BATADV_BLA_BACKBONE_TIMEOUT (BATADV_BLA_PERIOD_LENGTH * 3)
#define BATADV_BLA_CLAIM_TIMEOUT (BATADV_BLA_PERIOD_LENGTH * 10)
+#define BATADV_BLA_WAIT_PERIODS 3
#define BATADV_DUPLIST_SIZE 16
#define BATADV_DUPLIST_TIMEOUT 500 /* 500 ms */
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index e8a1b18ae546..fa09961652a1 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -369,6 +369,7 @@ struct batadv_backbone_gw {
struct hlist_node hash_entry;
struct batadv_priv *bat_priv;
unsigned long lasttime; /* last time we heard of this backbone gw */
+ atomic_t wait_periods;
atomic_t request_sent;
atomic_t refcount;
struct rcu_head rcu;