[batman-adv] master: batman-adv: Return EINVAL on invalid gw_bandwidth change (aa203f7)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit aa203f7ff14c2a5e688c023969a68a44aae8f1b0
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sun Jun 21 14:42:49 2015 +0200
batman-adv: Return EINVAL on invalid gw_bandwidth change
Invalid speed settings by the user are currently acknowledged as correct
but not stored. Instead the return of the store operation of the file
"gw_bandwidth" should indicate that the given value is not acceptable.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
>---------------------------------------------------------------
aa203f7ff14c2a5e688c023969a68a44aae8f1b0
net/batman-adv/gateway_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c
index c50931c..6b930a6 100644
--- a/net/batman-adv/gateway_common.c
+++ b/net/batman-adv/gateway_common.c
@@ -19,6 +19,7 @@
#include "main.h"
#include <linux/atomic.h>
+#include <linux/errno.h>
#include <linux/byteorder/generic.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
@@ -160,7 +161,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
ret = batadv_parse_gw_bandwidth(net_dev, buff, &down_new, &up_new);
if (!ret)
- goto end;
+ return -EINVAL;
if (!down_new)
down_new = 1;
@@ -184,7 +185,6 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
atomic_set(&bat_priv->gw.bandwidth_up, up_new);
batadv_gw_tvlv_container_update(bat_priv);
-end:
return count;
}
7 years, 7 months
[batman-adv] master: batman-adv: prevent potential hlist double deletion (4729a33)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 4729a33528e05ea858d8337769584cb49961fc0e
Author: Marek Lindner <mareklindner(a)neomailbox.ch>
Date: Mon Jun 22 00:30:23 2015 +0800
batman-adv: prevent potential hlist double deletion
The hlist_del_rcu() call in batadv_tt_global_size_mod() does not check
if the element still is part of the list prior to deletion. The atomic
list counter should prevent the worst but converting to
hlist_del_init_rcu() ensures the element can't be deleted more than
once.
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
Acked-by: Antonio Quartulli <antonio(a)meshcoding.com>
>---------------------------------------------------------------
4729a33528e05ea858d8337769584cb49961fc0e
net/batman-adv/translation-table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index e20d98e..1976816 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -315,7 +315,7 @@ static void batadv_tt_global_size_mod(struct batadv_orig_node *orig_node,
if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
spin_lock_bh(&orig_node->vlan_list_lock);
- hlist_del_rcu(&vlan->list);
+ hlist_del_init_rcu(&vlan->list);
spin_unlock_bh(&orig_node->vlan_list_lock);
batadv_orig_node_vlan_free_ref(vlan);
}
7 years, 7 months
[batman-adv] master: batman-adv: convert orig_node->vlan_list to hlist (8d85d13)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 8d85d130c9fd09e69f8b6e2b56863d24849292cd
Author: Marek Lindner <mareklindner(a)neomailbox.ch>
Date: Mon Jun 22 00:30:22 2015 +0800
batman-adv: convert orig_node->vlan_list to hlist
Since the list's tail is never accessed using a double linked list head
wastes memory.
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
Acked-by: Antonio Quartulli <antonio(a)meshcoding.com>
>---------------------------------------------------------------
8d85d130c9fd09e69f8b6e2b56863d24849292cd
net/batman-adv/originator.c | 6 +++---
net/batman-adv/translation-table.c | 8 ++++----
net/batman-adv/types.h | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 4500e3a..ce5e354 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -70,7 +70,7 @@ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node,
struct batadv_orig_node_vlan *vlan = NULL, *tmp;
rcu_read_lock();
- list_for_each_entry_rcu(tmp, &orig_node->vlan_list, list) {
+ hlist_for_each_entry_rcu(tmp, &orig_node->vlan_list, list) {
if (tmp->vid != vid)
continue;
@@ -118,7 +118,7 @@ batadv_orig_node_vlan_new(struct batadv_orig_node *orig_node,
atomic_set(&vlan->refcount, 2);
vlan->vid = vid;
- list_add_rcu(&vlan->list, &orig_node->vlan_list);
+ hlist_add_head_rcu(&vlan->list, &orig_node->vlan_list);
out:
spin_unlock_bh(&orig_node->vlan_list_lock);
@@ -673,7 +673,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
return NULL;
INIT_HLIST_HEAD(&orig_node->neigh_list);
- INIT_LIST_HEAD(&orig_node->vlan_list);
+ INIT_HLIST_HEAD(&orig_node->vlan_list);
INIT_HLIST_HEAD(&orig_node->ifinfo_list);
spin_lock_init(&orig_node->bcast_seqno_lock);
spin_lock_init(&orig_node->neigh_list_lock);
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 03d739b..e20d98e 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -315,7 +315,7 @@ static void batadv_tt_global_size_mod(struct batadv_orig_node *orig_node,
if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
spin_lock_bh(&orig_node->vlan_list_lock);
- list_del_rcu(&vlan->list);
+ hlist_del_rcu(&vlan->list);
spin_unlock_bh(&orig_node->vlan_list_lock);
batadv_orig_node_vlan_free_ref(vlan);
}
@@ -738,7 +738,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
u8 *tt_change_ptr;
rcu_read_lock();
- list_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
+ hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
num_vlan++;
num_entries += atomic_read(&vlan->tt.num_entries);
}
@@ -764,7 +764,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
(*tt_data)->num_vlan = htons(num_vlan);
tt_vlan = (struct batadv_tvlv_tt_vlan_data *)(*tt_data + 1);
- list_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
+ hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
tt_vlan->vid = htons(vlan->vid);
tt_vlan->crc = htonl(vlan->tt.crc);
@@ -2463,7 +2463,7 @@ static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv,
/* recompute the global CRC for each VLAN */
rcu_read_lock();
- list_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
+ hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
/* if orig_node is a backbone node for this VLAN, don't compute
* the CRC as we ignore all the global entries over it
*/
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index da4c738..e298332 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -190,7 +190,7 @@ struct batadv_vlan_tt {
struct batadv_orig_node_vlan {
unsigned short vid;
struct batadv_vlan_tt tt;
- struct list_head list;
+ struct hlist_node list;
atomic_t refcount;
struct rcu_head rcu;
};
@@ -302,7 +302,7 @@ struct batadv_orig_node {
spinlock_t out_coding_list_lock; /* Protects out_coding_list */
#endif
struct batadv_frag_table_entry fragments[BATADV_FRAG_BUFFER_COUNT];
- struct list_head vlan_list;
+ struct hlist_head vlan_list;
spinlock_t vlan_list_lock; /* protects vlan_list */
struct batadv_orig_bat_iv bat_iv;
};
7 years, 7 months
[batman-adv] master's head updated: Merge branch 'next' (f2a4204)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
Branch 'master' now includes:
3c92b63 batman-adv: initialize up/down values when adding a gateway
07bec2d batman-adv: remove broadcast packets scheduled for purged outgoing if
2fc460e Merge branch 'maint' into next
f2a4204 Merge branch 'next'
7 years, 7 months
[batman-adv] master: Merge branch 'next' (f2a4204)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit f2a420406454c9667c25f8e55814e4aee96d21e5
Merge: f7d2e57 2fc460e
Author: Marek Lindner <mareklindner(a)neomailbox.ch>
Date: Sun Jun 28 21:59:21 2015 +0800
Merge branch 'next'
>---------------------------------------------------------------
f2a420406454c9667c25f8e55814e4aee96d21e5
net/batman-adv/gateway_client.c | 2 ++
net/batman-adv/send.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
7 years, 7 months
[batman-adv] next: Merge branch 'maint' into next (2fc460e)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
>---------------------------------------------------------------
commit 2fc460e52c85839846ef6f03f53291fbd4b759a0
Merge: 2474b5d 07bec2d
Author: Marek Lindner <mareklindner(a)neomailbox.ch>
Date: Sun Jun 28 21:58:46 2015 +0800
Merge branch 'maint' into next
>---------------------------------------------------------------
2fc460e52c85839846ef6f03f53291fbd4b759a0
net/batman-adv/gateway_client.c | 2 ++
net/batman-adv/send.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
7 years, 7 months
[batman-adv] maint: batman-adv: remove broadcast packets scheduled for purged outgoing if (07bec2d)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : maint
>---------------------------------------------------------------
commit 07bec2d4dec83f024baf166b95cf037be3a7eca5
Author: Simon Wunderlich <simon(a)open-mesh.com>
Date: Wed Jun 24 14:50:20 2015 +0200
batman-adv: remove broadcast packets scheduled for purged outgoing if
When an interface is purged, the broadcast packets scheduled for this
interface should get purged as well.
Signed-off-by: Simon Wunderlich <simon(a)open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
>---------------------------------------------------------------
07bec2d4dec83f024baf166b95cf037be3a7eca5
send.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/send.c b/send.c
index 23635bd..a7e84b2 100644
--- a/send.c
+++ b/send.c
@@ -598,7 +598,8 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
* we delete only packets belonging to the given interface
*/
if ((hard_iface) &&
- (forw_packet->if_incoming != hard_iface))
+ (forw_packet->if_incoming != hard_iface) &&
+ (forw_packet->if_outgoing != hard_iface))
continue;
spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
7 years, 7 months
[batman-adv] maint: batman-adv: initialize up/down values when adding a gateway (3c92b63)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : maint
>---------------------------------------------------------------
commit 3c92b633715b7eca80dc7a2347e0e4dbcce1f018
Author: Simon Wunderlich <simon(a)open-mesh.com>
Date: Wed Jun 24 14:50:19 2015 +0200
batman-adv: initialize up/down values when adding a gateway
Without this initialization, gateways which actually announce up/down
bandwidth of 0/0 could be added. If these nodes get purged via
_batadv_purge_orig() later, the gw_node structure does not get removed
since batadv_gw_node_delete() updates the gw_node with up/down
bandwidth of 0/0, and the updating function then discards the change
and does not free gw_node.
This results in leaking the gw_node structures, which references other
structures: gw_node -> orig_node -> orig_node_ifinfo -> hardif. When
removing the interface later, the open reference on the hardif may cause
hangs with the infamous "unregister_netdevice: waiting for mesh1 to
become free. Usage count = 1" message.
Signed-off-by: Simon Wunderlich <simon(a)open-mesh.com>
Acked-by: Antonio Quartulli <antonio(a)meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch>
>---------------------------------------------------------------
3c92b633715b7eca80dc7a2347e0e4dbcce1f018
gateway_client.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gateway_client.c b/gateway_client.c
index 3f32357..d8e3ead 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -419,6 +419,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv,
INIT_HLIST_NODE(&gw_node->list);
gw_node->orig_node = orig_node;
+ gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
+ gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
atomic_set(&gw_node->refcount, 1);
spin_lock_bh(&bat_priv->gw.list_lock);
7 years, 7 months
[batman-adv] master: Merge branch 'next' (f7d2e57)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit f7d2e577813a10d9773e79a83df6202c6d2159b7
Merge: 5138e6a 2474b5d
Author: Marek Lindner <mareklindner(a)neomailbox.ch>
Date: Wed Jun 24 16:08:27 2015 +0800
Merge branch 'next'
>---------------------------------------------------------------
f7d2e577813a10d9773e79a83df6202c6d2159b7
net/batman-adv/translation-table.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
7 years, 7 months