From ef83821e5164e3cef38565f25ff3195683ea5cd2 Mon Sep 17 00:00:00 2001 From: Daniel Danzberger Date: Wed, 2 Feb 2022 13:10:24 +0100 Subject: [PATCH] olsrd: don't start service when ignored When olsrd was disabled by uci (olsrd.olsrd.ignore=true), the service got started anyway. This results in olsrd spamming the syslog when getting started by procd without a valid configuration: -- daemon.err olsrd[8223]: olsrd exit: main: Bad configuration -- This commit only starts the olsrd service when not set to ignore. Signed-off-by: Daniel Danzberger --- olsrd/files/olsrd.config | 3 ++- olsrd/files/olsrd4.init | 7 +++++-- olsrd/files/olsrd6.config | 3 ++- olsrd/files/olsrd6.init | 7 +++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/olsrd/files/olsrd.config b/olsrd/files/olsrd.config index 68024ed3b..425b2ffb9 100644 --- a/olsrd/files/olsrd.config +++ b/olsrd/files/olsrd.config @@ -1,6 +1,7 @@ -config olsrd +config olsrd olsrd # uncomment the following line to use a custom config file instead: #option config_file '/etc/olsrd.conf' + option ignore 0 config LoadPlugin option library 'olsrd_arprefresh.so.0.1' diff --git a/olsrd/files/olsrd4.init b/olsrd/files/olsrd4.init index 62cb66d6f..1475efaf3 100644 --- a/olsrd/files/olsrd4.init +++ b/olsrd/files/olsrd4.init @@ -39,17 +39,20 @@ boot() start_service() { olsrd_generate_config $OLSRD - procd_open_instance - config_load olsrd local _respawn_threshold local _respawn_timeout local _respawn_retry + local _ignore config_get _respawn_threshold procd respawn_threshold 3600 config_get _respawn_timeout procd respawn_timeout 15 config_get _respawn_retry procd respawn_retry 0 + config_get_bool _ignore olsrd ignore 0 + [ $_ignore -ne 0 ] && return + + procd_open_instance procd_set_param command "$BIN" procd_append_param command -f ${CONF} procd_append_param command -nofork diff --git a/olsrd/files/olsrd6.config b/olsrd/files/olsrd6.config index 52a9b21cd..c26bd6c0b 100644 --- a/olsrd/files/olsrd6.config +++ b/olsrd/files/olsrd6.config @@ -1,6 +1,7 @@ -config olsrd +config olsrd olsrd # uncomment the following line to use a custom config file instead: #option config_file '/etc/olsrd6.conf' + option ignore 0 config LoadPlugin option library 'olsrd_txtinfo.so.1.1' diff --git a/olsrd/files/olsrd6.init b/olsrd/files/olsrd6.init index a20e96728..ed49b4b92 100644 --- a/olsrd/files/olsrd6.init +++ b/olsrd/files/olsrd6.init @@ -39,17 +39,20 @@ boot() start_service() { olsrd_generate_config $OLSRD - procd_open_instance - config_load olsrd6 local _respawn_threshold local _respawn_timeout local _respawn_retry + local _ignore config_get _respawn_threshold procd _respawn_threshold 3600 config_get _respawn_timeout procd respawn_timeout 15 config_get _respawn_retry procd respawn_retry 0 + config_get_bool _ignore olsrd ignore 0 + [ $_ignore -ne 0 ] && return + + procd_open_instance procd_set_param command "$BIN" procd_append_param command -f ${CONF} procd_append_param command -nofork