]> git.ipfire.org Git - people/ms/network.git/commitdiff
route: Move CLI functions into functions file
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Jul 2017 13:14:58 +0000 (15:14 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 30 Jul 2017 13:14:58 +0000 (15:14 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.route
src/network

index 86328a0c01db8c34db9665a768461ad1bd4e0a90..6a2c1fa5a695366e84cae4a513d9ca29ced00ee4 100644 (file)
 # 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}
 
index 88c90b1f57cfc67676a5918f3ef05a26d65d39f8..65bfcdc608abc1af7b26bf14f86d2e090f19e82c 100644 (file)
@@ -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