Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gvproxy internal dns resolver needs to handle all query types #233

Closed
Luap99 opened this issue Jun 8, 2023 · 0 comments
Closed

gvproxy internal dns resolver needs to handle all query types #233

Luap99 opened this issue Jun 8, 2023 · 0 comments

Comments

@Luap99
Copy link
Member

Luap99 commented Jun 8, 2023

see

case dns.TypeNS:
records, err := resolver.LookupNS(context.TODO(), q.Name)
if err != nil {
m.Rcode = dns.RcodeNameError
return
}
for _, ns := range records {
m.Answer = append(m.Answer, &dns.NS{
Hdr: dns.RR_Header{
Name: q.Name,
Rrtype: dns.TypeNS,
Class: dns.ClassINET,
Ttl: 0,
},
Ns: ns.Host,
})
}
case dns.TypeA:
ips, err := resolver.LookupIPAddr(context.TODO(), q.Name)
if err != nil {
m.Rcode = dns.RcodeNameError
return
}
for _, ip := range ips {
if len(ip.IP.To4()) != net.IPv4len {
continue
}
m.Answer = append(m.Answer, &dns.A{
Hdr: dns.RR_Header{
Name: q.Name,
Rrtype: dns.TypeA,
Class: dns.ClassINET,
Ttl: 0,
},
A: ip.IP.To4(),
})
}
}

The dns resolver only handles NS and A queries and ignores all other types and returns nothing in this case.
This was reported by a users who wants to use SRV or TXT records in his podman container, see containers/podman#18823

cfergeau added a commit to cfergeau/gvisor-tap-vsock that referenced this issue Jun 12, 2023
The current implementation only supports A and NS records.
This should fix containers#233

This can be tested with:
```
podman run -it --rm alpine nslookup -type=txt rs.joedrumgoole.com
```
cfergeau added a commit to cfergeau/gvisor-tap-vsock that referenced this issue Jun 13, 2023
The current implementation only supports A and NS records.
This should fix containers#233

This can be tested with:
```
podman run -it --rm alpine nslookup -type=txt rs.joedrumgoole.com
```

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant