flan / staticdhcpd

A fast, light, extremely customisable DHCP server written in Python
GNU General Public License v3.0
123 stars 42 forks source link

DHCPv4 server support for Rapid Commit #58

Closed thimslugga closed 3 years ago

thimslugga commented 8 years ago

Hi,

I wanted to know if this project fully supports rapid commit for dhcpv4 as I noticed a client in our implementation sending this as a dhcp option 81 and the server was responding immediately with an ACK. Checking the server response via wireshark the dhcp ACK didn't contain any reference to the rapid commit and the client was having issues configuing itself. Please let me know if you need any additional information. Thanks!

flan commented 8 years ago

It should support rapid-commit, but I have not encountered a client that actually uses it, so my implementation is based on the RFCs, without real-world validation.

If you can provide a PCAP of the exchange you're seeing or reference material that shows the flow in a manner that highlights the error on my side, I'll work on it within the week.

thimslugga commented 8 years ago

I will try and get another pcap that includes discover and ack. From the RFC it makes it sound like the server is supposed to include the rapid commit, dhcp option 80 not 81 :x From the original pcap it looked like staticdhcpd was responding with an ack but missing dhcp option 81 and this was causing issues for the client (dhcpcd on arch linux). Thanks again for looking into this!

http://tools.ietf.org/html/rfc4039

flan commented 8 years ago

I'm afraid I see no mention of option 81 in the RFC, but option 80 is described at http://tools.ietf.org/html/rfc4039#section-4 and it is being set https://github.com/flan/staticdhcpd/blob/2.0.x/staticDHCPd/staticdhcpdlib/dhcp.py#L476

The following seems to show that it gets written out properly:

import packet
x = packet.DHCPPacket()
x.setOption(80, [])
print(x)

::Header:: op: ERROR_UNDEF hwmac: MAC('00:00:00:00:00:00') flags: hops: 0 secs: 0 xid: 0 siaddr: IPv4('0.0.0.0') giaddr: IPv4('0.0.0.0') ciaddr: IPv4('0.0.0.0') yiaddr: IPv4('0.0.0.0') sname: '' file: ''

::Body:: [X][080] rapid_commit: None

x.encodePacket()

'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82ScP\x00\xff\x00\x00\x00'

I'll give the RFC a more thorough reading when I get home to be sure it's implemented correctly, though. I'll add an option to disable rapid-commit support, too, so you (and others) have a workaround (or a way to just turn it off permanently if undesireable) while the issue gets addressed.

flan commented 8 years ago

I'm afraid I cannot debug this further with any tests I can perform locally, but I'll take a look at any data you can provide as soon as possible.

For now, I've added ENABLE_RAPIDCOMMIT=True; you can set it to False in conf.py to disable rapidcommit semantics.

thimslugga commented 8 years ago

Hi again,

I was correcting myself when I mentioned the 80 not 81 as I originally included dhcp option 81. Sorry about the confusion. I plan on providing more information, I've been just been busy at the moment! Sorry.

flan commented 8 years ago

No problem; I'll take a look at whatever you can provide whenever you get a chance. I'm just not able to make any progress on identifying the problem independently. :(