summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-01-09 17:26:18 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-01-09 17:26:18 +0100
commit5f01086f1955c50696040aeeccd0c0b18bede8fe (patch)
tree4e2ee1ee3cbc8ab472ffbed07acdf5fb28a1c8a8 /src
parent9360bac63290d7869c07c0d1ba40f3f34fd39b83 (diff)
Fixed fwmark update without device status change
An update of the fwmark was missing, when the device was not bought up after the change.
Diffstat (limited to 'src')
-rw-r--r--src/tun.go8
-rw-r--r--src/uapi.go3
2 files changed, 9 insertions, 2 deletions
diff --git a/src/tun.go b/src/tun.go
index 54253b4..394ba9a 100644
--- a/src/tun.go
+++ b/src/tun.go
@@ -50,7 +50,9 @@ func (device *Device) RoutineTUNEventReader() {
// begin listening for incomming datagrams
logInfo.Println("Interface set up")
device.tun.isUp.Set(true)
- updateBind(device)
+ if err := updateBind(device); err != nil {
+ logInfo.Println("Failed to bind UDP socket:", err)
+ }
}
}
@@ -59,7 +61,9 @@ func (device *Device) RoutineTUNEventReader() {
// stop listening for incomming datagrams
logInfo.Println("Interface set down")
device.tun.isUp.Set(false)
- closeBind(device)
+ if err := closeBind(device); err != nil {
+ logInfo.Println("Failed to close UDP socket:", err)
+ }
}
}
}
diff --git a/src/uapi.go b/src/uapi.go
index 155f483..673d413 100644
--- a/src/uapi.go
+++ b/src/uapi.go
@@ -163,6 +163,9 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
device.net.mutex.Lock()
device.net.fwmark = uint32(fwmark)
+ if err := device.net.bind.SetMark(fwmark); err != nil {
+ logError.Println("Failed to update fwmark:", err)
+ }
device.net.mutex.Unlock()
case "public_key":