summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-04-11 01:26:03 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2019-04-11 01:26:03 +0200
commit8581301ab55f5e087b1c5669850009f8efc1e9b1 (patch)
tree0806a7c6f7eedf1d554b13346635d49648012178
parent76b5f69da201102d6b0d0cb29a6fef842670c1ba (diff)
Wireguard: fixes
-rw-r--r--proto/wireguard/wireguard.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c
index bea7e33f..a998f014 100644
--- a/proto/wireguard/wireguard.c
+++ b/proto/wireguard/wireguard.c
@@ -210,7 +210,7 @@ user_put_device(wg_device *dev, byte **buf, uint *size)
}
wg_puts("\n", buf, size);
- if (size > 0)
+ if (*size > 0)
return 0;
else
return -1;
@@ -280,7 +280,7 @@ int get_device(struct wg_proto *p, wg_device **pdev, const char *device_name)
wg_key_from_base64(dev->private_key, c->private_key);
wg_generate_public_key(dev->public_key, dev->private_key);
}
- if (dev->listen_port)
+ if (c->listen_port)
dev->flags |= WGDEVICE_HAS_LISTEN_PORT;
dev->listen_port = c->listen_port;
debug("listen port %d\n", c->listen_port);
@@ -371,6 +371,14 @@ wg_if_notify(struct proto *P, unsigned flags, struct iface *i)
debug("WG: found ifname\n");
p->iface = i;
}
+
+ if (flags & IF_CHANGE_UP)
+ {
+ debug("WG: IF_CHANGE_UP %s\n", i->name);
+
+ int res = set_device(p);
+ log(L_TRACE "WG: wg_set_device %d", res);
+ }
}
static void
@@ -957,6 +965,8 @@ wg_shutdown(struct proto *P)
int res = set_device(p);
log(L_TRACE "WG: flush wg_set_device %d", res);
}
+
+ return PS_DOWN;
}
static void