From patchwork Fri Sep 1 11:22:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Palsson X-Patchwork-Id: 808638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nR7qMUBJ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xkH1235D4z9s72 for ; Fri, 1 Sep 2017 21:23:18 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=J/zJbkn5t7K+twyqY0df8OGbO2ULtZDtQCJ2wFqgPho=; b=nR7qMUBJTRYxhu fuCDllmf7Q05AP+BtseXFc9J+Y4jpUePd0Rcy1WzJhdN/v5lfRBth2dnQotSNGCqGPb6fqm1PgRqY IpXS70p1XOgpeBStwNrLKSzbBnynVxt8dcPJeSjCYI9B4283fCv1V7dL/7JK+/f3GYZKHo33CY3Wf cbozg2LJKw4cN8rG4wGEO0laLVN0Y55jwXyqrgD0wYp3Iqt2lItMpyVlb96eNn154l999bOc4POR/ SXBj8eSIf8/7mQL7uNCLa/s72oNxU8p/5AsgMP1znu8yIV4ISY4owt7CwG0zgp/ohzzO+rFp8tVnG 9RPN4ZyXj5omOjphV//g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dnk2R-00014c-5f; Fri, 01 Sep 2017 11:23:03 +0000 Received: from palmtree.beeroclock.net ([178.79.160.154]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dnk2M-00013V-Iq for lede-dev@lists.infradead.org; Fri, 01 Sep 2017 11:23:00 +0000 Received: from cuth.localdomain.localdomain (rtr1.dogg-hlidasmara14.sip.is [178.19.53.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: karlp) by palmtree.beeroclock.net (Postfix) with ESMTPSA id 9725310154; Fri, 1 Sep 2017 11:22:19 +0000 (UTC) From: Karl Palsson To: lede-dev@lists.infradead.org Date: Fri, 1 Sep 2017 11:22:11 +0000 Message-Id: <1504264931-7435-1-git-send-email-karlp@etactica.com> X-Mailer: git-send-email 2.4.11 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170901_042258_769707_B1E35E7C X-CRM114-Status: UNSURE ( 5.40 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=karlp%40etactica.com; ip=178.79.160.154; r=bombadil.infradead.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCHv2] odhcpd: don't enable server mode on non-static lan port X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Karl Palsson MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Instead of blindly enabling the odhcpd v6 server and RA server on the lan port, only do that if the lan port protocol is "static" This prevents the unhelpful case of a device being a dhcpv4 client and v6 server on the same ethernet port. Signed-off-by: Karl Palsson --- Changes since v1 * use /etc/board.json instead of assuming uci has been updated * make server _only_ for static, instead of everything but dhcp * remove logging, no other early service logs anything package/network/services/odhcpd/files/odhcpd.defaults | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/network/services/odhcpd/files/odhcpd.defaults b/package/network/services/odhcpd/files/odhcpd.defaults index e184da90acbb..e9b2353f063b 100644 --- a/package/network/services/odhcpd/files/odhcpd.defaults +++ b/package/network/services/odhcpd/files/odhcpd.defaults @@ -2,6 +2,21 @@ uci -q get dhcp.odhcpd && exit 0 touch /etc/config/dhcp +. /usr/share/libubox/jshn.sh + +json_load "$(cat /etc/board.json)" +json_select network +json_select lan +json_get_vars protocol +json_select .. +json_select .. + +case "$protocol" in +# only enable server mode on statically addressed lan ports +"static") MODE=server ;; +*) MODE=disabled ;; +esac + uci batch <