Fix IncludeInterface/ExcludeInterface priority
This commit is contained in:
parent
219c612399
commit
d89ab3f207
1 changed files with 14 additions and 5 deletions
19
tun_linux.go
19
tun_linux.go
|
|
@ -668,7 +668,7 @@ func (t *NativeTun) rules() []*netlink.Rule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(t.options.IncludeInterface) > 0 {
|
if len(t.options.IncludeInterface) > 0 {
|
||||||
matchPriority := priority + 2*len(t.options.IncludeInterface) + 1
|
matchPriority := priority + 2
|
||||||
for _, includeInterface := range t.options.IncludeInterface {
|
for _, includeInterface := range t.options.IncludeInterface {
|
||||||
if p4 {
|
if p4 {
|
||||||
it = netlink.NewRule()
|
it = netlink.NewRule()
|
||||||
|
|
@ -677,7 +677,6 @@ func (t *NativeTun) rules() []*netlink.Rule {
|
||||||
it.Goto = matchPriority
|
it.Goto = matchPriority
|
||||||
it.Family = unix.AF_INET
|
it.Family = unix.AF_INET
|
||||||
rules = append(rules, it)
|
rules = append(rules, it)
|
||||||
priority++
|
|
||||||
}
|
}
|
||||||
if p6 {
|
if p6 {
|
||||||
it = netlink.NewRule()
|
it = netlink.NewRule()
|
||||||
|
|
@ -686,9 +685,14 @@ func (t *NativeTun) rules() []*netlink.Rule {
|
||||||
it.Goto = matchPriority
|
it.Goto = matchPriority
|
||||||
it.Family = unix.AF_INET6
|
it.Family = unix.AF_INET6
|
||||||
rules = append(rules, it)
|
rules = append(rules, it)
|
||||||
priority6++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if p4 {
|
||||||
|
priority++
|
||||||
|
}
|
||||||
|
if p6 {
|
||||||
|
priority6++
|
||||||
|
}
|
||||||
if p4 {
|
if p4 {
|
||||||
it = netlink.NewRule()
|
it = netlink.NewRule()
|
||||||
it.Priority = priority
|
it.Priority = priority
|
||||||
|
|
@ -726,7 +730,6 @@ func (t *NativeTun) rules() []*netlink.Rule {
|
||||||
it.Goto = nopPriority
|
it.Goto = nopPriority
|
||||||
it.Family = unix.AF_INET
|
it.Family = unix.AF_INET
|
||||||
rules = append(rules, it)
|
rules = append(rules, it)
|
||||||
priority++
|
|
||||||
}
|
}
|
||||||
if p6 {
|
if p6 {
|
||||||
it = netlink.NewRule()
|
it = netlink.NewRule()
|
||||||
|
|
@ -735,9 +738,15 @@ func (t *NativeTun) rules() []*netlink.Rule {
|
||||||
it.Goto = nopPriority
|
it.Goto = nopPriority
|
||||||
it.Family = unix.AF_INET6
|
it.Family = unix.AF_INET6
|
||||||
rules = append(rules, it)
|
rules = append(rules, it)
|
||||||
priority6++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p4 {
|
||||||
|
priority++
|
||||||
|
}
|
||||||
|
if p6 {
|
||||||
|
priority6++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "android" && t.options.InterfaceMonitor.AndroidVPNEnabled() {
|
if runtime.GOOS == "android" && t.options.InterfaceMonitor.AndroidVPNEnabled() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue