fixed cname resolution
This commit is contained in:
@@ -197,11 +197,15 @@ func (netboxdns *NetboxDNS) lookupDirect(
|
|||||||
zone *netbox.Zone,
|
zone *netbox.Zone,
|
||||||
family int,
|
family int,
|
||||||
) (*lookupResponse, error) {
|
) (*lookupResponse, error) {
|
||||||
|
queryTypes := []string{dns.TypeToString[qtype]}
|
||||||
|
if qtype == dns.TypeA || qtype == dns.TypeAAAA {
|
||||||
|
queryTypes = append(queryTypes, "CNAME")
|
||||||
|
}
|
||||||
records, err := netbox.GetRecordsQuery(
|
records, err := netbox.GetRecordsQuery(
|
||||||
netboxdns.requestClient,
|
netboxdns.requestClient,
|
||||||
&netbox.RecordQuery{
|
&netbox.RecordQuery{
|
||||||
FQDN: qname,
|
FQDN: qname,
|
||||||
Type: []string{dns.TypeToString[qtype]},
|
Type: queryTypes,
|
||||||
Zone: zone,
|
Zone: zone,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -222,7 +226,8 @@ func (netboxdns *NetboxDNS) lookupDirect(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if qtype == dns.TypeCNAME {
|
cnames := filterRRByType(answer, dns.TypeCNAME)
|
||||||
|
if qtype == dns.TypeCNAME || len(cnames) > 0 {
|
||||||
answer = append(answer, extra...)
|
answer = append(answer, extra...)
|
||||||
extra = nil
|
extra = nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user