device: remove close processing fwmark
Also, a behavior change: Stop treating a blank value as 0. It's not in the spec. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
2b8665f5f9
commit
d8f2cc87ee
|
@ -202,22 +202,13 @@ func (device *Device) handleDeviceLine(key, value string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "fwmark":
|
case "fwmark":
|
||||||
// parse fwmark field
|
|
||||||
fwmark, err := func() (uint32, error) {
|
|
||||||
if value == "" {
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
mark, err := strconv.ParseUint(value, 10, 32)
|
mark, err := strconv.ParseUint(value, 10, 32)
|
||||||
return uint32(mark), err
|
|
||||||
}()
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ipcErrorf(ipc.IpcErrorInvalid, "invalid fwmark: %w", err)
|
return ipcErrorf(ipc.IpcErrorInvalid, "invalid fwmark: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
device.log.Debug.Println("UAPI: Updating fwmark")
|
device.log.Debug.Println("UAPI: Updating fwmark")
|
||||||
|
if err := device.BindSetMark(uint32(mark)); err != nil {
|
||||||
if err := device.BindSetMark(uint32(fwmark)); err != nil {
|
|
||||||
return ipcErrorf(ipc.IpcErrorPortInUse, "failed to update fwmark: %w", err)
|
return ipcErrorf(ipc.IpcErrorPortInUse, "failed to update fwmark: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue