From patchwork Sat Feb 10 23:14:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 1648 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id 0098F602CB for ; Sat, 10 Feb 2018 13:14:14 +0100 (CET) X-Virus-Scanned: ClamAV at mail01.ipfire.org X-Spam-Flag: NO X-Spam-Score: -1.1 X-Spam-Level: X-Spam-Status: No, score=-1.1 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id AF4CB10FEF4A; Sat, 10 Feb 2018 12:14:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org AF4CB10FEF4A Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=ipfire.org Authentication-Results: mail01.ipfire.org; spf=pass smtp.mailfrom=network-bounces@lists.ipfire.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ipfire.org; s=201801; t=1518264853; x=1520856853; bh=vr3liSEMcHkQDT4B1XZkzlsPQWoTgyMeXsvRUhzufQA=; h=From:To:Subject:Date:Message-Id:Sender:From:To:Cc:Date: Content-Type:Message-ID:In-Reply-To:Subject:Reply-To:Sender; b=dk+0SWf+duXFDPTWvx3oEOsFBFYhjGWH9SIYd9N7fGSYi9OodlamEbFpXM4J4DNR+ ucpaWDeOA1IJWz+mguu3GKmp45UQAx0yGBprwlqw2FXw0Y0rwU/IuOvxeCFc1212Lt wiLadKGUIGS1DYA9I4KA8gjHbg8lnL/McTSmfdueHMDYeNWnsx3n7rTG4BG5DbiaM1 gP/kSxfGNt5STNupnjOHXUCF9OPq1qrt/VNXsT9/f79C7vPnmeuT7Qslzxi6qa6a2C OTEaXMqX9zifECgadTiWP88JnNhJfxgZ9B0LHtDBKRqzwJsrknLsSlwJFanFE7W03H 9fhygMsBhIriQ== X-Virus-Scanned: ClamAV at mail01.ipfire.org Received: from localhost.localdomain (fw-1.cvjm.hk-net.de [95.129.212.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jschlag) by mail01.ipfire.org (Postfix) with ESMTPSA id BAC3A108C3B9; Sat, 10 Feb 2018 12:14:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mail01.ipfire.org BAC3A108C3B9 Authentication-Results: mail01.ipfire.org; dmarc=none (p=none dis=none) header.from=ipfire.org Authentication-Results: mail01.ipfire.org; spf=fail smtp.mailfrom=jonatan.schlag@ipfire.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ipfire.org; s=201801; t=1518264850; x=1520856850; bh=vr3liSEMcHkQDT4B1XZkzlsPQWoTgyMeXsvRUhzufQA=; h=From:To:Cc:Subject:Date:Message-Id:From:To:Cc:Date:Content-Type: Message-ID:In-Reply-To:Subject:Reply-To:Sender; b=eECuKUMyGIOef9mjQAdpWtfqSneqSBAMM7SOHJr8YenwDfGyLSgizOiS7xJqFX3R6 KgESdBkfEPwNp3YDHpbhK3CFr/APIOvAiRHoskwGk9Jt5LLq6lPtHnbRarVCjCTS+B kI/ejH8+b+XRf94XFmx6v6Iz+aN7bceEYGGtuk0i7Qb6uCeH6JxfTc3Rm6I73ZGjpc YAJreF3d0xyu4bnk6PxeRTL+Zbs0YMmyVGVtC73vIYQXsDDG8jrVfpMyzB61lfok30 5ljrbhlH41qValSR993ZjAzF6USYh0uPQRgL1nFXnez4ysIL6QUDt0FexbUXRZkShb 0AnDaG1YsVTsA== From: Jonatan Schlag To: network@lists.ipfire.org Subject: [PATCH v2] Fix radvd startup Date: Sat, 10 Feb 2018 12:14:05 +0000 Message-Id: <1518264845-8257-1-git-send-email-jonatan.schlag@ipfire.org> X-Mailer: git-send-email 2.6.3 X-BeenThere: network@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List for the network package List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: network-bounces@lists.ipfire.org Sender: "network" We now only start radvd when we write a config for a zone into the config file. Fixes: #11450 Signed-off-by: Jonatan Schlag --- src/functions/functions.radvd | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/functions/functions.radvd b/src/functions/functions.radvd index 4e41160..1c8b8d0 100644 --- a/src/functions/functions.radvd +++ b/src/functions/functions.radvd @@ -23,16 +23,16 @@ RADVD_CONFIGFILE="/etc/radvd.conf" radvd_update() { # (Re-)write the configuration file - radvd_write_config - - # Reload the radvd service if it is already running - if service_is_active radvd; then - service_reload radvd - return ${EXIT_OK} + if radvd_write_config; then + # Reload the radvd service if it is already running + if service_is_active radvd; then + service_reload radvd + return ${EXIT_OK} + fi + + # Start the radvd service + service_start radvd fi - - # Start the radvd service - service_start radvd } radvd_clear_config() { @@ -48,14 +48,21 @@ radvd_write_config() { # Write the configuration for all zones. local zone - for zone in $(zones_get_local); do - __radvd_config_interface ${zone} + # The return value determine if radvd is started or not + local return_value=${EXIT_FALSE} + + for zone in $(zones_get_local); do + if __radvd_config_interface ${zone}; then + # We return TRUE when __radvd_config_interface returns True + return_value=${EXIT_TRUE} + fi done >> ${RADVD_CONFIGFILE} - return ${EXIT_OK} + return ${return_value} } +# This function return ${EXIT_FALSE} if no radvd config was written and ${EXIT_TRUE} in all other cases __radvd_config_interface() { local zone=${1} assert isset zone @@ -65,17 +72,17 @@ __radvd_config_interface() { # If the interface does not provide any routing information, # we can skip this whole stuff. if ! db_exists "${zone}/ipv6"; then - return ${EXIT_OK} + return ${EXIT_FALSE} fi # Skip if zone is not active. local active="$(db_get "${zone}/ipv6/active")" - [ "${active}" = "0" ] && return ${EXIT_OK} + [ "${active}" = "0" ] && return ${EXIT_FALSE} # Skip if there is no prefix or prefix is link-local. local addr="$(db_get "${zone}/ipv6/local-ip-address")" if [ -z "${addr}" ] || [ "${addr:0:5}" = "fe80:" ]; then - return ${EXIT_OK} + return ${EXIT_FALSE} fi # Check if the subnet is configured by the DHCP server. @@ -116,6 +123,8 @@ __radvd_config_interface() { print "};" print + + return ${EXIT_TRUE} } __radvd_config_dns() {