From: Michael Tremer Date: Wed, 15 Aug 2018 09:26:51 +0000 (+0100) Subject: Remove registration of functions called on init X-Git-Tag: 010~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02a397d387f2521304001c25439ce38a1673df62;p=network.git Remove registration of functions called on init Only one function used this and it was slow since it got initialised every time the functions were loaded. Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.dns b/src/functions/functions.dns index f9483eea..4cd5cb4c 100644 --- a/src/functions/functions.dns +++ b/src/functions/functions.dns @@ -238,9 +238,6 @@ dns_server_update() { radvd_update } -# Update resolv.conf(5) when initializing the network. -init_register dns_generate_resolvconf - dns_generate_resolvconf() { local file=${RESOLV_CONF} diff --git a/src/functions/functions.in b/src/functions/functions.in index 15e3531f..927d18d5 100644 --- a/src/functions/functions.in +++ b/src/functions/functions.in @@ -23,22 +23,6 @@ # PATH variable. export PATH="@utildir@:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin:/bin:${PATH}" -INIT_FUNCTIONS="" - -init_register() { - INIT_FUNCTIONS="${INIT_FUNCTIONS} $@" -} - -init_run() { - local init - for init in ${INIT_FUNCTIONS}; do - ${init} - done - - # Also execute all triggers - triggers_execute_all "init" -} - VERSION="@PACKAGE_VERSION@" NETWORK_VERSION="${VERSION}" diff --git a/src/network b/src/network index f26c0dc0..cc6a07ed 100644 --- a/src/network +++ b/src/network @@ -1181,9 +1181,6 @@ cli_reset() { # Flush all DNS servers. dns_server_flush - # Re-run the initialization functions - init_run - exit ${EXIT_OK} } @@ -1367,7 +1364,11 @@ cli_raw() { # Process the given action case "${action}" in init) - init_run + # Update resolv.conf(5) when initializing the network + dns_generate_resolvconf + + # Also execute all triggers + triggers_execute_all "init" ;; settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn|wireless)