Consul doesn't support IPv6 during CNAME resolution (AAAA records not used)
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Overview of the Issue
If a service registered with name (not IP address) and this name resolves to IPv4 record consul correctly does recursive resolution and returns name with valid response. But if the name resolves to an IPv6 record it doesn't work (return only CNAME).
Currently type of records (A) is hardcoded here: https://github.com/hashicorp/consul/blob/main/agent/dns.go#L2141
#### Reproduction Steps
Register service with name that resolves to IPv4 address, it works:
```
> dig -t A test.service.consul
;; ANSWER SECTION:
test.service.consul. 30 IN CNAME ipv4.site.
ipv4.site. 30 IN A 127.0.0.1
```
Regiter service with name that resolves to IPv6 address, it doesn't:
```
> dig -t AAAA test.service.consul
;; ANSWER SECTION:
test.service.consul. 28 IN CNAME ipv6.site.
```
Contributor guide
Research direction
Start in agent/dns.go around line 2141, where the issue identifies the hardcoded A record type, and compare the IPv4 and IPv6 dig reproductions. Trace CNAME resolution for registered service names and verify that AAAA records are followed as well. Done means an IPv6-resolving service returns the CNAME and valid IPv6 address instead of only the CNAME.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100