Skip to content

Commit

Permalink
Remove bad suppress_prefixlength iproute2 rule
Browse files Browse the repository at this point in the history
This change gives tun priority over DHCP 121 rules
  • Loading branch information
nekohasekai committed May 7, 2024
1 parent 5584917 commit e272ff0
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions tun_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ func (t *NativeTun) rules() []*netlink.Rule {
it.Family = unix.AF_INET6
rules = append(rules, it)
}*/
if p4 {
if p4 && !t.options.StrictRoute {
it = netlink.NewRule()
it.Priority = priority
it.IPProto = syscall.IPPROTO_ICMP
Expand All @@ -590,7 +590,7 @@ func (t *NativeTun) rules() []*netlink.Rule {
rules = append(rules, it)
priority++
}
if p6 {
if p6 && !t.options.StrictRoute {
it = netlink.NewRule()
it.Priority = priority6
it.IPProto = syscall.IPPROTO_ICMPV6
Expand All @@ -599,26 +599,6 @@ func (t *NativeTun) rules() []*netlink.Rule {
rules = append(rules, it)
priority6++
}
if p4 {
it = netlink.NewRule()
it.Priority = priority
it.Invert = true
it.Dport = netlink.NewRulePortRange(53, 53)
it.Table = unix.RT_TABLE_MAIN
it.SuppressPrefixlen = 0
it.Family = unix.AF_INET
rules = append(rules, it)
}
if p6 {
it = netlink.NewRule()
it.Priority = priority6
it.Invert = true
it.Dport = netlink.NewRulePortRange(53, 53)
it.Table = unix.RT_TABLE_MAIN
it.SuppressPrefixlen = 0
it.Family = unix.AF_INET6
rules = append(rules, it)
}
}

if p4 {
Expand Down

0 comments on commit e272ff0

Please sign in to comment.