diff options
Diffstat (limited to 'src/uapi.go')
-rw-r--r-- | src/uapi.go | 12 |
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 |