From d8f2cc87ee66958226157c5bb77464eee23156c2 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 25 Jan 2021 09:27:06 -0800 Subject: 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 --- device/uapi.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/device/uapi.go b/device/uapi.go index 69779de..196b359 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -202,22 +202,13 @@ func (device *Device) handleDeviceLine(key, value string) error { } case "fwmark": - // parse fwmark field - fwmark, err := func() (uint32, error) { - if value == "" { - return 0, nil - } - mark, err := strconv.ParseUint(value, 10, 32) - return uint32(mark), err - }() - + mark, err := strconv.ParseUint(value, 10, 32) if err != nil { return ipcErrorf(ipc.IpcErrorInvalid, "invalid fwmark: %w", err) } device.log.Debug.Println("UAPI: Updating fwmark") - - if err := device.BindSetMark(uint32(fwmark)); err != nil { + if err := device.BindSetMark(uint32(mark)); err != nil { return ipcErrorf(ipc.IpcErrorPortInUse, "failed to update fwmark: %w", err) } -- cgit v1.2.3