Development discussion of WireGuard
 help / color / mirror / Atom feed
* [PATCH] wg-quick: linux: add restart command.
@ 2023-08-16  5:06 Henrik Hautakoski
  2023-08-16 22:29 ` Roman Mamedov
  0 siblings, 1 reply; 3+ messages in thread
From: Henrik Hautakoski @ 2023-08-16  5:06 UTC (permalink / raw)
  To: wireguard; +Cc: Henrik Hautakoski

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@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
 elif [[ $# -eq 2 && $1 == save ]]; then
 	auto_su
 	parse_options "$2"
-- 
2.40.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wg-quick: linux: add restart command.
  2023-08-16  5:06 [PATCH] wg-quick: linux: add restart command Henrik Hautakoski
@ 2023-08-16 22:29 ` Roman Mamedov
  2023-08-17  1:52   ` [PATCH v1] " Henrik Hautakoski
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Mamedov @ 2023-08-16 22:29 UTC (permalink / raw)
  To: Henrik Hautakoski; +Cc: wireguard

On Wed, 16 Aug 2023 07:06:53 +0200
Henrik Hautakoski <henrik@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@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1] wg-quick: linux: add restart command.
  2023-08-16 22:29 ` Roman Mamedov
@ 2023-08-17  1:52   ` Henrik Hautakoski
  0 siblings, 0 replies; 3+ messages in thread
From: Henrik Hautakoski @ 2023-08-17  1:52 UTC (permalink / raw)
  To: wireguard; +Cc: rm

---
v1: indent fix.

 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..4300268 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
 elif [[ $# -eq 2 && $1 == save ]]; then
 	auto_su
 	parse_options "$2"
-- 
2.41.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-17  1:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16  5:06 [PATCH] wg-quick: linux: add restart command Henrik Hautakoski
2023-08-16 22:29 ` Roman Mamedov
2023-08-17  1:52   ` [PATCH v1] " Henrik Hautakoski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).