Abdellazizhammami / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

DHCP library uses an invalid hosthame #742

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Take any sketch that uses DHCP to require an IP address.
2.Upload and run

What is the expected output? What do you see instead?
In the DHCP server...
..I get a hostname which is WIZnet + some junk depending on MAC address. 
Sometimes printable characters, sometimes not.

..What I would expect to see is a hostname sent from the 
Arduino that at least only contains printable characters. And preferably 
hostnames that are valid for DNS queries.
The code in Dhcp.cpp takes the byte value of the last three octets in the MAC 
address and appends them to the static hostname "WIZnet". 
This is a quick but very dirty way of getting a unique hostname. I would like 
to see the proper hex representation of those three bytes appended to the 
static hostname instead. This would give something like WIZnet0A0B0C.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?
Arduino 1.0 on an Arduino Uno R1 with the Arduino Ethernet Shield

A fix can be found in the attached patch.

Original issue reported on code.google.com by pe...@birchroad.net on 6 Dec 2011 at 10:33

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for looking into this!  The patch didn't apply for me.  Can you check it 
and resubmit?

Original comment by dmel...@gmail.com on 6 Dec 2011 at 9:30

GoogleCodeExporter commented 8 years ago
Another try.
And there is a pull request (no 52) at github as well.
I don't know which method is the prefered.

Original comment by pe...@birchroad.net on 7 Dec 2011 at 7:10

Attachments:

GoogleCodeExporter commented 8 years ago
This fixed an issue I was having.  I'm new to Arduino - and programming 
electronics in general - and I'm using a Macbook Air with an Arduino Uno and 
Ethernet shield and had just downloaded the latest stable release of v1.0 from 
the Arduino.cc website.  I do know how git and patches work though.  Didn't 
have Xcode or git installed so I just compared the patch with the DHCP.cpp and 
DHCP.h files mentioned in the patch file and made the changes by hand.  Good 
thing it was such a small patch!
Worked like a charm and fixed the issue I was having in which it would not 
"talk" to the ancient Server 2003 DHCP server we're using but it would talk to 
the Buffalo DD-WRT router I have in my room.  Once i noticed the strange odd 
characters in the hostname I knew something was wrong and searched here to see 
if it was a bug in the DHCP code and it was.  My arduino's host name went from 
Wiznet+garbage to Wiznet009A0F and now it's talking to pachube.com properly.
I do so hope this is rolled up into the next full public release.
Thanks Peter!

Original comment by iball2...@gmail.com on 13 Dec 2011 at 9:16

GoogleCodeExporter commented 8 years ago
I haven't had chance to run it yet, but from a look through the code the pull 
request looks good to me.

Original comment by adrian.m...@gmail.com on 13 Dec 2011 at 11:31

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
https://github.com/arduino/Arduino/commit/b8fbffeac47e285bd68db80a0d5e716d8997df
42

Original comment by dmel...@gmail.com on 14 Dec 2011 at 5:56