From patchwork Sun Jan 28 04:06:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 1635 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id B8DAB601CB for ; Sat, 27 Jan 2018 18:06:28 +0100 (CET) Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 8AA5246DB; Sat, 27 Jan 2018 18:06:28 +0100 (CET) Received: from localhost.localdomain (unknown [10.172.1.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 1690046D2; Sat, 27 Jan 2018 18:06:27 +0100 (CET) From: Jonatan Schlag To: network@lists.ipfire.org Subject: [PATCH] Fix radvd startup Date: Sat, 27 Jan 2018 17:06:18 +0000 Message-Id: <1517072778-3768-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.21 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 fr a zone into the config file and when no errors happen. Fixes: #11450 Signed-off-by: Jonatan Schlag --- src/functions/functions.radvd | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/functions/functions.radvd b/src/functions/functions.radvd index 4e41160..bd016a0 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,12 +48,19 @@ 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} && [ ${return_value} = ${EXIT_TRUE} ]; then + # We return TRUE when __radvd_config_interface succeed and no errors happend till now + return_value=${EXIT_TRUE} + else + return_value=${EXIT_FALSE} + fi done >> ${RADVD_CONFIGFILE} - return ${EXIT_OK} + return ${return_value} } __radvd_config_interface() {