]> git.ipfire.org Git - network.git/blobdiff - network
Add commands to manage static routes.
[network.git] / network
diff --git a/network b/network
index c22b23f84fb9075c261e3a07abd939c465f43dbd..a393d357d233589e956e6435fa4d38389958b61f 100755 (executable)
--- a/network
+++ b/network
@@ -558,6 +558,39 @@ function cli_list_hooks() {
        done | sort -u
 }
 
+function cli_route() {
+       if cli_help_requested $@; then
+               cli_show_man network-route
+               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 $@
+                       ;;
+               *)
+                       error "Unrecognized action: ${action}"
+                       cli_run_help network route
+
+                       exit ${EXIT_ERROR}
+                       ;;
+       esac
+
+       exit ${EXIT_OK}
+}
+
 function cli_start() {
        if cli_help_requested $@; then
                cli_show_man network
@@ -752,7 +785,7 @@ case "${action}" in
                init_run
                ;;
 
-       config|hostname|port|device|zone|start|stop|restart|status|reset|dns)
+       config|hostname|port|device|zone|start|stop|restart|status|reset|dns|route)
                cli_${action} $@
                ;;