Skip to content

Conversation

jhorck
Copy link

@jhorck jhorck commented Dec 15, 2014

I found a bug in DNSClient::getHostByName() and fixed it.

I'm trying to connect to a local server, called 'htpc'. The hostname is resolved by DNSClient::getHostByName(). The first thing this function does is "See if it's a numeric IP address" by calling inet_aton(). It returns falsely 1 (=yes, it's a numeric IP address) for hostname 'htpc'

For most (longer) hostnames it will accidentally return 0. This is probably why it hasn't been discovered before.

  • valid IP address digits have to be >= 0 AND <= 9
  • valid IP addresses must have 4 segments

valid IP address digits have to be >= 0 AND <= 9
valid IP addresses must have 4 segments
@ffissore
Copy link
Contributor

@ArduinoBot build this please

@cmaglie cmaglie added Type: Bug Library: Ethernet The Ethernet Arduino library labels Apr 15, 2015
cmaglie added a commit to cmaglie/Arduino that referenced this pull request Sep 9, 2015
@cmaglie
Copy link
Member

cmaglie commented Sep 11, 2015

@jhorck
thanks for the patch!

This PR is a good fix for your use case, but there are other parsing problems.
I come with another solution in #3780, If you're still interested please follow up there.

(closing as superseded by #3780)

@cmaglie cmaglie closed this Sep 11, 2015
@ffissore ffissore modified the milestone: Release 1.6.6 Sep 14, 2015
sandeepmistry pushed a commit to sandeepmistry/Arduino that referenced this pull request Sep 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Ethernet The Ethernet Arduino library Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants