From patchwork Fri Apr 1 17:22:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 15954 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 [127.0.0.1]) by open-mesh.org (Postfix) with ESMTP id 082E1824CF; Fri, 1 Apr 2016 19:22:51 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=FCTSStPs; 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 21115824BE for ; Fri, 1 Apr 2016 19:22:49 +0200 (CEST) Received: from sven-desktop.home.narfation.org (xd9ba8664.dyn.telefonica.de [217.186.134.100]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id A30011C8001; Fri, 1 Apr 2016 19:22:48 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=narfation.org; s=20121; t=1459531368; bh=PSePsCo+LYvK5AWkrL4B6f71FEjI69iTugdGXdq6e+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCTSStPs7hKFJsFYvvr5Qf/eAj6hXU4ORQ5sHpsdYp1rF6EIdBcRiA655imbCJokG 9QZAbt/dC6Dj/UinphJT99WdnnV03nxd3Wi7Pdm/hBCO8ExjyuiEpe6V+WOa++NelG 1hqBvH0K9JltEIGA5cRbM93cRaXh2g5jCJJhcfPk= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 1 Apr 2016 19:22:36 +0200 Message-Id: <1459531356-8361-2-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1459531356-8361-1-git-send-email-sven@narfation.org> References: <1459531356-8361-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH 2/2] alfred: Only accept valid mac addresses via unix socket 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" Not only 00:00:00:00:00:00 but also multicast addresses are invalid as data source for alfred. These have to be checked too before accepting the mac address received from the client over the unix socket. Fixes: 58e109973bbe ("alfred: Allow setting the source mac via unix sock") Signed-off-by: Sven Eckelmann --- unix_sock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unix_sock.c b/unix_sock.c index a0ccc13..ee6dd8f 100644 --- a/unix_sock.c +++ b/unix_sock.c @@ -97,7 +97,6 @@ static int unix_sock_add_data(struct globals *globals, struct alfred_push_data_v0 *push, int client_sock) { - static const char zero[ETH_ALEN] = { 0 }; struct alfred_data *data; struct dataset *dataset; int len, data_len, ret = -1; @@ -124,7 +123,7 @@ static int unix_sock_add_data(struct globals *globals, /* clients should set the source mac to 00:00:00:00:00:00 * to make the server set the source for them */ - if (memcmp(zero, data->source, sizeof(data->source)) == 0) + if (!is_valid_ether_addr(data->source)) memcpy(data->source, &interface->hwaddr, sizeof(interface->hwaddr));