* [PATCH 1/8] batman-adv: avoid skb_linearise() if not needed
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
2012-05-14 7:17 ` [PATCH 2/8] batman-adv: improve unicast packet (re)routing Antonio Quartulli
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Antonio Quartulli
Whenever we want to access headers only, we do not need to linearise the whole
packet. Instead we can use pskb_may_pull()
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/routing.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 7ed9d8f..4c6467d 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -916,8 +916,9 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
/* Check whether I have to reroute the packet */
if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) {
- /* Linearize the skb before accessing it */
- if (skb_linearize(skb) < 0)
+ /* check if there is enough data before accessing it */
+ if (pskb_may_pull(skb, sizeof(struct unicast_packet) +
+ ETH_HLEN) < 0)
return 0;
ethhdr = (struct ethhdr *)(skb->data +
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/8] batman-adv: improve unicast packet (re)routing
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
2012-05-14 7:17 ` [PATCH 1/8] batman-adv: avoid skb_linearise() if not needed Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
2012-05-14 7:17 ` [PATCH 3/8] batman-adv: prepare lq_update_lock to be shared among different protocols Antonio Quartulli
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Antonio Quartulli
In case of a client X roaming from a generic node A to another node B, it is
possible that a third node C gets A's OGM but not B's. At this point in time, if
C wants to send data to X it will send a unicast packet destined to A. The
packet header will contain A's last ttvn (C got A's OGM and so it knows it).
The packet will travel towards A without being intercepted because the ttvn
contained in its header is the newest for A.
Once A will receive the packet, A's state will not report to be in a "roaming
phase" (because, after a roaming, once A sends out its OGM, all the changes are
committed and the node is considered not to be in the roaming state anymore)
and it will match the ttvn carried by the packet. Therefore there is no reason
for A to try to alter the packet's route, thus dropping the packet because the
destination client is not there anymore.
However, C is well aware that it's routing information towards the client X is
outdated as it received an OGM from A saying that the client roamed away.
Thanks to this detail, this patch introduces a small change in behaviour: as
long as C is in the state of not knowing the new location of client X it will
forward the traffic to its last known location using ttvn-1 of the destination.
By using an older ttvn node A will be forced to re-route the packet.
Intermediate nodes are also allowed to update the packet's destination as long
as they have the information about the client's new location.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/routing.c | 7 +++++++
net/batman-adv/translation-table.c | 19 +++++++++++++++++++
net/batman-adv/translation-table.h | 2 ++
net/batman-adv/unicast.c | 8 ++++++++
4 files changed, 36 insertions(+)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4c6467d..b1824bb 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -923,6 +923,13 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,
ethhdr = (struct ethhdr *)(skb->data +
sizeof(struct unicast_packet));
+
+ /* we don't have an updated route for this client, so we should
+ * not try to reroute the packet!!
+ */
+ if (tt_global_client_is_roaming(bat_priv, ethhdr->h_dest))
+ return 1;
+
orig_node = transtable_search(bat_priv, NULL, ethhdr->h_dest);
if (!orig_node) {
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 2cb46f0..b3fb597 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2117,3 +2117,22 @@ request_table:
}
}
}
+
+/* returns true whether we know that the client has moved from its old
+ * originator to another one. This entry is kept is still kept for consistency
+ * purposes
+ */
+bool tt_global_client_is_roaming(struct bat_priv *bat_priv, uint8_t *addr)
+{
+ struct tt_global_entry *tt_global_entry;
+ bool ret = false;
+
+ tt_global_entry = tt_global_hash_find(bat_priv, addr);
+ if (!tt_global_entry)
+ goto out;
+
+ ret = tt_global_entry->common.flags & TT_CLIENT_ROAM;
+ tt_global_entry_free_ref(tt_global_entry);
+out:
+ return ret;
+}
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index 593d1b3..c43374d 100644
--- a/net/batman-adv/translation-table.h
+++ b/net/batman-adv/translation-table.h
@@ -53,5 +53,7 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst);
void tt_update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
const unsigned char *tt_buff, uint8_t tt_num_changes,
uint8_t ttvn, uint16_t tt_crc);
+bool tt_global_client_is_roaming(struct bat_priv *bat_priv, uint8_t *addr);
+
#endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index 676f6a6..74175c2 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -331,6 +331,14 @@ find_router:
unicast_packet->ttvn =
(uint8_t)atomic_read(&orig_node->last_ttvn);
+ /* inform the destination node that we are still missing a correct route
+ * for this client. The destination will receive this packet and will
+ * try to reroute it because the ttvn contained in the header is less
+ * than the current one
+ */
+ if (tt_global_client_is_roaming(bat_priv, ethhdr->h_dest))
+ unicast_packet->ttvn = unicast_packet->ttvn - 1;
+
if (atomic_read(&bat_priv->fragmentation) &&
data_len + sizeof(*unicast_packet) >
neigh_node->if_incoming->net_dev->mtu) {
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/8] batman-adv: prepare lq_update_lock to be shared among different protocols
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
2012-05-14 7:17 ` [PATCH 1/8] batman-adv: avoid skb_linearise() if not needed Antonio Quartulli
2012-05-14 7:17 ` [PATCH 2/8] batman-adv: improve unicast packet (re)routing Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
2012-05-14 7:17 ` [PATCH 4/8] batman-adv: refactor window_protected to avoid unnecessary return statement Antonio Quartulli
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli
From: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bat_iv_ogm.c | 9 ++++-----
net/batman-adv/originator.c | 1 +
net/batman-adv/types.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index abd10c4..dc53798 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -43,7 +43,6 @@ static struct neigh_node *bat_iv_ogm_neigh_new(struct hard_iface *hard_iface,
goto out;
INIT_LIST_HEAD(&neigh_node->bonding_list);
- spin_lock_init(&neigh_node->tq_lock);
neigh_node->orig_node = orig_neigh;
neigh_node->if_incoming = hard_iface;
@@ -637,12 +636,12 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
if (is_duplicate)
continue;
- spin_lock_bh(&tmp_neigh_node->tq_lock);
+ spin_lock_bh(&tmp_neigh_node->lq_update_lock);
ring_buffer_set(tmp_neigh_node->tq_recv,
&tmp_neigh_node->tq_index, 0);
tmp_neigh_node->tq_avg =
ring_buffer_avg(tmp_neigh_node->tq_recv);
- spin_unlock_bh(&tmp_neigh_node->tq_lock);
+ spin_unlock_bh(&tmp_neigh_node->lq_update_lock);
}
if (!neigh_node) {
@@ -668,12 +667,12 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
orig_node->flags = batman_ogm_packet->flags;
neigh_node->last_seen = jiffies;
- spin_lock_bh(&neigh_node->tq_lock);
+ spin_lock_bh(&neigh_node->lq_update_lock);
ring_buffer_set(neigh_node->tq_recv,
&neigh_node->tq_index,
batman_ogm_packet->tq);
neigh_node->tq_avg = ring_buffer_avg(neigh_node->tq_recv);
- spin_unlock_bh(&neigh_node->tq_lock);
+ spin_unlock_bh(&neigh_node->lq_update_lock);
if (!is_duplicate) {
orig_node->last_ttl = batman_ogm_packet->header.ttl;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index f4b6201..41147942 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -99,6 +99,7 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface,
INIT_HLIST_NODE(&neigh_node->list);
memcpy(neigh_node->addr, neigh_addr, ETH_ALEN);
+ spin_lock_init(&neigh_node->lq_update_lock);
/* extra reference for return */
atomic_set(&neigh_node->refcount, 2);
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 66a3750..61308e8 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -137,7 +137,7 @@ struct neigh_node {
struct rcu_head rcu;
struct orig_node *orig_node;
struct hard_iface *if_incoming;
- spinlock_t tq_lock; /* protects: tq_recv, tq_index */
+ spinlock_t lq_update_lock; /* protects: tq_recv, tq_index */
};
#ifdef CONFIG_BATMAN_ADV_BLA
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/8] batman-adv: refactor window_protected to avoid unnecessary return statement
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
` (2 preceding siblings ...)
2012-05-14 7:17 ` [PATCH 3/8] batman-adv: prepare lq_update_lock to be shared among different protocols Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
2012-05-14 7:17 ` [PATCH 5/8] batman-adv: use shorter pr_warn instead of pr_warning Antonio Quartulli
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli
From: Marek Lindner <lindner_marek@yahoo.de>
Reported-by: David Laight <David.Laight@aculab.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/routing.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index b1824bb..840e2c6 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -234,17 +234,14 @@ 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 (has_timed_out(*last_reset, RESET_PROTECTION_MS)) {
-
- *last_reset = jiffies;
- bat_dbg(DBG_BATMAN, bat_priv,
- "old packet received, start protection\n");
-
- return 0;
- } else {
+ if (!has_timed_out(*last_reset, RESET_PROTECTION_MS))
return 1;
- }
+
+ *last_reset = jiffies;
+ bat_dbg(DBG_BATMAN, bat_priv,
+ "old packet received, start protection\n");
}
+
return 0;
}
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/8] batman-adv: use shorter pr_warn instead of pr_warning
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
` (3 preceding siblings ...)
2012-05-14 7:17 ` [PATCH 4/8] batman-adv: refactor window_protected to avoid unnecessary return statement Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
2012-05-14 7:17 ` [PATCH 6/8] batman-adv: Start new development cycle Antonio Quartulli
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
From: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/hard-interface.c | 6 +++---
net/batman-adv/send.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 0b84bb1..dc334fa 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -173,9 +173,9 @@ static void check_known_mac_addr(const struct net_device *net_dev)
net_dev->dev_addr))
continue;
- pr_warning("The newly added mac address (%pM) already exists on: %s\n",
- net_dev->dev_addr, hard_iface->net_dev->name);
- pr_warning("It is strongly recommended to keep mac addresses unique to avoid problems!\n");
+ pr_warn("The newly added mac address (%pM) already exists on: %s\n",
+ net_dev->dev_addr, hard_iface->net_dev->name);
+ pr_warn("It is strongly recommended to keep mac addresses unique to avoid problems!\n");
}
rcu_read_unlock();
}
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 8e74d97..f47299f 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -45,8 +45,8 @@ int send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
goto send_skb_err;
if (!(hard_iface->net_dev->flags & IFF_UP)) {
- pr_warning("Interface %s is not up - can't send packet via that interface!\n",
- hard_iface->net_dev->name);
+ pr_warn("Interface %s is not up - can't send packet via that interface!\n",
+ hard_iface->net_dev->name);
goto send_skb_err;
}
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/8] batman-adv: Start new development cycle
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
` (4 preceding siblings ...)
2012-05-14 7:17 ` [PATCH 5/8] batman-adv: use shorter pr_warn instead of pr_warning Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
2012-05-14 7:17 ` [PATCH 7/8] batman-adv: README cleanups Antonio Quartulli
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
From: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/main.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index fd83acd..f4a3ec0 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -28,7 +28,7 @@
#define DRIVER_DEVICE "batman-adv"
#ifndef SOURCE_VERSION
-#define SOURCE_VERSION "2012.1.0"
+#define SOURCE_VERSION "2012.2.0"
#endif
/* B.A.T.M.A.N. parameters */
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 7/8] batman-adv: README cleanups
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
` (5 preceding siblings ...)
2012-05-14 7:17 ` [PATCH 6/8] batman-adv: Start new development cycle Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
2012-05-14 7:17 ` [PATCH 8/8] batman-adv: unset the TT_CLIENT_PENDING flag if the new local entry already exists Antonio Quartulli
[not found] ` <1336979858-13928-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
From: Sven Eckelmann <sven@narfation.org>
- Add routing_algo
- Remove date from README:
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@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
Documentation/networking/batman-adv.txt | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/Documentation/networking/batman-adv.txt b/Documentation/networking/batman-adv.txt
index 220a58c..75a5923 100644
--- a/Documentation/networking/batman-adv.txt
+++ b/Documentation/networking/batman-adv.txt
@@ -1,5 +1,3 @@
-[state: 21-08-2011]
-
BATMAN-ADV
----------
@@ -68,10 +66,11 @@ All mesh wide settings can be found in batman's own interface
folder:
# ls /sys/class/net/bat0/mesh/
-# aggregated_ogms fragmentation hop_penalty
-# ap_isolation gw_bandwidth log_level
-# bonding gw_mode orig_interval
-# bridge_loop_avoidance gw_sel_class vis_mode
+# aggregated_ogms gw_bandwidth log_level
+# ap_isolation gw_mode orig_interval
+# bonding gw_sel_class routing_algo
+# bridge_loop_avoidance hop_penalty vis_mode
+# fragmentation
There is a special folder for debugging information:
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 8/8] batman-adv: unset the TT_CLIENT_PENDING flag if the new local entry already exists
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
` (6 preceding siblings ...)
2012-05-14 7:17 ` [PATCH 7/8] batman-adv: README cleanups Antonio Quartulli
@ 2012-05-14 7:17 ` Antonio Quartulli
[not found] ` <1336979858-13928-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
8 siblings, 0 replies; 10+ messages in thread
From: Antonio Quartulli @ 2012-05-14 7:17 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Antonio Quartulli
When trying to add a new tt_local_entry, if such entry already exists, we have
to ensure that the TT_CLIENT_PENDING flag is not set, otherwise the entry will
be deleted soon.
Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/translation-table.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index b3fb597..a66c2dc 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -206,6 +206,8 @@ void 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 */
+ tt_local_entry->common.flags &= ~TT_CLIENT_PENDING;
goto out;
}
--
1.7.9.4
^ permalink raw reply related [flat|nested] 10+ messages in thread[parent not found: <1336979858-13928-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>]
* Re: pull request: batman-adv 2012-05-14
[not found] ` <1336979858-13928-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
@ 2012-05-14 22:17 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-05-14 22:17 UTC (permalink / raw)
To: ordex-GaUfNO9RBHfsrOwW+9ziJQ
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Date: Mon, 14 May 2012 09:17:30 +0200
> Hello David,
>
> here is our last set of changes intended for net-next/linux-3.5.
> In this patchset there are:
>
> 1) several minor cleanups and fixes
> 2) an optimisation that avoid to linearise the whole packet when not needed
> 3) an optimisation for client traffic rerouting after a roaming event.
>
> Patches that modify the whole naming schema will be sent later for merging
> with linux-3.6.
Pulled, thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread