From: Garrit Franke <contact@garrit.xyz>
To: wireguard@lists.zx2c4.com
Cc: Garrit Franke <contact@garrit.xyz>
Subject: [PATCH 6/6] wg-quick: darwin: add restart command
Date: Thu, 28 May 2020 20:45:10 +0200 [thread overview]
Message-ID: <20200528184510.51675-7-contact@garrit.xyz> (raw)
In-Reply-To: <20200528184510.51675-1-contact@garrit.xyz>
---
src/wg-quick/darwin.bash | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash
index cde1b54..1d32fbe 100755
--- a/src/wg-quick/darwin.bash
+++ b/src/wg-quick/darwin.bash
@@ -418,7 +418,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
@@ -478,6 +478,14 @@ cmd_down() {
execute_hooks "${POST_DOWN[@]}"
}
+cmd_restart() {
+ if ! get_real_interface || [[ " $(wg show interfaces) " != *" $REAL_INTERFACE "* ]]; then
+ die "\`$INTERFACE' is not a WireGuard interface"
+ fi
+ cmd_down
+ cmd_up
+}
+
cmd_save() {
if ! get_real_interface || [[ " $(wg show interfaces) " != *" $REAL_INTERFACE "* ]]; then
die "\`$INTERFACE' is not a WireGuard interface"
@@ -502,6 +510,10 @@ 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_restart
elif [[ $# -eq 2 && $1 == save ]]; then
auto_su
parse_options "$2"
--
2.24.3 (Apple Git-128)
next prev parent reply other threads:[~2020-06-17 7:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 18:45 [PATCH] wg-quick: " Garrit Franke
2020-05-28 18:45 ` [PATCH 1/6] wg-quick: linux: " Garrit Franke
2020-05-28 18:45 ` [PATCH 2/6] wg-quick: add restart man page Garrit Franke
2020-05-28 18:45 ` [PATCH 3/6] wg-quick: freebsd: add restart command Garrit Franke
2020-05-28 18:45 ` [PATCH 4/6] wg-quick: linux: add notice to " Garrit Franke
2020-05-28 18:45 ` [PATCH 5/6] wg-quick: openbsd: add " Garrit Franke
2020-05-28 18:45 ` Garrit Franke [this message]
2020-06-17 7:47 ` [PATCH] wg-quick: " Jason A. Donenfeld
2020-06-17 8:16 ` Eric Light
2020-06-17 8:18 ` Eric Light
2020-06-17 8:19 ` Jason A. Donenfeld
2020-06-17 8:30 ` Eric Light
2020-06-17 12:25 ` Garrit Franke
2020-06-20 7:02 ` Tore Anderson
[not found] ` <CAD16O87AEvaP3Y0TKPvrps=MVdzw-34+=rBOmF_c7s=Eu9kSQw@mail.gmail.com>
2020-06-21 10:36 ` Tore Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200528184510.51675-7-contact@garrit.xyz \
--to=contact@garrit.xyz \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).