aboutsummaryrefslogtreecommitdiff
path: root/src/uapi.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-01 11:20:36 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-01 11:20:36 +0100
commit1e42b1402261d15b87b1b5871f7bc51342b46e34 (patch)
treeaef0aef2eadf6ae7142486069405f45b84d59b58 /src/uapi.go
parenta57c790e36439729a6af7e53ee9068898f3ac992 (diff)
parentf73d2fb2d96bc3fbc8bc4cce452e3c19689de01e (diff)
downloadwireguard-go-1e42b1402261d15b87b1b5871f7bc51342b46e34.tar.gz
wireguard-go-1e42b1402261d15b87b1b5871f7bc51342b46e34.zip
Merge branch 'timer-teardown' of git.zx2c4.com:wireguard-go into timer-teardown
Diffstat (limited to 'src/uapi.go')
-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