@ -73,7 +73,7 @@ type linuxRouter struct {
magicsockPortV6 uint16
}
func newUserspaceRouter ( logf logger . Logf , tunDev tun . Device , netMon * netmon . Monitor , health * health . Tracker ) ( Router , error ) {
func newUserspaceRouter ( logf logger . Logf , tunDev tun . Device , netMon * netmon . Monitor , ipPolicyPrefBase int , health * health . Tracker ) ( Router , error ) {
tunname , err := tunDev . Name ( )
if err != nil {
return nil , err
@ -83,10 +83,10 @@ func newUserspaceRouter(logf logger.Logf, tunDev tun.Device, netMon *netmon.Moni
ambientCapNetAdmin : useAmbientCaps ( ) ,
}
return newUserspaceRouterAdvanced ( logf , tunname , netMon , cmd , health)
return newUserspaceRouterAdvanced ( logf , tunname , netMon , cmd , ipPolicyPrefBase, health)
}
func newUserspaceRouterAdvanced ( logf logger . Logf , tunname string , netMon * netmon . Monitor , cmd commandRunner , health * health . Tracker ) ( Router , error ) {
func newUserspaceRouterAdvanced ( logf logger . Logf , tunname string , netMon * netmon . Monitor , cmd commandRunner , ipPolicyPrefBase int , health * health . Tracker ) ( Router , error ) {
r := & linuxRouter {
logf : logf ,
tunname : tunname ,
@ -99,6 +99,12 @@ func newUserspaceRouterAdvanced(logf logger.Logf, tunname string, netMon *netmon
ipRuleFixLimiter : rate . NewLimiter ( rate . Every ( 5 * time . Second ) , 10 ) ,
ipPolicyPrefBase : 5200 ,
}
if ipPolicyPrefBase > 0 {
r . logf ( "ip-rule-pref-base manually set, switching policy base priority to %d" , ipPolicyPrefBase )
r . ipPolicyPrefBase = ipPolicyPrefBase
}
if r . useIPCommand ( ) {
r . ipRuleAvailable = ( cmd . run ( "ip" , "rule" ) == nil )
} else {
@ -129,7 +135,7 @@ func newUserspaceRouterAdvanced(logf logger.Logf, tunname string, netMon *netmon
isMWAN3 , err := checkOpenWRTUsingMWAN3 ( )
if err != nil {
r . logf ( "error checking mwan3 installation: %v" , err )
} else if isMWAN3 {
} else if isMWAN3 && ipPolicyPrefBase <= 0 {
r . ipPolicyPrefBase = 1300
r . logf ( "mwan3 on openWRT detected, switching policy base priority to 1300" )
}