mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-05-24 10:58:15 +08:00
fix: some default value in dialer not restore in tun when config reload
This commit is contained in:
parent
4bd3ae52bd
commit
c0de3c0e42
@ -512,6 +512,9 @@ func ReCreateTun(tunConf LC.Tun, tunnel C.Tunnel) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
if tunConf.Equal(LastTunConf) {
|
if tunConf.Equal(LastTunConf) {
|
||||||
|
if tunLister != nil { // some default value in dialer maybe changed when config reload, reset at here
|
||||||
|
tunLister.OnReload()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ func New(options LC.Tun, tunnel C.Tunnel, additions ...inbound.Addition) (l *Lis
|
|||||||
defaultInterfaceMonitor: defaultInterfaceMonitor,
|
defaultInterfaceMonitor: defaultInterfaceMonitor,
|
||||||
}
|
}
|
||||||
if !dialer.DefaultInterfaceFinder.CompareAndSwap(nil, l.cDialerInterfaceFinder) {
|
if !dialer.DefaultInterfaceFinder.CompareAndSwap(nil, l.cDialerInterfaceFinder) {
|
||||||
err = E.New("don't allowed two tun listener using auto-detect-interface")
|
err = E.New("not allowed two tun listener using auto-detect-interface")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -450,7 +450,10 @@ func New(options LC.Tun, tunnel C.Tunnel, additions ...inbound.Addition) (l *Lis
|
|||||||
}
|
}
|
||||||
if tunOptions.AutoRedirectMarkMode {
|
if tunOptions.AutoRedirectMarkMode {
|
||||||
l.autoRedirectOutputMark = int32(outputMark)
|
l.autoRedirectOutputMark = int32(outputMark)
|
||||||
dialer.DefaultRoutingMark.Store(l.autoRedirectOutputMark)
|
if !dialer.DefaultRoutingMark.CompareAndSwap(0, l.autoRedirectOutputMark) {
|
||||||
|
err = E.New("not allowed setting global routing-mark when working with autoRedirectMarkMode")
|
||||||
|
return
|
||||||
|
}
|
||||||
l.autoRedirect.UpdateRouteAddressSet()
|
l.autoRedirect.UpdateRouteAddressSet()
|
||||||
l.ruleUpdateCallbackCloser = rpTunnel.RuleUpdateCallback().Register(l.ruleUpdateCallback)
|
l.ruleUpdateCallbackCloser = rpTunnel.RuleUpdateCallback().Register(l.ruleUpdateCallback)
|
||||||
}
|
}
|
||||||
@ -517,6 +520,15 @@ func (l *Listener) updateRule(ruleProvider provider.RuleProvider, exclude bool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *Listener) OnReload() {
|
||||||
|
if l.autoRedirectOutputMark != 0 {
|
||||||
|
dialer.DefaultRoutingMark.CompareAndSwap(0, l.autoRedirectOutputMark)
|
||||||
|
}
|
||||||
|
if l.cDialerInterfaceFinder != nil {
|
||||||
|
dialer.DefaultInterfaceFinder.CompareAndSwap(nil, l.cDialerInterfaceFinder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type cDialerInterfaceFinder struct {
|
type cDialerInterfaceFinder struct {
|
||||||
tunName string
|
tunName string
|
||||||
defaultInterfaceMonitor tun.DefaultInterfaceMonitor
|
defaultInterfaceMonitor tun.DefaultInterfaceMonitor
|
||||||
|
Loading…
Reference in New Issue
Block a user