Trick for being extra sensitive to route changes
This commit is contained in:
parent
bbf320c477
commit
4365b4583f
@ -63,6 +63,7 @@ type NativeBind struct {
|
|||||||
netlinkSock int
|
netlinkSock int
|
||||||
netlinkCancel *rwcancel.RWCancel
|
netlinkCancel *rwcancel.RWCancel
|
||||||
lastMark uint32
|
lastMark uint32
|
||||||
|
clearSourceOnAllRouteChanges bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Endpoint = (*NativeEndpoint)(nil)
|
var _ Endpoint = (*NativeEndpoint)(nil)
|
||||||
@ -582,6 +583,16 @@ func (bind *NativeBind) routineRouteListener(device *Device) {
|
|||||||
|
|
||||||
switch hdr.Type {
|
switch hdr.Type {
|
||||||
case unix.RTM_NEWROUTE, unix.RTM_DELROUTE:
|
case unix.RTM_NEWROUTE, unix.RTM_DELROUTE:
|
||||||
|
if bind.clearSourceOnAllRouteChanges {
|
||||||
|
for _, peer := range device.peers.keyMap {
|
||||||
|
peer.mutex.Lock()
|
||||||
|
if peer.endpoint != nil && peer.endpoint.(*NativeEndpoint) != nil {
|
||||||
|
peer.endpoint.(*NativeEndpoint).ClearSrc()
|
||||||
|
}
|
||||||
|
peer.mutex.Unlock()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
if hdr.Seq <= MaxPeers && hdr.Seq > 0 {
|
if hdr.Seq <= MaxPeers && hdr.Seq > 0 {
|
||||||
if uint(len(remain)) < uint(hdr.Len) {
|
if uint(len(remain)) < uint(hdr.Len) {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user