diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-11-17 17:25:45 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-11-17 17:25:58 +0100 |
commit | fa399a91d5da9874cbf248e00db8dbd87b587e91 (patch) | |
tree | 8aaca42f4a3cc11666c12d5077e8ed5ac35200a8 /src/uapi.go | |
parent | e1227d3af480eae72639cde842b4d538c58936dc (diff) |
Ported remaining netns.sh
- Ported remaining netns.sh tests
- Begin work on generic implementation of bind interface
Diffstat (limited to 'src/uapi.go')
-rw-r--r-- | src/uapi.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/uapi.go b/src/uapi.go index 5e40939..e1d0929 100644 --- a/src/uapi.go +++ b/src/uapi.go @@ -145,11 +145,22 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError { } case "fwmark": - fwmark, err := strconv.ParseUint(value, 10, 32) + + // parse fwmark field + + fwmark, err := func() (uint32, error) { + if value == "" { + return 0, nil + } + mark, err := strconv.ParseUint(value, 10, 32) + return uint32(mark), err + }() + if err != nil { logError.Println("Invalid fwmark", err) return &IPCError{Code: ipcErrorInvalid} } + device.net.mutex.Lock() device.net.fwmark = uint32(fwmark) device.net.mutex.Unlock() |