android_kernel_oneplus_msm8998/net/batman-adv
Linus Lüssing cb47be3742 batman-adv: fix packet loss for broadcasted DHCP packets to a server
[ Upstream commit a752c0a4524889cdc0765925258fd1fd72344100 ]

DHCP connectivity issues can currently occur if the following conditions
are met:

1) A DHCP packet from a client to a server
2) This packet has a multicast destination
3) This destination has a matching entry in the translation table
   (FF:FF:FF:FF:FF:FF for IPv4, 33:33:00:01:00:02/33:33:00:01:00:03
    for IPv6)
4) The orig-node determined by TT for the multicast destination
   does not match the orig-node determined by best-gateway-selection

In this case the DHCP packet will be dropped.

The "gateway-out-of-range" check is supposed to only be applied to
unicasted DHCP packets to a specific DHCP server.

In that case dropping the the unicasted frame forces the client to
retry via a broadcasted one, but now directed to the new best
gateway.

A DHCP packet with broadcast/multicast destination is already ensured to
always be delivered to the best gateway. Dropping a multicasted
DHCP packet here will only prevent completing DHCP as there is no
other fallback.

So far, it seems the unicast check was implicitly performed by
expecting the batadv_transtable_search() to return NULL for multicast
destinations. However, a multicast address could have always ended up in
the translation table and in fact is now common.

To fix this potential loss of a DHCP client-to-server packet to a
multicast address this patch adds an explicit multicast destination
check to reliably bail out of the gateway-out-of-range check for such
destinations.

The issue and fix were tested in the following three node setup:

- Line topology, A-B-C
- A: gateway client, DHCP client
- B: gateway server, hop-penalty increased: 30->60, DHCP server
- C: gateway server, code modifications to announce FF:FF:FF:FF:FF:FF

Without this patch, A would never transmit its DHCP Discover packet
due to an always "out-of-range" condition. With this patch,
a full DHCP handshake between A and B was possible again.

Fixes: be7af5cf9c ("batman-adv: refactoring gateway handling code")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-30 07:49:06 +02:00
..
bat_algo.h batman-adv: update copyright years for 2015 2015-05-29 10:13:35 +02:00
bat_iv_ogm.c batman-adv: rearrange batadv_neigh_node_new() arguments to follow convention 2015-08-27 20:15:32 +02:00
bitarray.c batman-adv: Replace C99 int types with kernel type 2015-08-25 00:12:17 +02:00
bitarray.h batman-adv: Replace C99 int types with kernel type 2015-08-25 00:12:17 +02:00
bridge_loop_avoidance.c batman-adv: handle race condition for claims between gateways 2018-03-22 09:23:21 +01:00
bridge_loop_avoidance.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
debugfs.c batman-adv: Add required includes to all files 2015-06-07 17:07:19 +02:00
debugfs.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
distributed-arp-table.c batman-adv: fix header size check in batadv_dbg_arp() 2018-05-30 07:49:05 +02:00
distributed-arp-table.h batman-adv: Replace C99 int types with kernel type 2015-08-25 00:12:17 +02:00
fragmentation.c batman-adv: invalidate checksum on fragment reassembly 2018-05-30 07:49:01 +02:00
fragmentation.h batman-adv: Add required includes to all files 2015-06-07 17:07:19 +02:00
gateway_client.c batman-adv: fix packet loss for broadcasted DHCP packets to a server 2018-05-30 07:49:06 +02:00
gateway_client.h batman-adv: remove obsolete deleted attribute for gateway node 2015-08-27 20:15:32 +02:00
gateway_common.c batman-adv: Fix gw_bandwidth calculation on 32 bit systems 2015-08-25 00:12:22 +02:00
gateway_common.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
hard-interface.c batman-adv: Add lower layer needed_(head|tail)room to own ones 2015-08-27 20:15:34 +02:00
hard-interface.h batman-adv: Drop immediate batadv_hard_iface free function 2016-01-31 11:29:02 -08:00
hash.c batman-adv: Replace C99 int types with kernel type 2015-08-25 00:12:17 +02:00
hash.h batman-adv: Replace C99 int types with kernel type 2015-08-25 00:12:17 +02:00
icmp_socket.c batman-adv: Fix kerneldoc over 80 column lines 2015-08-25 00:12:18 +02:00
icmp_socket.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
Kconfig batman-adv: Kconfig, Add missing DEBUG_FS dependency 2015-01-07 22:17:11 +01:00
main.c batman-adv: remove obsolete deleted attribute for gateway node 2015-08-27 20:15:32 +02:00
main.h batman-adv: Start new development cycle 2015-08-27 20:15:33 +02:00
Makefile batman-adv: Makefile, Sort alphabetically 2015-05-29 10:13:36 +02:00
multicast.c batman-adv: fix multicast-via-unicast transmission with AP isolation 2018-05-30 07:49:06 +02:00
multicast.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
network-coding.c batman-adv: Avoid recursive call_rcu for batadv_nc_node 2016-01-31 11:29:02 -08:00
network-coding.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
originator.c batman-adv: remove unused callback from batadv_algo_ops struct 2016-10-07 15:23:47 +02:00
originator.h batman-adv: Drop immediate orig_node free function 2016-01-31 11:29:02 -08:00
packet.h batman-adv: Replace C99 int types with kernel type 2015-08-25 00:12:17 +02:00
routing.c batman-adv: Reduce refcnt of removed router when updating route 2016-05-11 11:21:18 +02:00
routing.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
send.c batman-adv: Fix broadcast/ogm queue limit on a removed interface 2016-05-11 11:21:17 +02:00
send.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
soft-interface.c batman-adv: fix packet checksum in receive path 2018-05-30 07:49:01 +02:00
soft-interface.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
sysfs.c batman-adv: Replace C99 int types with kernel type 2015-08-25 00:12:17 +02:00
sysfs.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
translation-table.c batman-adv: Check for alloc errors when preparing TT local data 2016-12-15 08:49:23 -08:00
translation-table.h batman-adv: Remove batadv_ types forward declarations 2015-08-25 00:12:20 +02:00
types.h batman-adv: remove unused callback from batadv_algo_ops struct 2016-10-07 15:23:47 +02:00