[2/2] batman-adv: Use broadcast as fallback for gateway replies

Message ID 1465721000-9174-2-git-send-email-sven@narfation.org (mailing list archive)
State Rejected, archived
Delegated to: Marek Lindner
Headers

Commit Message

Sven Eckelmann June 12, 2016, 8:43 a.m. UTC
  The replies from gateway server to gateway client are usually sent via
unicast packets. This only works when the destination address for the reply
is already known to the translation table. But usually the gateway replies
are in response to the first known contact from a device to the gateway
server. So it can happen that the TT entry was not yet created.

The gateway server has therefore use broadcast as fallback when the entry
is not yet known. This makes the first responses from a DHCP server to a
DHCP client more robust.

Fixes: 2d5b555644b2 ("batman-adv: send every DHCP packet as bat-unicast")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/soft-interface.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Sven Eckelmann July 1, 2016, 8 a.m. UTC | #1
[....]
> Hm, I'm wondering what kind of overhead implications this could
> have in larger mesh networks.
> 
> Didn't TT support temporary entries? Could the gateway server
> inject them into its global translation table after parsing an
> incoming DHCP packet?

Right now we have the problem that DHCP requests (broadcasts by the user) are
encapsulated by the gateway code in the wrong type of packet [1,2,3]. These
are the unicast packets (non-4addr) which cannot be used to create temporary
TT entries. This should be addressed by the first patch.

The second patch is currently only my bandaid (because I cannot patch all APs)
and I would be more than happy when this patch is not required. So I would not
object when this patch is rejected because it causes noise on the network.

For example gluon already accepted the first patch [4] and thus will hopefully
not require the second patch anymore with 2016.2.0 for clients doing their
DHCP Discover as broadcast.

Btw. the non-RFC version of the patch is here:

 https://patchwork.open-mesh.org/patch/16377/

I have taken the freedom to move the reply to this patch.


Kind regards,
	Sven

[1] https://patchwork.open-mesh.org/patch/16376/
[2] https://git.open-mesh.org/batman-adv.git/blob/a36b7a3b08f4cc7c41103aa4db176a11e965e068:/net/batman-adv/routing.c#l914
[3] https://git.open-mesh.org/batman-adv.git/blob/a36b7a3b08f4cc7c41103aa4db176a11e965e068:/net/batman-adv/soft-interface.c#l468
[4] https://github.com/freifunk-gluon/gluon/commit/93fe275000b65a4148d6a9713a030b0d30e6a9f1
  

Patch

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 216ac03..5829695 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -297,6 +297,18 @@  send:
 			if (forw_mode == BATADV_FORW_SINGLE)
 				do_bcast = false;
 		}
+
+		/* DHCP to from server to client should use unicast when TT
+		 * entry is available and use broadcast as fallback
+		 */
+		if (!mcast_single_orig && dhcp_rcp == BATADV_DHCP_TO_CLIENT) {
+			mcast_single_orig = batadv_transtable_search(bat_priv,
+								     NULL,
+								     dst_hint,
+								     vid);
+			if (!mcast_single_orig)
+				do_bcast = true;
+		}
 	}
 
 	batadv_skb_set_priority(skb, 0);