CyberShadow / dhcptest

Cross-platform DHCP test client
https://blog.cy.md/2013/01/10/dhcp-test-client
363 stars 57 forks source link

Swap 'special' and 'unknown' in enum, so that 'unknown' is default #41

Closed mikebeaton closed 6 months ago

mikebeaton commented 6 months ago

If 'special' is the default for unknown options then dhcptest refuses to accept them, with 'Fatal error: Can't specify a value for special option NN' when there is no format specifed, or with an assertion at line 616 for basically the same reason, if there is a format specifier.

Swapping so that 'unknown' is the default means that unknown options can be successfully manually specified.

mikebeaton commented 6 months ago

Here is an example command which works after the change but won't work before the change:

dhcptest --option "60=HTTPClient:Arch:00016:UNDI:003001" --option "93[hex]=0010" --request 67

and a screenshot from Wireshark showing that we have specified a valid value for a valid option:

Screenshot 2024-03-19 at 21 11 46

While it might also be useful to do a PR to make 93 a known option, I think it is definitely useful to allow unknown options to be specified like this.

CyberShadow commented 6 months ago

Thanks!