route: add new cli command reload

Submitted by Jonatan Schlag on June 4, 2017, 2:09 p.m.

Details

Message ID 1496585347-4063-1-git-send-email-jonatan.schlag@ipfire.org
State New
Headers show

Commit Message

Jonatan Schlag June 4, 2017, 2:09 p.m.
This new command just call route_apply.
It provide a nice way to take changes of the config file into affect.
Also it helps when the routes are not applied.
This should not happen, but when this command is better then network restart.

Fixes: 11367

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/bash-completion/network | 2 +-
 src/network                 | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/bash-completion/network b/src/bash-completion/network
index 6f63f1b..27272e9 100644
--- a/src/bash-completion/network
+++ b/src/bash-completion/network
@@ -258,7 +258,7 @@  _network_port_subcommand() {
 _network_route() {
 	local words=( $@ )
 
-	local commands="add list remove"
+	local commands="add list remove reload"
 	local cmd="$(_network_find_on_cmdline "${commands}")"
 	if [[ -z "${cmd}" ]]; then
 		COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") )
diff --git a/src/network b/src/network
index e65eb6b..fbb7e9a 100644
--- a/src/network
+++ b/src/network
@@ -765,6 +765,10 @@  cli_route() {
 			route_list $@
 			return ${EXIT_OK}
 			;;
+		# Reload all routes.
+		reload)
+			route_apply $@
+			;;
 		*)
 			error "Unrecognized action: ${action}"
 			cli_run_help network route