wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: wireguard@lists.zx2c4.com
Cc: Michael Tokarev <mjt@tls.msk.ru>
Subject: [PATCH 2/2] recognize and ignore commands used by wg-quick
Date: Mon, 18 Jan 2021 13:08:02 +0300	[thread overview]
Message-ID: <20210118100802.8568-3-mjt@msgid.tls.msk.ru> (raw)
In-Reply-To: <20210118100802.8568-1-mjt@tls.msk.ru>

When reading the config file, recognize and ignore commands in the [Interface] section
which are used by wg-qukck. This way wg-quick config file can be read by wg too directly
so there's no need to filter it out by wg-quick and it's easy to reload configuration too.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
 src/config.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/config.c b/src/config.c
index b4280e5..0095556 100644
--- a/src/config.c
+++ b/src/config.c
@@ -460,6 +460,10 @@ static bool process_line(struct config_ctx *ctx, const char *line)
 			ret = parse_key_or_file(ctx->device->private_key, value);
 			if (ret)
 				ctx->device->flags |= WGDEVICE_HAS_PRIVATE_KEY;
+		} else if (key_match("Address") || key_match("DNS") || key_match("MTU") || key_match("Table") ||
+		           key_match("PreUp") || key_match("PostUp") || key_match("PreDown") || key_match("PostDown") ||
+		           key_match("SaveConfig")) {
+			/* ignore commands used by wg-quick */
 		} else
 			goto error;
 	} else if (ctx->is_peer_section) {

      parent reply	other threads:[~2021-01-21 13:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210118100802.8568-1-mjt@tls.msk.ru>
2021-01-18 10:08 ` [PATCH 1/2] allow PrivateKey and PresharedKey to be files too Michael Tokarev
2021-01-18 10:08 ` Michael Tokarev [this message]

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210118100802.8568-3-mjt@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=wireguard@lists.zx2c4.com \


* 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).