The following commit has been merged in the master branch:
commit a4eded7ad2b1d5da0ca60af004a611a209988c75
Merge: 500ab9a253d8258aa0a27c059cc6609528aa73a9 d03cfc8f9a24ca036e655a4bc8ba7e834ea71943
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Fri Jun 22 21:06:26 2012 +0200
Merge branch 'next'
--
batman-adv
The following commit has been merged in the maint branch:
commit d1f13e24ec3ebdadc2bc08c9d4708197279096fa
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Wed Jun 20 14:12:56 2012 +0200
batman-adv: fix race condition in TT full-table replacement
bug introduced with cea194d90b11aff7fc289149e4c7f305fad3535a
In the current TT code, when a TT_Response containing a full table is received
from an originator, first the node purges all the clients for that originator in
the global translation-table and then merges the newly received table.
During the purging phase each client deletion is done by means of a call_rcu()
invocation and at the end of this phase the global entry counter for that
originator is set to 0. However the invoked rcu function decreases the global
entry counter for that originator by one too and since the rcu invocation is
likely to be postponed, the node will end up in first setting the counter to 0
and then decreasing it one by one for each deleted client.
This bug leads to having a wrong global entry counter for the related node, say
X. Then when the node with the broken counter will answer to a TT_REQUEST on
behalf of node X, it will create faulty TT_RESPONSE that will generate an
unrecoverable situation on the node that asked for the full table recover.
The non-recoverability is given by the fact that the node with the broken
counter will keep answering on behalf of X because its knowledge about X's state
(ttvn + tt_crc) is correct.
To solve this problem the counter is not explicitly set to 0 anymore and the
counter decrement is performed right before the invocation of call_rcu().
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
diff --git a/translation-table.c b/translation-table.c
index 660c40f..2ab83d7 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -141,13 +141,14 @@ static void tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
struct tt_orig_list_entry *orig_entry;
orig_entry = container_of(rcu, struct tt_orig_list_entry, rcu);
- atomic_dec(&orig_entry->orig_node->tt_size);
orig_node_free_ref(orig_entry->orig_node);
kfree(orig_entry);
}
static void tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry)
{
+ /* to avoid race conditions, immediately decrease the tt counter */
+ atomic_dec(&orig_entry->orig_node->tt_size);
call_rcu(&orig_entry->rcu, tt_orig_list_entry_free_rcu);
}
@@ -910,7 +911,6 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
}
spin_unlock_bh(list_lock);
}
- atomic_set(&orig_node->tt_size, 0);
orig_node->tt_initialised = false;
}
--
batman-adv
The following commit has been merged in the maint branch:
commit 03a0e3d6098b1bb3b2f43aaf0249a2e471dace61
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Wed Jun 20 17:16:05 2012 +0200
batman-adv: only drop packets of known wifi clients
If the source or destination mac address of an ethernet packet
could not be found in the translation table the packet was
dropped if AP isolation was turned on. This behavior would
make it impossible to send broadcast packets over the mesh as
the broadcast address will never enter the translation table.
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
Acked-by: Antonio Quartulli <ordex(a)autistici.org>
diff --git a/translation-table.c b/translation-table.c
index a66c2dc..660c40f 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -2031,10 +2031,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
{
struct tt_local_entry *tt_local_entry = NULL;
struct tt_global_entry *tt_global_entry = NULL;
- bool ret = true;
+ bool ret = false;
if (!atomic_read(&bat_priv->ap_isolation))
- return false;
+ goto out;
tt_local_entry = tt_local_hash_find(bat_priv, dst);
if (!tt_local_entry)
@@ -2044,10 +2044,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
if (!tt_global_entry)
goto out;
- if (_is_ap_isolated(tt_local_entry, tt_global_entry))
+ if (!_is_ap_isolated(tt_local_entry, tt_global_entry))
goto out;
- ret = false;
+ ret = true;
out:
if (tt_global_entry)
--
batman-adv
The following commit has been merged in the master branch:
commit a738c35ebe7be7a6ba749e014ab2f4cf1b238e22
Author: Simon Wunderlich <simon.wunderlich(a)s2003.tu-chemnitz.de>
Date: Mon Jun 18 12:21:31 2012 +0200
batctl: add support for the bla backbone table in debugfs
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
diff --git a/debug.c b/debug.c
index 928f81d..5dca633 100644
--- a/debug.c
+++ b/debug.c
@@ -70,6 +70,16 @@ void bla_claim_table_usage(void)
printf(" \t -w [interval] watch mode - refresh the bridge loop avoidance claim table continuously\n");
}
+void bla_backbone_table_usage(void)
+{
+ printf("Usage: batctl [options] backbone table\n");
+ printf("options:\n");
+ printf(" \t -h print this help\n");
+ printf(" \t -n don't replace mac addresses with bat-host names\n");
+ printf(" \t -w [interval] watch mode - refresh the bridge loop avoidance backbone table continuously\n");
+}
+
+
void gateways_usage(void)
{
printf("Usage: batctl [options] gateways \n");
diff --git a/debug.h b/debug.h
index 50d0e24..2c6d24c 100644
--- a/debug.h
+++ b/debug.h
@@ -25,6 +25,7 @@
#define DEBUG_TRANSTABLE_LOCAL "transtable_local"
#define DEBUG_TRANSTABLE_GLOBAL "transtable_global"
#define DEBUG_BLA_CLAIM_TABLE "bla_claim_table"
+#define DEBUG_BLA_BACKBONE_TABLE "bla_backbone_table"
#define DEBUG_GATEWAYS "gateways"
#define DEBUG_VIS_DATA "vis_data"
#define DEBUG_LOG "log"
@@ -33,6 +34,7 @@ void originators_usage(void);
void trans_local_usage(void);
void trans_global_usage(void);
void bla_claim_table_usage(void);
+void bla_backbone_table_usage(void);
void gateways_usage(void);
int handle_debug_table(char *mesh_iface, int argc, char **argv,
char *file_path, void table_usage(void));
diff --git a/main.c b/main.c
index 72b1ea4..929b762 100644
--- a/main.c
+++ b/main.c
@@ -56,6 +56,7 @@ void print_usage(void) {
printf(" \ttranslocal|tl \tdisplay the local translation table\n");
printf(" \ttransglobal|tg \tdisplay the global translation table\n");
printf(" \tclaimtable|cl \tdisplay the bridge loop avoidance claim table\n");
+ printf(" \tbackbonetable|bbl \tdisplay the bridge loop avoidance backbone table\n");
printf(" \tvis_mode|vm [mode] \tdisplay or modify the status of the VIS server\n");
printf(" \tvis_data|vd [dot|JSON] \tdisplay the VIS data in dot or JSON format\n");
printf(" \taggregation|ag [0|1] \tdisplay or modify the packet aggregation setting\n");
@@ -158,6 +159,11 @@ int main(int argc, char **argv)
ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
DEBUG_BLA_CLAIM_TABLE, bla_claim_table_usage);
+ } else if ((strcmp(argv[1], "backbonetable") == 0) || (strcmp(argv[1], "bbl") == 0)) {
+
+ ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
+ DEBUG_BLA_BACKBONE_TABLE,
+ bla_backbone_table_usage);
} else if ((strcmp(argv[1], "loglevel") == 0) || (strcmp(argv[1], "ll") == 0)) {
diff --git a/man/batctl.8 b/man/batctl.8
index 714f50a..af30b67 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -124,6 +124,9 @@ Display the global translation table. batctl will refresh the list every second
.IP "\fBclaimtable\fP|\fBcl\fP [\fB\-w\fP [\fI\interval\fP]][\fB\-n\fP]"
Display the bridge loop avoidance claim table. batctl will refresh the list every second if the "\-w" option was given or add a number to let it refresh at a custom interval in seconds (with optional decimal places). Use "\-n" to let batctl not replace the MAC addresses with bat\-host names in the output.
.br
+.IP "\fBbackbonetable\fP|\fBbbl\fP [\fB\-w\fP [\fI\interval\fP]][\fB\-n\fP]"
+Display the bridge loop avoidance backbone table. batctl will refresh the list every second if the "\-w" option was given or add a number to let it refresh at a custom interval in seconds (with optional decimal places). Use "\-n" to let batctl not replace the MAC addresses with bat\-host names in the output.
+.br
.IP "\fBvis_mode|vm\fP [\fBmode\fP]\fP"
If no parameter is given the current vis mode is displayed otherwise the parameter is used to set the vis mode.
.br
--
batctl
The following commit has been merged in the master branch:
commit 8dcb4037307ba4cd95fb4161c2d2130307b269e2
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Thu Jun 21 22:28:54 2012 +0200
batman-adv: prepend BATADV_ to TT flags in comments
After having added the BATADV_ prefix to all the TT_CLIENT flags, we have to
add the same prefix in every comment where they are mentioned.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
diff --git a/packet.h b/packet.h
index c0ed5b4..8d3e55a 100644
--- a/packet.h
+++ b/packet.h
@@ -77,7 +77,7 @@ enum batadv_tt_query_flags {
BATADV_TT_FULL_TABLE = 1 << 2,
};
-/* TT_CLIENT flags.
+/* BATADV_TT_CLIENT flags.
* Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to
* 1 << 15 are used for local computation only
*/
diff --git a/translation-table.c b/translation-table.c
index 2a6d7d6..b6931d0 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -245,7 +245,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
if (tt_local_entry) {
tt_local_entry->last_seen = jiffies;
- /* possibly unset the TT_CLIENT_PENDING flag */
+ /* possibly unset the BATADV_TT_CLIENT_PENDING flag */
tt_local_entry->common.flags &= ~BATADV_TT_CLIENT_PENDING;
goto out;
}
@@ -713,8 +713,8 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv,
} else {
/* there is already a global entry, use this one. */
- /* If there is the TT_CLIENT_ROAM flag set, there is only one
- * originator left in the list and we previously received a
+ /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only
+ * one originator left in the list and we previously received a
* delete + roaming change for this originator.
*
* We should first delete the old originator before adding the
@@ -889,8 +889,8 @@ batadv_tt_global_del_struct(struct batadv_priv *bat_priv,
}
/* If the client is to be deleted, we check if it is the last origantor entry
- * within tt_global entry. If yes, we set the TT_CLIENT_ROAM flag and the timer,
- * otherwise we simply remove the originator scheduled for deletion.
+ * within tt_global entry. If yes, we set the BATADV_TT_CLIENT_ROAM flag and the
+ * timer, otherwise we simply remove the originator scheduled for deletion.
*/
static void
batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
@@ -958,7 +958,7 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv,
* event, there are two possibilities:
* 1) the client roamed from node A to node B => if there
* is only one originator left for this client, we mark
- * it with TT_CLIENT_ROAM, we start a timer and we
+ * it with BATADV_TT_CLIENT_ROAM, we start a timer and we
* wait for node B to claim it. In case of timeout
* the entry is purged.
*
@@ -2148,7 +2148,7 @@ out:
return changed_num;
}
-/* Purge out all the tt local entries marked with TT_CLIENT_PENDING */
+/* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */
static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
{
struct batadv_hashtable *hash = bat_priv->tt_local_hash;
--
batman-adv