mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-08-07 06:15:15 +03:00
dns: Fix search domain expansion
DHCP option 119/15 and resolved link domains are not rooted, so appending them to the query name produced a non-FQDN name, failing to pack with "domain must be fully qualified".
This commit is contained in:
@@ -296,9 +296,14 @@ func (t *Transport) fetchServersResponse(iface *control.Interface, packetConn ne
|
||||
func (t *Transport) recreateServers(iface *control.Interface, dhcpPacket *dhcpv4.DHCPv4) error {
|
||||
searchList := dhcpPacket.DomainSearch()
|
||||
if searchList != nil && len(searchList.Labels) > 0 {
|
||||
t.search = searchList.Labels
|
||||
t.search = common.Filter(common.Map(searchList.Labels, mDNS.Fqdn), func(it string) bool {
|
||||
return it != "."
|
||||
})
|
||||
} else if dhcpPacket.DomainName() != "" {
|
||||
t.search = []string{dhcpPacket.DomainName()}
|
||||
domainName := mDNS.Fqdn(dhcpPacket.DomainName())
|
||||
if domainName != "." {
|
||||
t.search = []string{domainName}
|
||||
}
|
||||
}
|
||||
serverAddrs := common.Map(dhcpPacket.DNS(), func(it net.IP) M.Socksaddr {
|
||||
return M.SocksaddrFrom(M.AddrFromIP(it), 53)
|
||||
|
||||
@@ -204,10 +204,12 @@ func (i *Service) onNetworkUpdate() {
|
||||
}
|
||||
|
||||
func (conf *TransportLink) nameList(ndots int, name string) []string {
|
||||
search := common.Map(common.Filter(conf.domain, func(it LinkDomain) bool {
|
||||
search := common.Filter(common.Map(common.Filter(conf.domain, func(it LinkDomain) bool {
|
||||
return !it.RoutingOnly
|
||||
}), func(it LinkDomain) string {
|
||||
return it.Domain
|
||||
return mDNS.Fqdn(it.Domain)
|
||||
}), func(it string) bool {
|
||||
return it != "."
|
||||
})
|
||||
|
||||
l := len(name)
|
||||
|
||||
Reference in New Issue
Block a user