[B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Remove date from README
by Sven Eckelmann
The date has to be updated when a patch touches the README. Therefore, nearly
every feature will modify this date. It can happens quite often that not only
one feature is currently in development or waiting on the mailinglist. This
creates merge conflicts when applying a patchset.
The date itself doesn't provide any additional information when this file is
only available in a release tarball or as part of a SCM repository.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
README | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/README b/README
index ddc9569..58d3473 100644
--- a/README
+++ b/README
@@ -1,5 +1,3 @@
-[state: 13-11-2011]
-
BATMAN-ADV
----------
--
1.7.7.3
10 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: refactor tt_global_del() to avoid misalignment
by Marek Lindner
From: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
translation-table.c | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/translation-table.c b/translation-table.c
index d542b9d..a1be7ef 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -657,29 +657,31 @@ void tt_global_del(struct bat_priv *bat_priv,
struct tt_local_entry *tt_local_entry = NULL;
tt_global_entry = tt_global_hash_find(bat_priv, addr);
- if (!tt_global_entry)
+ if (!tt_global_entry || tt_global_entry->orig_node != orig_node)
goto out;
- if (tt_global_entry->orig_node == orig_node) {
- if (roaming) {
- /* if we are deleting a global entry due to a roam
- * event, there are two possibilities:
- * 1) the client roamed from node A to node B => we mark
- * it with TT_CLIENT_ROAM, we start a timer and we
- * wait for node B to claim it. In case of timeout
- * the entry is purged.
- * 2) the client roamed to us => we can directly delete
- * the global entry, since it is useless now. */
- tt_local_entry = tt_local_hash_find(bat_priv,
- tt_global_entry->common.addr);
- if (!tt_local_entry) {
- tt_global_entry->common.flags |= TT_CLIENT_ROAM;
- tt_global_entry->roam_at = jiffies;
- goto out;
- }
- }
- _tt_global_del(bat_priv, tt_global_entry, message);
+ if (!roaming)
+ goto out_del;
+
+ /* if we are deleting a global entry due to a roam
+ * event, there are two possibilities:
+ * 1) the client roamed from node A to node B => we mark
+ * it with TT_CLIENT_ROAM, we start a timer and we
+ * wait for node B to claim it. In case of timeout
+ * the entry is purged.
+ * 2) the client roamed to us => we can directly delete
+ * the global entry, since it is useless now. */
+ tt_local_entry = tt_local_hash_find(bat_priv,
+ tt_global_entry->common.addr);
+ if (!tt_local_entry) {
+ tt_global_entry->common.flags |= TT_CLIENT_ROAM;
+ tt_global_entry->roam_at = jiffies;
+ goto out;
}
+
+out_del:
+ _tt_global_del(bat_priv, tt_global_entry, message);
+
out:
if (tt_global_entry)
tt_global_entry_free_ref(tt_global_entry);
--
1.7.5.4
10 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: convert time_after instances to has_timed_out
by Marek Lindner
To increase readability the has_timed_out() functions has been introduced.
This patch converts existing time_after() calls to use this wrapper
function (if applicable).
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
---
originator.c | 11 ++++-------
routing.c | 3 +--
soft-interface.c | 4 ++--
vis.c | 3 +--
4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/originator.c b/originator.c
index 847ff7e..1161f27 100644
--- a/originator.c
+++ b/originator.c
@@ -282,8 +282,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
hlist_for_each_entry_safe(neigh_node, node, node_tmp,
&orig_node->neigh_list, list) {
- if ((time_after(jiffies,
- neigh_node->last_valid + PURGE_TIMEOUT * HZ)) ||
+ if ((has_timed_out(neigh_node->last_valid, PURGE_TIMEOUT)) ||
(neigh_node->if_incoming->if_status == IF_INACTIVE) ||
(neigh_node->if_incoming->if_status == IF_NOT_IN_USE) ||
(neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) {
@@ -327,9 +326,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
{
struct neigh_node *best_neigh_node;
- if (time_after(jiffies,
- orig_node->last_valid + 2 * PURGE_TIMEOUT * HZ)) {
-
+ if (has_timed_out(orig_node->last_valid, 2 * PURGE_TIMEOUT)) {
bat_dbg(DBG_BATMAN, bat_priv,
"Originator timeout: originator %pM, last_valid %lu\n",
orig_node->orig, (orig_node->last_valid / HZ));
@@ -372,8 +369,8 @@ static void _purge_orig(struct bat_priv *bat_priv)
continue;
}
- if (time_after(jiffies, orig_node->last_frag_packet +
- msecs_to_jiffies(FRAG_TIMEOUT)))
+ if (has_timed_out(orig_node->last_frag_packet,
+ FRAG_TIMEOUT))
frag_list_free(&orig_node->frag_list);
}
spin_unlock_bh(list_lock);
diff --git a/routing.c b/routing.c
index 5bc41c8..87b95a2 100644
--- a/routing.c
+++ b/routing.c
@@ -232,8 +232,7 @@ int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
{
if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE)
|| (seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
- if (time_after(jiffies, *last_reset +
- msecs_to_jiffies(RESET_PROTECTION_MS))) {
+ if (has_timed_out(*last_reset, RESET_PROTECTION_MS)) {
*last_reset = jiffies;
bat_dbg(DBG_BATMAN, bat_priv,
diff --git a/soft-interface.c b/soft-interface.c
index bd8c7cf..51788db 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -396,8 +396,8 @@ void softif_neigh_purge(struct bat_priv *bat_priv)
hlist_for_each_entry_safe(softif_neigh, node_tmp, node_tmp2,
&softif_neigh_vid->softif_neigh_list,
list) {
- if ((!time_after(jiffies, softif_neigh->last_seen +
- msecs_to_jiffies(SOFTIF_NEIGH_TIMEOUT))) &&
+ if ((!has_timed_out(softif_neigh->last_seen,
+ SOFTIF_NEIGH_TIMEOUT)) &&
(atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE))
continue;
diff --git a/vis.c b/vis.c
index ac7e661..4f4b2a0 100644
--- a/vis.c
+++ b/vis.c
@@ -714,8 +714,7 @@ static void purge_vis_packets(struct bat_priv *bat_priv)
if (info == bat_priv->my_vis_info)
continue;
- if (time_after(jiffies,
- info->first_seen + VIS_TIMEOUT * HZ)) {
+ if (has_timed_out(info->first_seen, VIS_TIMEOUT)) {
hlist_del(node);
send_list_del(info);
kref_put(&info->refcount, free_info);
--
1.7.5.4
10 years, 6 months
[B.A.T.M.A.N.] switch routing algorithm at runtime (v2)
by Marek Lindner
Hi,
next round for the selectable routing algorithm patches. The major change
which comes with this patchset is the module parameter that allows to set
the routing algorithm. This setting only affects batX interfaces created
after the change has been made. The list of available routing algorithms
moved to the batman-adv debugfs root directory, so that it is visible
even before the first batX interface has been created. The sysfs entry
still shows the configured routing algorithm but does not allow to change
it.
Big kudos to Sven for helping me out with the compat macros.
Cheers,
Marek
10 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: checkpatch cleanup - remove lines longer than 80 chars
by Marek Lindner
The long line was introduced with b26e478f8f.
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
---
net/batman-adv/translation-table.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index ab8dea8..58361ed 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -679,7 +679,7 @@ void tt_global_del(struct bat_priv *bat_priv,
* 2) the client roamed to us => we can directly delete
* the global entry, since it is useless now. */
tt_local_entry = tt_local_hash_find(bat_priv,
- tt_global_entry->common.addr);
+ tt_global_entry->common.addr);
if (!tt_local_entry) {
tt_global_entry->common.flags |= TT_CLIENT_ROAM;
tt_global_entry->roam_at = jiffies;
--
1.7.5.4
10 years, 6 months
[B.A.T.M.A.N.] pull request: batman-adv 2011-12-12
by Marek Lindner
Hi David,
here comes the next batch I'd like to get the pulled into net-next-2.6/3.3.
We have a couple of minor fixes for unregister_netdevice(), compat flags,
return value checks and a readme update. Plus the regression fix from Dan
that addresses a bug introduced with the previous batch. Security
researcher Paul Kot checked our kernelland / user space communication and
found a subtle bug which would make batman-adv write to memory locations
it should not write to. However, he did not find a way to exploit this
bug, therefore we classified it as "non-critical". Please let us know if
that is not ok with you.
Thanks,
Marek
The following changes since commit 76e8d7b0d1b0091929e8cd18551a87b6bb6ef2c1:
batman-adv: Fix range check for expected packets (2011-11-20 13:08:35 +0100)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git batman-adv/next
Antonio Quartulli (3):
batman-adv: create a common substructure for tt_global/local_entry
batman-adv: generalise tt_local_reset_flags()
batman-adv: format multi-line if in the correct way
Dan Carpenter (1):
batman-adv: remove extra negation in gw_out_of_range()
Marek Lindner (2):
batman-adv: report compat_version in version field in case of version mismatch
batman-adv: readme update (mention ap isolation and new log level)
Paul Kot (1):
batman-adv: bat_socket_read missing checks
Simon Wunderlich (2):
batman-adv: check return value for hash_add()
batman-adv: use unregister_netdevice() when softif_create fails
Sven Eckelmann (2):
batman-adv: Directly check read of icmp packet in copy_from_user
batman-adv: Only write requested number of byte to user buffer
Documentation/networking/batman-adv.txt | 7 +-
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/icmp_socket.c | 14 +-
net/batman-adv/routing.c | 3 +-
net/batman-adv/soft-interface.c | 2 +-
net/batman-adv/translation-table.c | 336 ++++++++++++++++++-------------
net/batman-adv/types.h | 14 +-
net/batman-adv/vis.c | 6 +-
8 files changed, 216 insertions(+), 168 deletions(-)
10 years, 6 months
[B.A.T.M.A.N.] [PATCH] batctl: fix log level 'all'
by Marek Lindner
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
---
sys.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sys.c b/sys.c
index e510bee..105bb51 100644
--- a/sys.c
+++ b/sys.c
@@ -213,7 +213,7 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv)
log_level = 0;
break;
} else if (strcmp(argv[i], "all") == 0) {
- log_level = 15;
+ log_level = 7;
break;
} else if (strcmp(argv[i], "batman") == 0)
log_level |= (1 << 0);
--
1.7.5.4
10 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: Generate config compatible with kbuild macros
by Sven Eckelmann
Linux 3.0-rc1-30-g2a11c8e introduced the macros IS_ENABLED, IS_BUILTIN and
IS_MODULE that can be used to identify which state a tristate option had. The
compat-autoconf.h needs to provide additional precompiler variables that these
marcros can use.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
gen-compat-autoconf.sh | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/gen-compat-autoconf.sh b/gen-compat-autoconf.sh
index 440accc..1a020c1 100755
--- a/gen-compat-autoconf.sh
+++ b/gen-compat-autoconf.sh
@@ -12,15 +12,22 @@ gen_config() {
VALUE="${2}"
echo "#undef ${KEY}"
+ echo "#undef __enabled_${KEY}"
+ echo "#undef __enabled_${KEY}_MODULE"
case "${VALUE}" in
y)
echo "#define ${KEY} 1"
+ echo "#define __enabled_${KEY} 1"
+ echo "#define __enabled_${KEY}_MODULE 0"
;;
m)
echo "#define ${KEY} 1"
+ echo "#define __enabled_${KEY} 0"
+ echo "#define __enabled_${KEY}_MODULE 1"
;;
n)
- # leave it undefined
+ echo "#define __enabled_${KEY} 0"
+ echo "#define __enabled_${KEY}_MODULE 0"
;;
*)
echo "#define ${KEY} \"${VALUE}\""
--
1.7.7.3
10 years, 6 months
[B.A.T.M.A.N.] [PATCH] batman-adv: warn if added interface is part of a bridge
by Marek Lindner
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
---
Thanks to Sven we even have a 'nice' compat.h workaround. :)
compat.h | 1 +
hard-interface.c | 8 ++++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/compat.h b/compat.h
index 964c066..dcd92d1 100644
--- a/compat.h
+++ b/compat.h
@@ -52,6 +52,7 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
#define __rcu
+#define IFF_BRIDGE_PORT 0 || (hard_iface->net_dev->br_port ? 1 : 0)
#endif /* < KERNEL_VERSION(2, 6, 36) */
diff --git a/hard-interface.c b/hard-interface.c
index d3e0e32..68b667c 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -281,6 +281,14 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
if (!atomic_inc_not_zero(&hard_iface->refcount))
goto out;
+ /* hard-interface is part of a bridge */
+ if (hard_iface->net_dev->priv_flags & IFF_BRIDGE_PORT)
+ pr_err("You are about to enable batman-adv on '%s' which "
+ "already is part of a bridge. Unless you know exactly "
+ "what you are doing this is probably wrong and won't "
+ "work the way you think it would.\n",
+ hard_iface->net_dev->name);
+
soft_iface = dev_get_by_name(&init_net, iface_name);
if (!soft_iface) {
--
1.7.5.4
10 years, 6 months