From patchwork Sun Jun 12 08:43:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16377 X-Patchwork-Delegate: mareklindner@neomailbox.ch Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 1011281BEB; Sun, 12 Jun 2016 10:43:35 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=lwR0RvxQ; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 165E681CF0 for ; Sun, 12 Jun 2016 10:43:29 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p4FCB2AF6.dip0.t-ipconnect.de [79.203.42.246]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 799EA1100E8; Sun, 12 Jun 2016 10:43:29 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1465721009; bh=GSm47jihTbXklN8MolBKvE7pVtGzYzO6D8qqva5uTCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwR0RvxQRKIQBMIAQO2y9CWL7cePmE5f5X4O+OlivuxMAcEFE8QnNsybIRcfiiML5 eLIF7AnXtR+qus56HMc88dPhSdTrMfcBQZZNb/HfEY9th5fPr1cS9SrY2NDm3SjXRE ObhYIrgmwZ8UMAAUcZQc2gvyvDy3k3r5/qWcCWTg= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 12 Jun 2016 10:43:20 +0200 Message-Id: <1465721000-9174-2-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1465721000-9174-1-git-send-email-sven@narfation.org> References: <1465721000-9174-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Use broadcast as fallback for gateway replies X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" 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 --- net/batman-adv/soft-interface.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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);