TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
4.54k stars 431 forks source link

"Bootstrap Server Host Name" doesn't populate DHCP option 66 #1078

Closed elias314 closed 1 month ago

elias314 commented 1 month ago

I was trying to push down the IP of my phone system to my phones via DHCP option 66. When I try to use the "Bootstrap Server Host Name" for this, it gets put in the DHCP packet as a "Server host name", but it's not listed under the options section and my phone won't boot:

Bootstrap_Server_Host_Name

<SNIP>
Dynamic Host Configuration Protocol (Offer)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xdebaec17
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 172.30.8.198
    Next server IP address: 172.30.1.53
    Relay agent IP address: 0.0.0.0
    Client MAC address: Digium_d1:d8:ee (00:0f:d3:d1:d8:ee)
    Client hardware address padding: 00000000000000000000
    Server host name: 172.30.8.199
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Offer)
        Length: 1
        DHCP: Offer (2)
    Option: (54) DHCP Server Identifier (172.30.1.53)
        Length: 4
        DHCP Server Identifier: 172.30.1.53
<SNIP>
    Option: (255) End
        Option End: 255

But if I use the "Generic DHCP Options" section, the IP gets populated as an option and my phone boots:

Generic_Option_66

<SNIP>
Dynamic Host Configuration Protocol (Offer)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xbf5a8d45
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 172.30.8.198
    Next server IP address: 172.30.1.53
    Relay agent IP address: 0.0.0.0
    Client MAC address: Digium_d1:d8:ee (00:0f:d3:d1:d8:ee)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Offer)
        Length: 1
        DHCP: Offer (2)
    Option: (54) DHCP Server Identifier (172.30.1.53)
        Length: 4
        DHCP Server Identifier: 172.30.1.53
<SNIP>
    Option: (66) TFTP Server Name
        Length: 12
        TFTP Server Name: 172.30.8.199
    Option: (255) End
        Option End: 255

Is the reference to option 66 on the "Bootstrap Server Host Name" field just a mislabeling or is the value also supposed to be included in the options list?

DNS Server version: 13.0.2

ShreyasZare commented 1 month ago

Thanks for the post. The option 66 is supposed to be used only when the sname field in the header is used to store other DHCP options [1]. This is done to reuse the header space for options to compress the DHCP packet.

Both the sname and Options 66 are equivalent and if sname field has value, it must be used. The DHCP server is using the sname field in response so its not actually sending it as an Option 66. The labeling for the field is just to help identify the field where the relevant value should go.

Its actually strange that the phone is not using the sname field and is expecting only Option 66 in response.

[1] https://datatracker.ietf.org/doc/html/rfc2132#section-9.4

elias314 commented 1 month ago

Ah, interesting. As is typical with embedded systems, I suspect the phone isn't following the guidelines exactly and is only looking in the options section of the packet and ignoring the sname field. Thanks for the clarification!