[PATCH] wg-quick: linux: add restart command.

Roman Mamedov rm at romanrm.net
Wed Aug 16 22:29:02 UTC 2023


On Wed, 16 Aug 2023 07:06:53 +0200
Henrik Hautakoski <henrik at eossweden.org> wrote:

> Add a simple "restart" command that just do cmd_down followed by an cmd_up. Saves abit of typing :)
> 
> Signed-off-by: Henrik Hautakoski <henrik at eossweden.org>
> ---
>  src/wg-quick/linux.bash | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash
> index 69e5bef..cc9f288 100755
> --- a/src/wg-quick/linux.bash
> +++ b/src/wg-quick/linux.bash
> @@ -298,7 +298,7 @@ execute_hooks() {
>  
>  cmd_usage() {
>  	cat >&2 <<-_EOF
> -	Usage: $PROGRAM [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
> +	Usage: $PROGRAM [ up | down | restart | save | strip ] [ CONFIG_FILE | INTERFACE ]
>  
>  	  CONFIG_FILE is a configuration file, whose filename is the interface name
>  	  followed by \`.conf'. Otherwise, INTERFACE is an interface name, with
> @@ -373,6 +373,11 @@ elif [[ $# -eq 2 && $1 == down ]]; then
>  	auto_su
>  	parse_options "$2"
>  	cmd_down
> +elif [[ $# -eq 2 && $1 == restart ]]; then
> +	auto_su
> +	parse_options "$2"
> +	cmd_down
> +    cmd_up

cmd_down and the lines prior use a TAB to indent, but cmd_up uses 4 spaces
instead.

-- 
With respect,
Roman


More information about the WireGuard mailing list