From patchwork Thu Jun 1 06:26:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17028 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 7B4A181FDC; Thu, 1 Jun 2017 09:27:57 +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="pKXnwuad"; dkim-atps=neutral Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 33D7080BA3 for ; Thu, 1 Jun 2017 08:26:36 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p2003007C6F608AFE527B9DFFFECE2683.dip0.t-ipconnect.de [IPv6:2003:7c:6f60:8afe:527b:9dff:fece:2683]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 97C581100B4; Thu, 1 Jun 2017 08:26:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1496298395; bh=hBVMxvg1fAiBwYyV1eeVqCaGUqH60jWxOcS4aryJTxs=; h=From:To:Cc:Subject:Date:From; b=pKXnwuad8FU6PYw4xd1i1DiqZE8EuEJk3LGLBmgIlptLtJyXWOXa9NuZpXYJqEv/n HZsG8yAbiHEA8hVMj4xeQYLLLmYZ1fM8+0uHw330xj9f/V+NqbxcDQJrgDqz+cuYvo hkV8a1VfpG0NVyzChc++2bZ3saNcRVTcAFu7nnWM= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 1 Jun 2017 08:26:30 +0200 Message-Id: <20170601062632.4239-1-sven@narfation.org> X-Mailer: git-send-email 2.11.0 Subject: [B.A.T.M.A.N.] [PATCH 1/3] alfred: Check if tg hash was really initialized 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" The return value check after the tg_hash_new call must actually check the return value and not some other datastructure. Fixes: a7bc3d9a2b3f ("alfred: Cache the global translation table entries") Signed-off-by: Sven Eckelmann --- server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.c b/server.c index 1e358cf..9774281 100644 --- a/server.c +++ b/server.c @@ -232,7 +232,7 @@ static void update_server_info(struct globals *globals) if (strcmp(globals->mesh_iface, "none") != 0) { tg_hash = tg_hash_new(globals->mesh_iface); - if (!globals->data_hash) { + if (!tg_hash) { fprintf(stderr, "Failed to create translation hash\n"); return; } From patchwork Thu Jun 1 06:26:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17029 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 2FC2881FE6; Thu, 1 Jun 2017 09:28:10 +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="IFFNxBWl"; dkim-atps=neutral Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 0753C80BA3 for ; Thu, 1 Jun 2017 08:26:39 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p2003007C6F608AFE527B9DFFFECE2683.dip0.t-ipconnect.de [IPv6:2003:7c:6f60:8afe:527b:9dff:fece:2683]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 12A881100B4; Thu, 1 Jun 2017 08:26:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1496298398; bh=NiMgmTBy1/ByZ4mEbVr1ld46BFRAE0HiPrdz6WX1tDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFFNxBWlxMBeEC5UG+tS2zi840YyvIbk3DZbxY+Qpgr/NOoTc2hZ/syuyO1U7tlnY /zTng/QTxgyt2T6F9sMbdGggZoHZnR+w81cA4HZRNaXpMQqI1aAv/H8ozIEqG8NZJn B0qmR6dKoQX/goMybJ4J4XD5G/Ek7+aQ5Z+8CjrM= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 1 Jun 2017 08:26:31 +0200 Message-Id: <20170601062632.4239-2-sven@narfation.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170601062632.4239-1-sven@narfation.org> References: <20170601062632.4239-1-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH 2/3] alfred: Always initialize orig cache hash pointer 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" The initialization of the cache can be disabled when mesh interface is "none". We must therefore make sure that the remaining code is not accessing the uninitialized pointer to the originator cache. Fixes: e50d18c39f92 ("alfred: Cache the TQ values for each originator") Signed-off-by: Sven Eckelmann --- server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.c b/server.c index 9774281..e7f691c 100644 --- a/server.c +++ b/server.c @@ -224,7 +224,7 @@ static void update_server_info(struct globals *globals) struct interface *interface; struct ether_addr *macaddr; struct hashtable_t *tg_hash; - struct hashtable_t *orig_hash; + struct hashtable_t *orig_hash = NULL; /* TQ is not used for master sync mode */ if (globals->opmode == OPMODE_MASTER) From patchwork Thu Jun 1 06:26:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17030 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 D7B6781FED; Thu, 1 Jun 2017 09:28: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="BTA9MlD8"; dkim-atps=neutral Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id D597D80BA3 for ; Thu, 1 Jun 2017 08:26:40 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p2003007C6F608AFE527B9DFFFECE2683.dip0.t-ipconnect.de [IPv6:2003:7c:6f60:8afe:527b:9dff:fece:2683]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 31AF51100B4; Thu, 1 Jun 2017 08:26:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1496298400; bh=YQYgxqcx3i03nodM7g+sE4hKGb0eUSI694NZlwKfrfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTA9MlD8KE7at7Q67Ma+FlMCUzxEwyGFcI2GIdNYOvYZCo31Zg8BXlEm8uvwnsnFG dnTfOf++A1IUcUd+7abCtxBkeifsQlVmUEwpRD6AbnNZHfSQmi8sheMncUlG73XN+5 dUZ4Fz/jTurg2KY6aH4ARn/OSiuze7flyHIuCQkY= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 1 Jun 2017 08:26:32 +0200 Message-Id: <20170601062632.4239-3-sven@narfation.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170601062632.4239-1-sven@narfation.org> References: <20170601062632.4239-1-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH 3/3] alfred: Always initialize translation cache hash pointer 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" The initialization of the cache can be disabled when mesh interface is "none". We must therefore make sure that the remaining code is not accessing the uninitialized pointer to the translation cache. Fixes: a7bc3d9a2b3f ("alfred: Cache the global translation table entries") Signed-off-by: Sven Eckelmann --- server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.c b/server.c index e7f691c..b6f0812 100644 --- a/server.c +++ b/server.c @@ -223,7 +223,7 @@ static void update_server_info(struct globals *globals) struct hash_it_t *hashit = NULL; struct interface *interface; struct ether_addr *macaddr; - struct hashtable_t *tg_hash; + struct hashtable_t *tg_hash = NULL; struct hashtable_t *orig_hash = NULL; /* TQ is not used for master sync mode */