Community discussions

MikroTik App
 
jeroenp
Member Candidate
Member Candidate
Topic Author
Posts: 159
Joined: Mon Mar 17, 2014 11:30 am
Location: Amsterdam
Contact:

[SOLVED] DHCP server: Odd active hostname behaviour: some views have null character at the end, some don't.

Mon May 02, 2016 9:42 pm

I've observed this on a CCR1009 with both firmware 6.35 and 6.35.1.

Two devices give null characters at the end of the Active Hostname in some views, but not all.

The list view:
Image

The details views:
ImageImage

The characters are actually nulls:
36   ;;; wlae-ag300n-pso-1     192.168.71.38                                           4C:E6:76:0F:50:80 AP4CE6760F5080\00        dhcp_lan                                        bound  
41   ;;; wlae-ag300n-pso-2     192.168.71.49                                           4C:E6:76:0F:50:42 AP4CE6760F5042\00        dhcp_lan                                        bound  
The names in the devices (both Buffalo WLAE-AG300N running firmware Ver.1.85 (R1.05/B1.00)) are without the strange character at the end:
ImageImage

How can I debug why the null character is there?

How can I modify the script at https://github.com/Tolaris/mikrotik-dns ... hcp.script so it strips the null character?

--jeroen
Last edited by jeroenp on Thu May 05, 2016 11:59 am, edited 1 time in total.
 
pe1chl
Forum Guru
Forum Guru
Posts: 6914
Joined: Mon Jun 08, 2015 12:09 pm

Re: DHCP server: Odd active hostname behaviour: some views have null character at the end, some don't.

Tue May 03, 2016 2:20 pm

I think it is a bug in the DHCP client, which adds a null character to the hostname it sends to the server.
The DHCP client options are of structure Type/Length/Value so a client is supposed to set the length
of the hostname to exactly the number of characters.
However there exist buggy clients that either send a length of 1 more and a \00 at the end of the name,
or send a fixed length and pad it with \00 as necessary.

Although it is the client that is wrong, it would be conservative to have code in the server that strips the
\00 characters from the name when they are present. ISC DHCPD does this, after encountering
the same problem.

However, the one you should really go after is the manufacturer of the client device.
 
jeroenp
Member Candidate
Member Candidate
Topic Author
Posts: 159
Joined: Mon Mar 17, 2014 11:30 am
Location: Amsterdam
Contact:

Re: DHCP server: Odd active hostname behaviour: some views have null character at the end, some don't.

Tue May 03, 2016 2:24 pm

I think it is a bug in the DHCP client, which adds a null character to the hostname it sends to the server.
...
However, the one you should really go after is the manufacturer of the client device.
In order to go after the manufacturer, I've to debug what's going on.

How can I dump the affected DHCP messages from the Mikrotik?

--jeroen
 
pe1chl
Forum Guru
Forum Guru
Posts: 6914
Joined: Mon Jun 08, 2015 12:09 pm

Re: DHCP server: Odd active hostname behaviour: some views have null character at the end, some don't.

Tue May 03, 2016 2:30 pm

Use Tools->Packet Sniffer, do a capture to some file, select protocol udp and port 67, apply and start.
Wait some time then stop the capture, download the file, and load it into WireShark.

Then you can see what is really going on.
 
jeroenp
Member Candidate
Member Candidate
Topic Author
Posts: 159
Joined: Mon Mar 17, 2014 11:30 am
Location: Amsterdam
Contact:

Re: DHCP server: Odd active hostname behaviour: some views have null character at the end, some don't.

Tue May 03, 2016 3:00 pm

Marvellous. How can I up-vote posts?
 
jeroenp
Member Candidate
Member Candidate
Topic Author
Posts: 159
Joined: Mon Mar 17, 2014 11:30 am
Location: Amsterdam
Contact:

Re: DHCP server: Odd active hostname behaviour: some views have null character at the end, some don't.

Tue May 03, 2016 5:38 pm

I think it is a bug in the DHCP client, which adds a null character to the hostname it sends to the server.
The DHCP client options are of structure Type/Length/Value so a client is supposed to set the length
of the hostname to exactly the number of characters.
However there exist buggy clients that either send a length of 1 more and a \00 at the end of the name,
or send a fixed length and pad it with \00 as necessary.
Bingo: you were right (boy I love to write that, as it means I have learned something new).

Image

Who is online

Users browsing this forum: gnommon and 36 guests