Skip to contentSkip to conversation

pull request for net: batman-adv 2017-06-13

PATCH In review Simon Wunderlich 2 participants 4 messages Jun 13, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover pull request for net: batman-adv 2017-06-13

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(-)
#2 lore raw

PATCH 1/2 batman-adv: Fix rx packet/bytes stats on local ARP reply

In reply to a message not in the archive

From: Sven Eckelmann <[email protected]>

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")
---
 net/batman-adv/distributed-arp-table.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/batman-adv/distributed-arp-table.c +3 -2
index 013e970eff39..000ca2f113ab 100644
@@ -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");
Signature · 1 line
2.11.0
#3 lore raw

PATCH 2/2 batman-adv: fix memory leak when dropping packet from other gateway

In reply to a message not in the archive

From: Andreas Pape <[email protected]>

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")
[[email protected]: adjust commit message]
---
 net/batman-adv/routing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/routing.c +1 -1
index e1ebe14ee2a6..ae9f4d37d34f 100644
@@ -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;
 			}
 		}
 
Signature · 1 line
2.11.0