The following commit has been merged in the master branch:
commit 240a99f99a824a324abbeffb2415e72b8467e6f2
Merge: cd1a5e22e37e7aafc967db4a8a9c079948eb931d edab69b199080cf0c7eac1288441a5e37dd22278
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Wed Nov 9 01:54:50 2011 +0800
Merge branch 'next'
--
batctl
The following commit has been merged in the next branch:
commit edab69b199080cf0c7eac1288441a5e37dd22278
Author: Martin Hundebøll <martin(a)hundeboll.net>
Date: Mon Nov 7 13:14:31 2011 +0100
batctl: Human readable log levels instead of bitmasks
As the number of log levels increases, it becomes less user friendly to
assign a log level, as this is given as a bitmask in decimal form. This
patch changes this, so that one or more log levels can be given as
human readable words (e.g. "batctl ll batman routes").
Signed-off-by: Martin Hundebøll <martin(a)hundeboll.net>
diff --git a/man/batctl.8 b/man/batctl.8
index 928c7e3..0cf0a7b 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -64,8 +64,8 @@ Once started batctl will display the list of announced gateways in the network.
.IP "\fBinterval\fP|\fBit\fP [\fBorig_interval\fP]"
If no parameter is given the current originator interval setting is displayed otherwise the parameter is used to set the originator interval. The interval is in units of milliseconds.
.br
-.IP "\fBloglevel\fP|\fBll\fP [\fBlevel\fP]"
-If no parameter is given the current log level settings are displayed otherwise the parameter is used to set the log level. Level 0 disables all verbose logging. Level 1 enables messages related to routing / flooding / broadcasting. Level 2 enables messages related to route or tt entry added / changed / deleted. Level 3 enables all messages. The messages are sent to the batman-adv debug log. Use \fBbatctl log\fP to see them. Make sure to have debugging output enabled when compiling the module otherwise the output as well as the loglevel options won't be available.
+.IP "\fBloglevel\fP|\fBll\fP [\fBlevel\fP[ \fBlevel\fP[ \fBlevel\fP]] \fB...\fP]"
+If no parameter is given the current log level settings are displayed otherwise the parameter(s) is/are used to set the log level. Level 'none' disables all verbose logging. Level 'batman' enables messages related to routing / flooding / broadcasting. Level 'routes' enables messages related to routes being added / changed / deleted. Level 'tt' enables messages related to translation table operations. Level 'all' enables all messages. The messages are sent to the batman-adv debug log. Use \fBbatctl log\fP to see them. Make sure to have debugging output enabled when compiling the module otherwise the output as well as the loglevel options won't be available.
.br
.IP "\fBlog\fP|\fBl\fP [\fB\-n\fP]\fP"
batctl will read the batman-adv debug log which has to be compiled into the kernel module. If "\-n" is given batctl will not replace the MAC addresses with bat\-host names in the output.
diff --git a/sys.c b/sys.c
index 14fc577..bddaaa3 100644
--- a/sys.c
+++ b/sys.c
@@ -174,16 +174,24 @@ err:
static void log_level_usage(void)
{
- printf("Usage: batctl [options] loglevel [level]\n");
+ printf("Usage: batctl [options] loglevel [level[ level[ level]]...]\n");
printf("options:\n");
printf(" \t -h print this help\n");
+ printf("levels:\n");
+ printf(" \t none Debug logging is disabled\n");
+ printf(" \t all Print messages from all below\n");
+ printf(" \t batman Messages related to routing / flooding / broadcasting\n");
+ printf(" \t routes Messages related to route added / changed / deleted\n");
+ printf(" \t tt Messages related to translation table operations\n");
}
int handle_loglevel(char *mesh_iface, int argc, char **argv)
{
int optchar, res;
- int log_level;
+ int log_level = 0;
char *path_buff;
+ char str[4];
+ int i;
while ((optchar = getopt(argc, argv, "h")) != -1) {
switch (optchar) {
@@ -200,7 +208,25 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv)
snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT, mesh_iface);
if (argc != 1) {
- res = write_file(path_buff, SYS_LOG_LEVEL, argv[1], NULL);
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "none") == 0) {
+ log_level = 0;
+ break;
+ } else if (strcmp(argv[i], "all") == 0) {
+ log_level = 15;
+ break;
+ } else if (strcmp(argv[i], "batman") == 0)
+ log_level |= (1 << 0);
+ else if (strcmp(argv[i], "routes") == 0)
+ log_level |= (1 << 1);
+ else if (strcmp(argv[i], "tt") == 0)
+ log_level |= (1 << 2);
+ else
+ log_level_usage();
+ }
+
+ snprintf(str, sizeof(str), "%i", log_level);
+ res = write_file(path_buff, SYS_LOG_LEVEL, str, NULL);
goto out;
}
--
batctl
The following commit has been merged in the master branch:
commit 3e0b5d118b789865596abb6e03c4c24297b9a804
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Mon Nov 7 16:47:01 2011 +0100
batman-adv: generalise tt_local_reset_flags()
The tt_local_reset_flags() is actually used for one use case only. It is not
generalised enough to be used indifferent situations. This patch make it general
enough in order to let other code use it whenever a flag set is requested over
the whole hash table (passed as parameter). The function is now called
tt_set_flags()
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
diff --git a/translation-table.c b/translation-table.c
index 76134bc..f6bbd64 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -1695,19 +1695,19 @@ void tt_free(struct bat_priv *bat_priv)
kfree(bat_priv->tt_buff);
}
-/* This function will reset the specified flags from all the entries in
- * the given hash table and will increment num_local_tt for each involved
- * entry */
-static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
+/* This function will enable or disable the specified flags for all the entries
+ * in the given hash table and returns the number of modified entries */
+static uint16_t tt_set_flags(struct hashtable_t *hash, uint16_t flags,
+ bool enable)
{
uint32_t i;
- struct hashtable_t *hash = bat_priv->tt_local_hash;
+ uint16_t changed_num = 0;
struct hlist_head *head;
struct hlist_node *node;
struct tt_common_entry *tt_common_entry;
if (!hash)
- return;
+ goto out;
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
@@ -1715,14 +1715,21 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
rcu_read_lock();
hlist_for_each_entry_rcu(tt_common_entry, node,
head, hash_entry) {
- if (!(tt_common_entry->flags & flags))
- continue;
- tt_common_entry->flags &= ~flags;
- atomic_inc(&bat_priv->num_local_tt);
+ if (enable) {
+ if ((tt_common_entry->flags & flags) == flags)
+ continue;
+ tt_common_entry->flags |= flags;
+ } else {
+ if (!(tt_common_entry->flags & flags))
+ continue;
+ tt_common_entry->flags &= ~flags;
+ }
+ changed_num++;
}
rcu_read_unlock();
}
-
+out:
+ return changed_num;
}
/* Purge out all the tt local entries marked with TT_CLIENT_PENDING */
@@ -1766,7 +1773,11 @@ static void tt_local_purge_pending_clients(struct bat_priv *bat_priv)
void tt_commit_changes(struct bat_priv *bat_priv)
{
- tt_local_reset_flags(bat_priv, TT_CLIENT_NEW);
+ uint16_t changed_num = tt_set_flags(bat_priv->tt_local_hash,
+ TT_CLIENT_NEW, false);
+ /* all the reset entries have now to be effectively counted as local
+ * entries */
+ atomic_add(changed_num, &bat_priv->num_local_tt);
tt_local_purge_pending_clients(bat_priv);
/* Increment the TTVN only once per OGM interval */
--
batman-adv
The annotated tag, v3.2-rc1 has been created
at 4ea8b996e5dd18145d945667fbcd9a6af234a30c (tag)
tagging 1ea6b8f48918282bdca0b32a34095504ee65bab5 (commit)
replaces v3.1
tagged by Linus Torvalds
on Mon Nov 7 16:17:17 2011 -0800
- Shortlog ------------------------------------------------------------
Linux 3.2-rc1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
iQEcBAABAgAGBQJOuHUiAAoJEHm+PkMAQRiGbaQH/iU0xahxjVFn1ypTp0Vhuxt1
8QgL/hLMYuU5eSi3ezMr0oPMwiLwgTVkvRhTmbhS8RPRjlKrryc+WUmEMMxOQGtd
bJquAWQcHn1aUF6PpiKVce4o8WzB7lOzNmtjVpGZ0rVgLj+yTBhLhlCuSM3OgiC3
JPdTO1JQpsyh+AY+F5fel7EBApgwPE6Y0jyICztXXDH6M0HifubZP5HG6uCO7cVX
xvFTCx1684XYdG/ZBeNEyvdw4W96Xm7u9tx93r55i8axORu/pIWpIc4rO65a6rOM
pGkWDdvy4udgTOf3g8MbBJQyN9gi+Dkj6263dBejfnyRgvWrOSCHT8OtyfB9XB8=
=A4sP
-----END PGP SIGNATURE-----
Antonio Quartulli (9):
batman-adv: hash_add() has to discriminate on the return value
batman-adv: correct several typ0s in the comments
batman-adv: detect clients connected through a 802.11 device
batman-adv: implement AP-isolation on the receiver side
batman-adv: implement AP-isolation on the sender side
batman-adv: print client flags in the local/global transtables output
batman-adv: fix tt_local_reset_flags() function
batman-adv: correctly set the data field in the TT_REPONSE packet
batman-adv: unify hash_entry field position in tt_local/global_entry
David S. Miller (3):
Merge branch 'master' of github.com:davem330/net
Merge branch 'master' of ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
Merge branch 'batman-adv/maint' of git://git.open-mesh.org/linux-merge
Joe Perches (1):
batman-adv: Remove unnecessary OOM logging messages
Marek Lindner (6):
batman-adv: reuse tt_len() to calculate tt buffer length
batman-adv: merge update_transtable() into tt related code
batman-adv: rename all instances of batman_packet to batman_ogm_packet
batman-adv: agglomerate all batman iv ogm processing functions in a single file
batman-adv: move routing packet initialization into corresponding file
batman-adv: agglomerate all batman iv ogm sending functions in the batman iv file
Simon Wunderlich (2):
batman-adv: remove references for global tt entries
batman-adv: add sanity check when removing global tts
Sven Eckelmann (1):
batman-adv: update internal version number
-----------------------------------------------------------------------
--
linux integration
The following commit has been merged in the master branch:
commit cd1a5e22e37e7aafc967db4a8a9c079948eb931d
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Sun Oct 30 22:11:30 2011 +0100
batctl: retrieve compat version from version field in case of parameter problem
Reported-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
diff --git a/ping.c b/ping.c
index 1003ab1..91b733a 100644
--- a/ping.c
+++ b/ping.c
@@ -283,8 +283,8 @@ int ping(char *mesh_iface, int argc, char **argv)
break;
case PARAMETER_PROBLEM:
printf("Error - the batman adv kernel module version (%d) differs from ours (%d)\n",
- icmp_packet_in.ttl, COMPAT_VERSION);
- printf("Please make sure to compatible versions!\n");
+ icmp_packet_in.version, COMPAT_VERSION);
+ printf("Please make sure to use compatible versions!\n");
goto out;
default:
printf("Unknown message type %d len %zd received\n", icmp_packet_in.msg_type, read_len);
diff --git a/traceroute.c b/traceroute.c
index ea43331..d120311 100644
--- a/traceroute.c
+++ b/traceroute.c
@@ -188,8 +188,8 @@ int traceroute(char *mesh_iface, int argc, char **argv)
goto out;
case PARAMETER_PROBLEM:
printf("Error - the batman adv kernel module version (%d) differs from ours (%d)\n",
- icmp_packet_in.ttl, COMPAT_VERSION);
- printf("Please make sure to compatible versions!\n");
+ icmp_packet_in.version, COMPAT_VERSION);
+ printf("Please make sure to use compatible versions!\n");
goto out;
default:
printf("Unknown message type %d len %zd received\n", icmp_packet_in.msg_type, read_len);
--
batctl
The following commit has been merged in the master branch:
commit f37d6d6ebef43b29c2a27ad44b75c260126edfef
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Sun Oct 30 22:10:08 2011 +0100
batman-adv: report compat_version in version field in case of version mismatch
Reported-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
diff --git a/icmp_socket.c b/icmp_socket.c
index ac3520e..defd692 100644
--- a/icmp_socket.c
+++ b/icmp_socket.c
@@ -217,7 +217,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
if (icmp_packet->version != COMPAT_VERSION) {
icmp_packet->msg_type = PARAMETER_PROBLEM;
- icmp_packet->ttl = COMPAT_VERSION;
+ icmp_packet->version = COMPAT_VERSION;
bat_socket_add_packet(socket_client, icmp_packet, packet_len);
goto free_skb;
}
--
batman-adv