mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-04 20:37:43 +03:00
Fix auto-route IPv6 on darwin
This commit is contained in:
parent
d275b4a0fd
commit
62f2d98190
1 changed files with 15 additions and 9 deletions
24
tun_rules.go
24
tun_rules.go
|
@ -111,14 +111,14 @@ func (o *Options) BuildAutoRouteRanges(underNetworkExtension bool) ([]netip.Pref
|
||||||
inet4Ranges = o.Inet4RouteAddress
|
inet4Ranges = o.Inet4RouteAddress
|
||||||
} else if autoRouteUseSubRanges && !underNetworkExtension {
|
} else if autoRouteUseSubRanges && !underNetworkExtension {
|
||||||
inet4Ranges = []netip.Prefix{
|
inet4Ranges = []netip.Prefix{
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{1, 0, 0, 0}), 8),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 1}), 8),
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{2, 0, 0, 0}), 7),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 2}), 7),
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{4, 0, 0, 0}), 6),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 4}), 6),
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{8, 0, 0, 0}), 5),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 8}), 5),
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{16, 0, 0, 0}), 4),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 16}), 4),
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{32, 0, 0, 0}), 3),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 32}), 3),
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{64, 0, 0, 0}), 2),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 64}), 2),
|
||||||
netip.PrefixFrom(netip.AddrFrom4([4]byte{128, 0, 0, 0}), 1),
|
netip.PrefixFrom(netip.AddrFrom4([4]byte{0: 128}), 1),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inet4Ranges = []netip.Prefix{netip.PrefixFrom(netip.IPv4Unspecified(), 0)}
|
inet4Ranges = []netip.Prefix{netip.PrefixFrom(netip.IPv4Unspecified(), 0)}
|
||||||
|
@ -146,7 +146,13 @@ func (o *Options) BuildAutoRouteRanges(underNetworkExtension bool) ([]netip.Pref
|
||||||
inet6Ranges = o.Inet6RouteAddress
|
inet6Ranges = o.Inet6RouteAddress
|
||||||
} else if autoRouteUseSubRanges && !underNetworkExtension {
|
} else if autoRouteUseSubRanges && !underNetworkExtension {
|
||||||
inet6Ranges = []netip.Prefix{
|
inet6Ranges = []netip.Prefix{
|
||||||
netip.PrefixFrom(netip.IPv6Unspecified(), 1),
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 1}), 8),
|
||||||
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 2}), 7),
|
||||||
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 4}), 6),
|
||||||
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 8}), 5),
|
||||||
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 16}), 4),
|
||||||
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 32}), 3),
|
||||||
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 64}), 2),
|
||||||
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 128}), 1),
|
netip.PrefixFrom(netip.AddrFrom16([16]byte{0: 128}), 1),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue