Bug or feature? \00 in hostnames?

I am currently observing strange behaviour on RouterOS (v.6.20).

Every linux based host has \00 in their hostname.
Windows Machines doesnt have it.
[admin@kari-crs] > /ip dhcp-server lease print
Flags: X - disabled, R - radius, D - dynamic, B - blocked

ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS

0 192.168.1.2 60:A4:4C:8E:9C:90 dhcp-server1 bound
1 192.168.1.10 00:11:32:28:9D:E7 Syno\00 dhcp-server1 bound
2 192.168.1.16 00:90:A9:69:B3:40 WDTVLive\00 dhcp-server1 bound
3 192.168.1.17 00:E0:36:EF:EE:D6 dhcp-server1
4 D 192.168.1.251 60:45:BD:EC:54:98 Surface-RT dhcp-server1 bound
5 D 192.168.1.250 EC:F3:5B:50:EA:C4 Etzi-Lumia dhcp-server1 bound
6 D 192.168.1.248 84:3A:4B:47:BD:68 MSA-4000237 dhcp-server1 bound
7 192.168.1.15 00:02:9B:CA:88:93 dhcp-server1 boundIn a result, every Static DNS (for any Linux/BSD host), generated by the script has an whitespace between Hostname and domain, so they wont resolve. :frowning:
Of course I could trim that "\00" in the script, but I would like to understand why it does that in a first place. :wink:

I see it with a Synology NAS as well. Don’t recall if I saw it with Ubuntu Linux clients. I suspect that the host-name is the client identifier (option) which I don’t think is a NULL terminated string. Chances are that the DHCP client is broken on embedded Linux devices.

check settings on these devices, i have linux boxes running and have never seen trailing \00 for hostnames.

Check if /etc/hostname and /etc/hosts have newline at the end of the configuration file.

On mine the hostname file looks okay:

[duck] Matt>od -c hostname
0000000   d   s   1   1   0   j  \n
0000007



[duck] Matt>od -c hosts
0000000   1   2   7   .   0   .   0   .   1  \t   l   o   c   a   l   h
0000020   o   s   t  \n   1   9   2   .   1   6   8   .   1   4   4   .
0000040   8  \t   d   s   1   1   0   j  \n  \n  \n  \n  \n  \n  \n  \n
0000060  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n
*
0000260  \n  \n  \n  \n  \n  \n  \n  \n
0000270

On WD TV you cannot check anything as you dont have SSH access at all or any other way to access config files.
On Synology, I will check later…but I really doubt that I find anything abnormal.

Anyway, it doesnt occure on any other router, verified with couple ones.
DD-WRT and OpenWRT, both show hostnames as they should be… :wink:

Same here… :unamused:

I had a Qnap NAS (with original firmware) which gave the same result. I can’t recall the hostname file, but the trailing \00 was only with ROS, not with OpenWRT.

It was annoying, because my dhcp lease-script set static dns names on ROS.

Now the NAS is on Debian and the problem is gone. :slight_smile:

Well that is my actual problem with this..

And it doesnt occure on any other Router, regardless of OS…at least so far I havent found any that behaves the same way.
Tried OpenWRT, DD-WRT, Tomato, AsusWRT, IOS, JunOS, etc…

http://marc.info/?l=dhcp-client&m=95071885113737&w=2

https://www.isc.org/wp-content/uploads/2013/06/References.html#anchor12