aboutsummaryrefslogtreecommitdiffstats
path: root/src/uapi.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-01-26 22:52:32 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-01-26 22:52:32 +0100
commitf73d2fb2d96bc3fbc8bc4cce452e3c19689de01e (patch)
tree52e392cf6313e7e9e5e87539fcb5e88817e47f37 /src/uapi.go
parentFixed potential DoS issue (diff)
downloadwireguard-go-f73d2fb2d96bc3fbc8bc4cce452e3c19689de01e.tar.xz
wireguard-go-f73d2fb2d96bc3fbc8bc4cce452e3c19689de01e.zip
Added initial version of peer teardown
There is a double lock issue with device.Close which has yet to be resolved.
Diffstat (limited to '')
-rw-r--r--src/uapi.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/uapi.go b/src/uapi.go
index f66528c..68ebe43 100644
--- a/src/uapi.go
+++ b/src/uapi.go
@@ -144,16 +144,11 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
// update port and rebind
- device.mutex.Lock()
device.net.mutex.Lock()
-
device.net.port = uint16(port)
- err = unsafeUpdateBind(device)
-
device.net.mutex.Unlock()
- device.mutex.Unlock()
- if err != nil {
+ if err := device.BindUpdate(); err != nil {
logError.Println("Failed to set listen_port:", err)
return &IPCError{Code: ipcErrorPortInUse}
}
@@ -179,6 +174,11 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
device.net.fwmark = uint32(fwmark)
device.net.mutex.Unlock()
+ if err := device.BindUpdate(); err != nil {
+ logError.Println("Failed to update fwmark:", err)
+ return &IPCError{Code: ipcErrorPortInUse}
+ }
+
case "public_key":
// switch to peer configuration
deviceConfig = false