From: Michael Tremer Date: Sun, 30 Jul 2017 13:14:58 +0000 (+0200) Subject: route: Move CLI functions into functions file X-Git-Tag: 009~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68e62beac51266ca8c221afa744113d87de2badc;p=network.git route: Move CLI functions into functions file Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.route b/src/functions/functions.route index 86328a0c..6a2c1fa5 100644 --- a/src/functions/functions.route +++ b/src/functions/functions.route @@ -22,6 +22,71 @@ # Functions for static routing. # +cli_route() { + if cli_help_requested $@; then + cli_show_man network-route + exit ${EXIT_OK} + fi + + local action=${1} + shift + + case "${action}" in + static) + cli_route_static $@ + ;; + *) + error "Unrecognized action: ${action}" + cli_run_help network route + + exit ${EXIT_ERROR} + ;; + esac + + exit ${EXIT_OK} +} + +cli_route_static() { + if cli_help_requested $@; then + cli_show_man network-route-static + exit ${EXIT_OK} + fi + + local action=${1} + shift + + case "${action}" in + # Add a new route. + add) + route_add $@ + ;; + # Remove an existing route. + remove) + route_remove $@ + ;; + # List all routes. + list) + route_list $@ + return ${EXIT_OK} + ;; + # Reload all routes + reload) + route_apply $@ + ;; + *) + error "Unrecognized action: ${action}" + cli_run_help network route + + exit ${EXIT_ERROR} + ;; + esac + + # Applying all routes. + route_apply + + exit ${EXIT_OK} +} + route_add() { local ${NETWORK_CONFIG_ROUTES_PARAMS} diff --git a/src/network b/src/network index 88c90b1f..65bfcdc6 100644 --- a/src/network +++ b/src/network @@ -761,73 +761,6 @@ cli_list_hooks() { done | sort -u } -cli_route() { - if cli_help_requested $@; then - cli_show_man network-route - exit ${EXIT_OK} - fi - - local action=${1} - shift - - case "${action}" in - static) - cli_route_static $@ - ;; - *) - error "Unrecognized action: ${action}" - cli_run_help network route - - exit ${EXIT_ERROR} - ;; - esac - - exit ${EXIT_OK} - - -} - -cli_route_static() { - if cli_help_requested $@; then - cli_show_man network-route-static - exit ${EXIT_OK} - fi - - local action=${1} - shift - - case "${action}" in - # Add a new route. - add) - route_add $@ - ;; - # Remove an existing route. - remove) - route_remove $@ - ;; - # List all routes. - list) - route_list $@ - return ${EXIT_OK} - ;; - # Reload all routes. - reload) - route_apply $@ - ;; - *) - error "Unrecognized action: ${action}" - cli_run_help network route - - exit ${EXIT_ERROR} - ;; - esac - - # Applying all routes. - route_apply - - exit ${EXIT_OK} -} - cli_dhcpd() { local proto=${1} shift