Skip to content

DNSClient::inet_aton fix and new IPAddress::fromString method #3780

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

Merged
merged 2 commits into from
Sep 18, 2015

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Sep 11, 2015

At this point DNSClient::inet_aton can be transformed to just an inline call to IPAddress::fromString but this will make the Ethernet library incompatible with old cores, so the temporary compromise is that the code is duplicated until the new core becomes more widespread.

@cmaglie cmaglie added Component: Core Related to the code for the standard Arduino API feature request A request to make an enhancement (not a bug fix) Type: Bug Library: Ethernet The Ethernet Arduino library labels Sep 11, 2015
@cmaglie cmaglie self-assigned this Sep 11, 2015
@jhorck
Copy link

jhorck commented Sep 11, 2015

I proposed #2500. This fix looks good to me too, though I didn't test it.

I don't understand the comment "// TODO: add support for "a", "a.b", "a.b.c" formats"
IP addresses always have 4 bytes (IPv4). I hope fewer bytes are NEVER accepted as a valid IP address?

@cmaglie
Copy link
Member Author

cmaglie commented Sep 11, 2015

Hi @jhorck

thanks for the comment.

I don't understand the comment "// TODO: add support for "a", "a.b", "a.b.c" formats"

believe it or not you can specify the ip address using the following format:

A.A.A.A
A.A.B
A.C
D

where:

  • A is an 8-bit unsigned
  • B is a 16-bit unsigned
  • C is a 24-bit unsigned
  • D is a 32-bit unsigned

for example on my linux box I can do:

:~$ ping 2130706433
PING 2130706433 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.056 ms

or better.

~$ ping 127.1
PING 127.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.043 ms

I didn't know that until I looked to some implementations of inet_aton (for example http://www.comp.nus.edu.sg/~cs3223/doxygen-postgres9.4.0/html/dd/dbe/inet__aton_8c_source.html)

BTW it's a so rarely used feature that I guess we'll leave it unsupported.

@jhorck
Copy link

jhorck commented Sep 11, 2015

@cmaglie, You're right! I didn't know that!

@cmaglie cmaglie added this to the Release 1.6.6 milestone Sep 18, 2015
@cmaglie cmaglie merged commit e3909b4 into arduino:master Sep 18, 2015
@cmaglie cmaglie deleted the ethernet-dns-fix branch September 18, 2015 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Related to the code for the standard Arduino API feature request A request to make an enhancement (not a bug fix) Library: Ethernet The Ethernet Arduino library Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants