summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-01-24 17:43:35 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-02-13 21:55:18 +0100
commitbdc0caee9cf2dfa40f46d0e96f9c944463d77830 (patch)
treee804e8ac7f2537c73117b5c785da752254e96c0f /src/config.c
parent95507a57344431b890c12f3132a019f31d824b01 (diff)
socket: enable setting of fwmark
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 172287a..30c876e 100644
--- a/src/config.c
+++ b/src/config.c
@@ -125,6 +125,11 @@ int config_set_device(struct wireguard_device *wg, void __user *user_device)
goto out;
}
+ if (in_device.fwmark || (!in_device.fwmark && (in_device.flags & WGDEVICE_REMOVE_FWMARK))) {
+ wg->fwmark = in_device.fwmark;
+ peer_for_each_unlocked(wg, clear_peer_endpoint_src, NULL);
+ }
+
if (in_device.port) {
ret = set_device_port(wg, in_device.port);
if (ret)
@@ -287,6 +292,7 @@ int config_get_device(struct wireguard_device *wg, void __user *udevice)
}
out_device.port = wg->incoming_port;
+ out_device.fwmark = wg->fwmark;
strncpy(out_device.interface, dev->name, IFNAMSIZ - 1);
out_device.interface[IFNAMSIZ - 1] = 0;