All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway
@ 2015-06-24 12:50 Simon Wunderlich
  2015-06-24 12:50 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: remove broadcast packets scheduled for purged outgoing if Simon Wunderlich
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Simon Wunderlich @ 2015-06-24 12:50 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

From: Simon Wunderlich <simon@open-mesh.com>

Without this initialization, gateways which actually announce up/down
bandwidth of 0/0 could be added. If these nodes get purged 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@open-mesh.com>
---
 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);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: remove broadcast packets scheduled for purged outgoing if
  2015-06-24 12:50 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway Simon Wunderlich
@ 2015-06-24 12:50 ` Simon Wunderlich
  2015-06-28 13:58   ` Marek Lindner
  2015-06-24 19:05 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway Antonio Quartulli
  2015-06-28 13:53 ` Marek Lindner
  2 siblings, 1 reply; 5+ messages in thread
From: Simon Wunderlich @ 2015-06-24 12:50 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

From: Simon Wunderlich <simon@open-mesh.com>

When an interface is purged, the broadcast packets scheduled for this
interface should get purged as well.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
---
 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);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway
  2015-06-24 12:50 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway Simon Wunderlich
  2015-06-24 12:50 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: remove broadcast packets scheduled for purged outgoing if Simon Wunderlich
@ 2015-06-24 19:05 ` Antonio Quartulli
  2015-06-28 13:53 ` Marek Lindner
  2 siblings, 0 replies; 5+ messages in thread
From: Antonio Quartulli @ 2015-06-24 19:05 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

Nice catch!

On 24/06/15 14:50, Simon Wunderlich wrote:
> From: Simon Wunderlich <simon@open-mesh.com>
> 
> Without this initialization, gateways which actually announce up/down
> bandwidth of 0/0 could be added. If these nodes get purged later, the

as clarified on IRC here Simon was referring to the orig_node purge
routine (_batadv_purge_orig()) that calls batadv_gw_node_delete().

> 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.
> 

I have witnessed situations where nodes in the mesh receive GW TVLV
with bandwidth 0/0 even if it shouldn't be such. Therefore the situation
scenario described by Simon is more likely than what one might think.

I also think that we should investigate why we see this 0/0 announcement
when we should not. But this is for another thread ;)

> 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@open-mesh.com>

Acked-by: Antonio Quartulli <antonio@meshcoding.com>

Good job!

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway
  2015-06-24 12:50 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway Simon Wunderlich
  2015-06-24 12:50 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: remove broadcast packets scheduled for purged outgoing if Simon Wunderlich
  2015-06-24 19:05 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway Antonio Quartulli
@ 2015-06-28 13:53 ` Marek Lindner
  2 siblings, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2015-06-28 13:53 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 964 bytes --]

On Wednesday, June 24, 2015 14:50:19 Simon Wunderlich wrote:
> From: Simon Wunderlich <simon@open-mesh.com>
> 
> Without this initialization, gateways which actually announce up/down
> bandwidth of 0/0 could be added. If these nodes get purged 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@open-mesh.com>
> ---
>  gateway_client.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied in revision 3c92b63.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: remove broadcast packets scheduled for purged outgoing if
  2015-06-24 12:50 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: remove broadcast packets scheduled for purged outgoing if Simon Wunderlich
@ 2015-06-28 13:58   ` Marek Lindner
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2015-06-28 13:58 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Wednesday, June 24, 2015 14:50:20 Simon Wunderlich wrote:
> From: Simon Wunderlich <simon@open-mesh.com>
> 
> When an interface is purged, the broadcast packets scheduled for this
> interface should get purged as well.
> 
> Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
> ---
>  send.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied in revision 07bec2d.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-28 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 12:50 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway Simon Wunderlich
2015-06-24 12:50 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: remove broadcast packets scheduled for purged outgoing if Simon Wunderlich
2015-06-28 13:58   ` Marek Lindner
2015-06-24 19:05 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: initialize up/down values when adding a gateway Antonio Quartulli
2015-06-28 13:53 ` Marek Lindner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.