Interleaves IpcSetOperations would spell trouble.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
isUp AtomicBool // device is (going) up
isClosed AtomicBool // device is closed? (acting as guard)
log *Logger
+ ipcSetMu sync.Mutex // serializes UAPI set operations
// synchronized resources (locks acquired in order)
// IpcSetOperation implements the WireGuard configuration protocol "set" operation.
// See https://www.wireguard.com/xplatform/#configuration-protocol for details.
func (device *Device) IpcSetOperation(r io.Reader) (err error) {
+ device.ipcSetMu.Lock()
+ defer device.ipcSetMu.Unlock()
+
defer func() {
if err != nil {
device.log.Error.Println(err)