Fix auto_redirect on IPv6-only or IPv4-only servers
This commit is contained in:
parent
381bf9d40d
commit
e88ed52dbc
1 changed files with 17 additions and 0 deletions
17
tun_linux.go
17
tun_linux.go
|
|
@ -630,6 +630,23 @@ func (t *NativeTun) rules() []*netlink.Rule {
|
|||
it.Family = unix.AF_INET6
|
||||
rules = append(rules, it)
|
||||
}
|
||||
// Fallback rules after system default rules (32766: main, 32767: default)
|
||||
// Only reached when main and default tables have no route
|
||||
const fallbackPriority = 32768
|
||||
if p4 {
|
||||
it = netlink.NewRule()
|
||||
it.Priority = fallbackPriority
|
||||
it.Table = t.options.IPRoute2TableIndex
|
||||
it.Family = unix.AF_INET
|
||||
rules = append(rules, it)
|
||||
}
|
||||
if p6 {
|
||||
it = netlink.NewRule()
|
||||
it.Priority = fallbackPriority
|
||||
it.Table = t.options.IPRoute2TableIndex
|
||||
it.Family = unix.AF_INET6
|
||||
rules = append(rules, it)
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue