Fix IPv6 ULA addresses excluded from local address set

The filter condition `IsGlobalUnicast() && !IsPrivate()` incorrectly
excluded ULA addresses (fc00::/7) from inet6_local_address_set,
causing DNS hijack to fail for IPv6 ULA addresses.

Fixes: sagernet/sing-box#3698
This commit is contained in:
世界 2026-01-17 20:42:31 +08:00
parent a23b66f721
commit 2377e62d4a
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -103,10 +103,6 @@ func (r *autoRedirect) nftablesCreateLocalAddressSets(
update = true
}
}
localAddresses6 = common.Filter(localAddresses6, func(it netip.Prefix) bool {
address := it.Addr()
return address.IsLoopback() || address.IsGlobalUnicast() && !address.IsPrivate()
})
if len(lastAddresses) == 0 || update {
_, err := nftablesCreateIPSet(nft, table, 6, "inet6_local_address_set", nftables.TableFamilyIPv6, nil, localAddresses6, false, update)
if err != nil {