mirror of
https://git.zx2c4.com/wireguard-go
synced 2026-05-18 08:21:27 +00:00
Added initial version of peer teardown
There is a double lock issue with device.Close which has yet to be resolved.
This commit is contained in:
12
src/uapi.go
12
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
|
||||
|
||||
Reference in New Issue
Block a user