b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13
@ 2017-06-13 11:15 Simon Wunderlich
  2017-06-13 11:15 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix rx packet/bytes stats on local ARP reply Simon Wunderlich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Simon Wunderlich @ 2017-06-13 11:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Simon Wunderlich

Hi David,

here are two batman-adv bugfixes for net.

Please pull or let me know of any problem!

Thank you,
      Simon

The following changes since commit 2ea659a9ef488125eb46da6eb571de5eae5c43f6:

  Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)

are available in the git repository at:

  git://git.open-mesh.org/linux-merge.git tags/batadv-net-for-davem-20170613

for you to fetch changes up to a1a745ef980a1b48299ead4ea7990e62c0516f6e:

  batman-adv: fix memory leak when dropping packet from other gateway (2017-05-19 12:20:28 +0200)

----------------------------------------------------------------
Here are two batman-adv bugfixes:

 - fix rx packet counters for local ARP replies, by Sven Eckelmann

 - fix memory leaks for unicast packetes received from another gateway
   in bridge loop avoidance, by Andreas Pape

----------------------------------------------------------------
Andreas Pape (1):
      batman-adv: fix memory leak when dropping packet from other gateway

Sven Eckelmann (1):
      batman-adv: Fix rx packet/bytes stats on local ARP reply

 net/batman-adv/distributed-arp-table.c | 5 +++--
 net/batman-adv/routing.c               | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

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

* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix rx packet/bytes stats on local ARP reply
  2017-06-13 11:15 [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13 Simon Wunderlich
@ 2017-06-13 11:15 ` Simon Wunderlich
  2017-06-13 11:15 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: fix memory leak when dropping packet from other gateway Simon Wunderlich
  2017-06-13 17:46 ` [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Wunderlich @ 2017-06-13 11:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Simon Wunderlich

From: Sven Eckelmann <sven@narfation.org>

The stats are generated by batadv_interface_stats and must not be stored
directly in the net_device stats member variable. The batadv_priv
bat_counters information is assembled when ndo_get_stats is called. The
stats previously stored in net_device::stats is then overwritten.

The batman-adv counters must therefore be increased when an ARP packet is
answered locally via the distributed arp table.

Fixes: c384ea3ec930 ("batman-adv: Distributed ARP Table - add snooping functions for ARP messages")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/distributed-arp-table.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 013e970eff39..000ca2f113ab 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -1064,8 +1064,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
 
 		skb_new->protocol = eth_type_trans(skb_new, soft_iface);
 
-		soft_iface->stats.rx_packets++;
-		soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size;
+		batadv_inc_counter(bat_priv, BATADV_CNT_RX);
+		batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
+				   skb->len + ETH_HLEN + hdr_size);
 
 		netif_rx(skb_new);
 		batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n");
-- 
2.11.0


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

* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: fix memory leak when dropping packet from other gateway
  2017-06-13 11:15 [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13 Simon Wunderlich
  2017-06-13 11:15 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix rx packet/bytes stats on local ARP reply Simon Wunderlich
@ 2017-06-13 11:15 ` Simon Wunderlich
  2017-06-13 17:46 ` [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Wunderlich @ 2017-06-13 11:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Andreas Pape, Sven Eckelmann, Simon Wunderlich

From: Andreas Pape <apape@phoenixcontact.com>

The skb must be released in the receive handler since b91a2543b4c1
("batman-adv: Consume skb in receive handlers"). Just returning NET_RX_DROP
will no longer automatically free the memory. This results in memory leaks
when unicast packets from other backbones must be dropped because they
share a common backbone.

Fixes: 9e794b6bf4a2 ("batman-adv: drop unicast packets from other backbone gw")
Signed-off-by: Andreas Pape <apape@phoenixcontact.com>
[sven@narfation.org: adjust commit message]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/routing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index e1ebe14ee2a6..ae9f4d37d34f 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -987,7 +987,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
 				batadv_dbg(BATADV_DBG_BLA, bat_priv,
 					   "recv_unicast_packet(): Dropped unicast pkt received from another backbone gw %pM.\n",
 					   orig_addr_gw);
-				return NET_RX_DROP;
+				goto free_skb;
 			}
 		}
 
-- 
2.11.0


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

* Re: [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13
  2017-06-13 11:15 [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13 Simon Wunderlich
  2017-06-13 11:15 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix rx packet/bytes stats on local ARP reply Simon Wunderlich
  2017-06-13 11:15 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: fix memory leak when dropping packet from other gateway Simon Wunderlich
@ 2017-06-13 17:46 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-06-13 17:46 UTC (permalink / raw)
  To: sw; +Cc: netdev, b.a.t.m.a.n

From: Simon Wunderlich <sw@simonwunderlich.de>
Date: Tue, 13 Jun 2017 13:15:29 +0200

> here are two batman-adv bugfixes for net.
> 
> Please pull or let me know of any problem!

Pulled, thanks.

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

end of thread, other threads:[~2017-06-13 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13 11:15 [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13 Simon Wunderlich
2017-06-13 11:15 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix rx packet/bytes stats on local ARP reply Simon Wunderlich
2017-06-13 11:15 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: fix memory leak when dropping packet from other gateway Simon Wunderlich
2017-06-13 17:46 ` [B.A.T.M.A.N.] [PATCH 0/2] pull request for net: batman-adv 2017-06-13 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).