pull request for net: batman-adv 2020-08-24
Subsystems (3)
Simon Wunderlich
maintainercover pull request for net: batman-adv 2020-08-24
Hi David,
here are some bugfixes which we would like to have integrated into net.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5:
Linux 5.9-rc1 (2020-08-16 13:04:57 -0700)
are available in the Git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-net-for-davem-20200824
for you to fetch changes up to 279e89b2281af3b1a9f04906e157992c19c9f163:
batman-adv: bla: use netif_rx_ni when not in interrupt context (2020-08-18 19:40:03 +0200)
----------------------------------------------------------------
Here are some batman-adv bugfixes:
- Avoid uninitialized memory access when handling DHCP, by Sven Eckelmann
- Fix check for own OGM in OGM receive handler, by Linus Luessing
- Fix netif_rx access for non-interrupt context in BLA, by Jussi Kivilinna
----------------------------------------------------------------
Jussi Kivilinna (1):
batman-adv: bla: use netif_rx_ni when not in interrupt context
Linus Lüssing (1):
batman-adv: Fix own OGM check in aggregated OGMs
Sven Eckelmann (1):
batman-adv: Avoid uninitialized chaddr when handling DHCP
net/batman-adv/bat_v_ogm.c | 11 ++++++----- net/batman-adv/bridge_loop_avoidance.c | 5 ++++- net/batman-adv/gateway_client.c | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-)
Simon Wunderlich
maintainerPATCH 1/3 batman-adv: Avoid uninitialized chaddr when handling DHCP
From: Sven Eckelmann <[email protected]>
The gateway client code can try to optimize the delivery of DHCP packets to avoid broadcasting them through the whole mesh. But also transmissions to the client can be optimized by looking up the destination via the chaddr of the DHCP packet.
But the chaddr is currently only done when chaddr is fully inside the non-paged area of the skbuff. Otherwise it will not be initialized and the unoptimized path should have been taken.
But the implementation didn't handle this correctly. It didn't retrieve the correct chaddr but still tried to perform the TT lookup with this uninitialized memory.
--- net/batman-adv/gateway_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/batman-adv/gateway_client.c +4 -2
@@ -703,8 +703,10 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, chaddr_offset = *header_len +BATADV_DHCP_CHADDR_OFFSET ;/* store the client address if the message is going to a client */ -if (ret ==BATADV_DHCP_TO_CLIENT && -pskb_may_pull (skb, chaddr_offset +ETH_ALEN )) { +if (ret ==BATADV_DHCP_TO_CLIENT ) { +if (!pskb_may_pull (skb, chaddr_offset +ETH_ALEN )) +return BATADV_DHCP_NO ; +/* check if the DHCP packet carries an Ethernet DHCP */ p = skb->data + *header_len +BATADV_DHCP_HTYPE_OFFSET ;if (*p !=BATADV_DHCP_HTYPE_ETHERNET )
Signature · 1 line
2.20.1
Simon Wunderlich
maintainerPATCH 2/3 batman-adv: Fix own OGM check in aggregated OGMs
In reply to Simon WunderlichFrom: Linus Lüssing <[email protected]>
The own OGM check is currently misplaced and can lead to the following issues:
For one thing we might receive an aggregated OGM from a neighbor node which has our own OGM in the first place. We would then not only skip our own OGM but erroneously also any other, following OGM in the aggregate.
For another, we might receive an OGM aggregate which has our own OGM in a place other then the first one. Then we would wrongly not skip this OGM, leading to populating the orginator and gateway table with ourself.
--- net/batman-adv/bat_v_ogm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/batman-adv/bat_v_ogm.c +6 -5
@@ -881,6 +881,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,ntohl (ogm_packet->seqno), ogm_throughput, ogm_packet->ttl, ogm_packet->version, ntohs(ogm_packet->tvlv_len)); +if (batadv_is_my_mac (bat_priv, ogm_packet->orig)) { +batadv_dbg (BATADV_DBG_BATMAN , bat_priv, +"Drop packet: originator packet from ourself\n" ); +return ; + } +/* If the throughput metric is 0, immediately drop the packet. No need * to create orig_node / neigh_node for an unusable route. */
@@ -1008,11 +1014,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,if (batadv_is_my_mac (bat_priv, ethhdr->h_source)) goto free_skb; - ogm_packet = (struct batadv_ogm2_packet *)skb->data; - -if (batadv_is_my_mac (bat_priv, ogm_packet->orig)) - goto free_skb; -batadv_inc_counter (bat_priv,BATADV_CNT_MGMT_RX );batadv_add_counter (bat_priv,BATADV_CNT_MGMT_RX_BYTES , skb->len +ETH_HLEN );
Signature · 1 line
2.20.1
Simon Wunderlich
maintainerPATCH 3/3 batman-adv: bla: use netif_rx_ni when not in interrupt context
In reply to Simon WunderlichFrom: Jussi Kivilinna <[email protected]>
batadv_bla_send_claim() gets called from worker thread context through batadv_bla_periodic_work(), thus netif_rx_ni needs to be used in that case. This fixes "NOHZ: local_softirq_pending 08" log messages seen when batman-adv is enabled.
--- net/batman-adv/bridge_loop_avoidance.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/bridge_loop_avoidance.c +4 -1
@@ -437,7 +437,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,batadv_add_counter (bat_priv,BATADV_CNT_RX_BYTES , skb->len +ETH_HLEN ); -netif_rx (skb); +if (in_interrupt ()) +netif_rx (skb); +else +netif_rx_ni (skb); out:if (primary_if)batadv_hardif_put (primary_if);
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Simon Wunderlich <[email protected]>
Date: Mon, 24 Aug 2020 18:21:08 +0200
Quoted 3 lines
here are some bugfixes which we would like to have integrated into net.
Please pull or let me know of any problem!
Pulled, thanks.