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

CNAME not supported in DNS lookup? #24

Closed
DavyLandman opened this issue Apr 22, 2012 · 4 comments
Closed

CNAME not supported in DNS lookup? #24

DavyLandman opened this issue Apr 22, 2012 · 4 comments

Comments

@DavyLandman
Copy link
Contributor

Tt looks like DNS with a CNAME record (which are very common in load balancing/cloud based servers) result in a timeout and the result is 0.0.0.0 in remote addr.

Example DNS record:

$ dig www.gmail.com

; <<>> DiG 9.9.0 <<>> www.gmail.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36588
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;www.gmail.com.                 IN      A

;; ANSWER SECTION:
www.gmail.com.          69473   IN      CNAME   mail.google.com.
mail.google.com.        534226  IN      CNAME   googlemail.l.google.com.
googlemail.l.google.com. 150    IN      A       74.125.79.17
googlemail.l.google.com. 150    IN      A       74.125.79.18
googlemail.l.google.com. 150    IN      A       74.125.79.19
googlemail.l.google.com. 150    IN      A       74.125.79.83

;; Query time: 54 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Sun Apr 22 21:13:56 2012
;; MSG SIZE  rcvd: 159

And I changed getDHCPandDNS to connect to www.gmail.com to show the problem:

 char website[] PROGMEM = "www.gmail.com";

which results in:

[getDHCPandDNS]
My IP: 192.168.1.124
GW IP: 192.168.1.1
DNS IP: 192.168.1.1
DNS failed
Server: 0.0.0.0

>>> REQ

>>> REQ

I'm not really an expert on the DNS protocol and it's implementation in ethercard, but can this be solved/added?

Cheers,
Davy

@thiseldo
Copy link
Contributor

Only A type are supported as this was all that was implemented in the original code.

As a work around, just use one of the alternative googlemail.l.google.com A type addresses.

Andy

@DavyLandman
Copy link
Contributor Author

This workaround doesn't seem to work when a DNS server returns multiple IP's..

$ dig googlemail.l.google.com

; <<>> DiG 9.9.0 <<>> googlemail.l.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10751
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;googlemail.l.google.com.       IN      A

;; ANSWER SECTION:
googlemail.l.google.com. 91     IN      A       173.194.65.83
googlemail.l.google.com. 91     IN      A       173.194.65.18
googlemail.l.google.com. 91     IN      A       173.194.65.19
googlemail.l.google.com. 91     IN      A       173.194.65.17

@thiseldo
Copy link
Contributor

thiseldo commented Oct 8, 2012

Just checked the code, and yes, you're right, it wont work very well with multiple answers. I know this is something I had fixed a while ago in the EtherShield library as the original code didnt work properly either.

Another area of the library to be updated for both CNAME support and multiple IP addresses returned.

Andy

@DavyLandman
Copy link
Contributor Author

Cool!

This will make it easier too connect cloud hosted services.. or generally any DNS based load balancing solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants