From patchwork Mon Oct 9 15:33:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17100 X-Patchwork-Delegate: sw@simonwunderlich.de 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 736E882043; Mon, 9 Oct 2017 17:33:17 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="jRXfM9M2"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver= Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id 6F3DB8033F for ; Mon, 9 Oct 2017 17:33:12 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p2003007C6F4D0EFE81F09946C9127996.dip0.t-ipconnect.de [IPv6:2003:7c:6f4d:efe:81f0:9946:c912:7996]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id F3F1B1100FB; Mon, 9 Oct 2017 17:33:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1507563192; bh=4tyC/mPBrsIuAZmqfxUTA5BEcPGala32CS1zFmHdxTA=; h=From:To:Cc:Subject:Date:From; b=jRXfM9M2gi30idCRsoYoQGkBGBWeYE0+exHKLuXcbm3KENTFyuSQzmlISKTAO1KR+ Zwl8d2EovBJSkdCrFYOqs2p+mls3uGK31A0CM3MUmLF0wcD4EsRjTHPmYETZLu9CSf 9ah6YPg3hBI8NAqahcPexfPdvzgVYDYQM4qaR/s0= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 9 Oct 2017 17:33:06 +0200 Message-Id: <20171009153307.29245-1-sven@narfation.org> X-Mailer: git-send-email 2.11.0 Subject: [B.A.T.M.A.N.] [PATCH 1/2] alfred: Only query debugfs when netlink failed X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 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" It is enough to just request the data from netlink and skip debugfs when netlink didn't return an error. The overwrite of the ret variable was only for testing purposes and should no longer be used. Fixes: a7bc3d9a2b3f ("alfred: Cache the global translation table entries") Signed-off-by: Sven Eckelmann --- batadv_query.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/batadv_query.c b/batadv_query.c index 8580f1b..78b92cd 100644 --- a/batadv_query.c +++ b/batadv_query.c @@ -308,7 +308,6 @@ struct hashtable_t *tg_hash_new(const char *mesh_iface) ret = translate_mac_netlink(mesh_iface, tg_hash); enable_net_admin_capability(0); - ret = -EOPNOTSUPP; if (ret == -EOPNOTSUPP) translate_mac_debugfs(mesh_iface, tg_hash); @@ -477,7 +476,6 @@ struct hashtable_t *orig_hash_new(const char *mesh_iface) ret = get_tq_netlink(mesh_iface, orig_hash); enable_net_admin_capability(0); - ret = -EOPNOTSUPP; if (ret == -EOPNOTSUPP) get_tq_debugfs(mesh_iface, orig_hash); From patchwork Mon Oct 9 15:33:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17101 X-Patchwork-Delegate: sw@simonwunderlich.de 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 31CFF82188; Mon, 9 Oct 2017 17:33:20 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="RtPCIEuX"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver= Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id 27B3D8033F for ; Mon, 9 Oct 2017 17:33:14 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p2003007C6F4D0EFE81F09946C9127996.dip0.t-ipconnect.de [IPv6:2003:7c:6f4d:efe:81f0:9946:c912:7996]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id A2E811100FB; Mon, 9 Oct 2017 17:33:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1507563194; bh=L9Oc109S8etTpsY0zXBu+FiTj2nlA+h4Q7vhwPlPEJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RtPCIEuXUFoShS3DWlSnCYzjKftIFVHlfVAu//mqLVPllIB5ngvDzim9uKyksAAND XPeheFGOps8G0bcrECSk/O8jxyGidfrz4f7ioUsLb8rXIm0lr7y0DQMCl38khE2ucd 3s5WcK6SDEK6TBI7zAE4a4WeaiJfL22cjTqejrMg= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 9 Oct 2017 17:33:07 +0200 Message-Id: <20171009153307.29245-2-sven@narfation.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171009153307.29245-1-sven@narfation.org> References: <20171009153307.29245-1-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH 2/2] alfred: Only check for minimal length of fixed size packets X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 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" These fixed size packets could have some optional information in the future. We should therefore not limit the size of these packets to the size of the non-tlv header. Signed-off-by: Sven Eckelmann --- Any objections? Not sure if this is really necessary. But could be useful in the future. --- recv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recv.c b/recv.c index 12bb3f1..e897e3d 100644 --- a/recv.c +++ b/recv.c @@ -284,7 +284,7 @@ process_alfred_announce_master(struct globals *globals, if (announce->header.version != ALFRED_VERSION) return -1; - if (len != (sizeof(*announce) - sizeof(announce->header))) + if (len < (sizeof(*announce) - sizeof(announce->header))) return -1; server = hash_find(interface->server_hash, &mac); @@ -320,7 +320,7 @@ static int process_alfred_request(struct globals *globals, if (request->header.version != ALFRED_VERSION) return -1; - if (len != (sizeof(*request) - sizeof(request->header))) + if (len < (sizeof(*request) - sizeof(request->header))) return -1; push_data(globals, interface, source, SOURCE_SYNCED, @@ -343,7 +343,7 @@ static int process_alfred_status_txend(struct globals *globals, if (request->header.version != ALFRED_VERSION) return -1; - if (len != (sizeof(*request) - sizeof(request->header))) + if (len < (sizeof(*request) - sizeof(request->header))) return -1; if (globals->ipv4mode)