GithubHelp home page GithubHelp logo

dhcptest's Introduction

dhcptest

This is a DHCP test tool. It can send DHCP discover packets, and listen for DHCP replies.

The tool is cross-platform, although you will need to compile it yourself for non-Windows platforms.

The tool is written in the D Programming Language.

Download

You can download a compiled Windows executable from my website, here.

The latest development build for Windows can be downloaded from GitHub Actions.

Building

With DMD (or another D compiler) installed, run:

$ dmd dhcptest.d

Usage

By default, dhcptest starts in interactive mode. It will listen for DHCP replies, and allow sending DHCP discover packets using the "d" command. Type help in interactive mode for more information.

If you do not receive any replies, try using the --bind option (or --iface on Linux) to bind to a specific local interface.

The program can also run in automatic mode if the --query switch is specified on the command line.

An example command line to automatically send a discover packet and explicitly request option 43, wait for a reply, then print just that option:

dhcptest --quiet --query --request 43 --print-only 43

Options can also be specified by name:

dhcptest --quiet --query \
     --request    "Vendor Specific Information" \
     --print-only "Vendor Specific Information"

Query mode will report the first reply recieved. To automatically send a discover packet and wait for all replies before the timeout, use --wait. For additional resilience against dropped packets on busy networks, consider using the --tries and --timeout switches:

dhcptest --quiet --query --wait --tries 5 --timeout 10

You can spoof the Vendor Class Identifier, or send additional DHCP options with the request packet, using the --option switch:

dhcptest --query --option "60=Initech Groupware"

Option 82 (Relay Agent Information) can be specified as follows:

dhcptest --query --option "Relay Agent Information=agentCircuitID=\"foo\", agentRemoteID=\"bar\""

Run dhcptest --help for further details and additional command-line parameters.

For a list and description of DHCP options, see RFC 2132.

License

dhcptest is available under the Boost Software License 1.0.

Changelog

dhcptest v0.9 (2023-03-31)

  • Add option 121 (contributed by Andrey Baranov)
  • Add options 80, 100, 101, 108, 114, 116, 118, 249, and 252 (contributed by Rob Gill
  • Fix encoding/decoding options 43 and 82

dhcptest v0.8 (2023-03-24)

  • Add --iface option for Linux
  • Add support for Linux raw sockets (--raw)
  • Add --bind, --target, and --target-port options
  • Add --giaddr option (contributed by pcsegal)
  • Improve formatting and parsing of many options

dhcptest v0.7 (2017-08-03)

  • Refactor and improve option value parsing

  • Allow specifying all supported format types in both --option and --print-only switches

  • Allow specifying DHCP option types by name as well as by number

  • Allow overriding the request type option. E.g., you can now send 'request' (instead of 'discover') packets using:

     --option "DHCP Message Type=request"
    
  • Add formatting support for options 42 (Network Time Protocol Servers Option) and 82 (Relay Agent Information)

  • Change how timeouts are handled:

    • Always default to some finite timeout (not just when --tries and --wait are absent), but still allow waiting indefinitely if 0 is specified.
    • Increase default timeout from 10 to 60 seconds.

dhcptest v0.6 (2017-08-02)

  • Add --secs switch
  • Contributed by Darren White:
    • Add --wait switch
    • The --print-only switch now understands output formatting: --print-only "N[hex]" will output the value as a zero padded hexadecimal string of bytes. --print-only "N[ip]" will output the value as an IP address.
  • Don't print stack trace on errors

dhcptest v0.5 (2014-11-26)

  • The --option switch now understands hexadecimal or IPv4-dotted-quad formatting:
    --option "N[hex]=XX XX XX ..." or --option "N[IP]=XXX.XXX.XXX.XXX"

dhcptest v0.4 (2014-07-21)

  • Add switches: --tries, --timeout, --option

dhcptest v0.3 (2014-04-05)

  • Add switches: --mac, --quiet, --query, --request, --print-only
  • Print program messages to standard error

dhcptest v0.2 (2014-03-25)

  • License under Boost Software License 1.0
  • Add documentation
  • Add --help switch
  • Add --bind switch to specify the interface to bind on
  • Print time values in human-readable form
  • Heuristically detect and print ASCII strings in unknown options
  • Add option names from RFC 2132
  • Add help and quit commands
  • Add MAC address option to discover command

dhcptest v0.1 (2013-01-10)

  • Initial release

dhcptest's People

Contributors

cybershadow avatar darrenwhite99 avatar dronec avatar mikebeaton avatar pcsegal avatar rrobgill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dhcptest's Issues

Format typo for option 46 leading to crash

Got an exception when parsing option 46:

std.format.FormatException@/usr/local/opt/dmd/include/dlang/dmd/std/format.d(1257): Incorrect format specifier: %(%s, %s)

This change seems to fix it, but I've never touch D before.

		case OptionFormat.netbiosNodeType:
		enforce(bytes.length==1, "Bad netbiosNodeType data length");
-			f.writefln("%-(%s, %s)", bytes
+			f.writefln("%-(%s, %)", bytes

I can't get it to work in Linux (Manjaro ... almost Arch)

if I run it without sudo I get error:

Error while attempting to bind socket:
Unable to set socket option: Operation not permitted
Replies will not be visible. Use a packet capture tool to see replies,
or try re-running the program with more permissions.

which is obvious, but when I run it as sudo I still don't get any reply ever.

$ sudo dhcptest --iface enp0s31f6
[sudo] password for deemon:
dhcptest v0.7 - Created by Vladimir Panteleev
https://github.com/CyberShadow/dhcptest
Run with --help for a list of command-line options.

Listening for DHCP replies on port 68.
Type "d" to broadcast a DHCP discover packet, or "help" for details.
d
Sending packet:
op=BOOTREQUEST chaddr=36:60:A7:14:11:2C hops=0 xid=A878818A secs=0 flags=8000
ciaddr=0.0.0.0 yiaddr=0.0.0.0 siaddr=0.0.0.0 giaddr=0.0.0.0 sname= file=
1 options:
53 (DHCP Message Type): discover
d
Sending packet:
op=BOOTREQUEST chaddr=36:60:A7:14:11:2C hops=0 xid=4B02BE58 secs=0 flags=8000
ciaddr=0.0.0.0 yiaddr=0.0.0.0 siaddr=0.0.0.0 giaddr=0.0.0.0 sname= file=
1 options:
53 (DHCP Message Type): discover
d
Sending packet:
op=BOOTREQUEST chaddr=36:60:A7:14:11:2C hops=0 xid=78E2B844 secs=0 flags=8000
ciaddr=0.0.0.0 yiaddr=0.0.0.0 siaddr=0.0.0.0 giaddr=0.0.0.0 sname= file=
1 options:
53 (DHCP Message Type): discover

same thing with --iface enp0s31f6 --raw

Does work fine in windows computer.

[question] option 61 client idenfier

Could you tell me how to send option 61 client idenfier with dhcptest? Wireshark shows that normaly client identifier option consists of two values: Hardware type and Client Mac adress.

NTP IP format

The format of the NTP server's IP (192.168.10.5) is shown differnet from the other entries:
42 (Network Time Protocol Servers Option): C0 A8 0A 05

To be honest I don't know if the dhcp server or dhcptest is responsible for this
difference.

DHCP server:
dnsmasq 2.72-3+deb8u1 on debian jessie

Show mac address of the DHCP server

Hi

it will be much more helpfull if in the log you can also show mac address of the DHCP server. For example we need add DHCP server in the Unifi configuration as mac address, not IP address.

thx

Error: undefined identifier `inet_pton`

Hi, trying to troubleshoot option 119.
Added:

/// https://www.rfc-editor.org/rfc/rfc3397
119 : DHCPOptionSpec("Domain Search Option", OptionFormat.str),

Get:

PS C:\Users\piete\source\repos\CyberShadow\dhcptest> C:\Users\piete\Downloads\dmd.2.102.2.windows\dmd2\windows\bin64\dmd.exe dhcptest.d
dhcptest.d(1029): Error: undefined identifier `inet_pton`
PS C:\Users\piete\source\repos\CyberShadow\dhcptest> C:\Users\piete\Downloads\dmd.2.102.2.windows\dmd2\windows\bin\dmd.exe dhcptest.d
dhcptest.d(1029): Error: undefined identifier `inet_pton`
PS C:\Users\piete\source\repos\CyberShadow\dhcptest>

Any help on how to compile on Windows please using dmd.2.102.2.windows?
If you could create a VSCode project that would be awesome.

Thanks

Thanks so much for making this tool. 🥳 I wish I'd found it and figured it out three years ago. This has helped me so much right now.

I don't know why it's so relatively obscure, but it's the only tool I've been able to find that's been any help with testing my PXE setup. I don't have to struggle with staring at packet captures and waiting for reboots anymore.

dnsmasq had been driving me utterly nuts. (Additionally, starting to read the dnsmasq source code also helped.)

Support for Option 82 - Relay Agent

Please consider supporting Option 82, per RFC 3046.

There are plenty of Linux options for this, but no Windows test clients that I can find.

Thanks!

Problem with multiple NICs

I use Hyper-V on my computer. The discovery does not work on my main interface when the network card for the internal virtuell switch is enabled.

Allow selecting the port to connect to

I would like to use this tool to test a DHCP implementation, but I am unable to bind to port 67 while testing. A solution would be adding a command line switch to select the server port to connect to.

rebroadcast wiresharp DHCP request

Hi there I am trying your tool, don't realy know how to use interactive mode (d) (is this mode only for viewing packets?

lets suppose I want to broadcast that DHCP discover packet and then view matching DHCP offer packet

Frame 48320: 372 bytes on wire (2976 bits), 372 bytes captured (2976 bits) on interface 0
Ethernet II, Src: Netgem_84:5e:a8 (00:04:30:84:5e:a8), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Dynamic Host Configuration Protocol (Discover)
    Message type: Boot Request (1)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x5229eb03
    Seconds elapsed: 10
    Bootp flags: 0x0000 (Unicast)
        0... .... .... .... = Broadcast flag: Unicast
        .000 0000 0000 0000 = Reserved flags: 0x0000
    Client IP address: 0.0.0.0
    Your (client) IP address: 0.0.0.0
    Next server IP address: 0.0.0.0
    Relay agent IP address: 0.0.0.0
    Client MAC address: Netgem_84:5e:a8 (00:04:30:84:5e:a8)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (Discover)
        Length: 1
        DHCP: Discover (1)
    Option: (57) Maximum DHCP Message Size
        Length: 2
        Maximum DHCP Message Size: 576
    Option: (51) IP Address Lease Time
        Length: 4
        IP Address Lease Time: (4294967295s) infinity
    Option: (55) Parameter Request List
        Length: 17
        Parameter Request List Item: (1) Subnet Mask
        Parameter Request List Item: (3) Router
        Parameter Request List Item: (6) Domain Name Server
        Parameter Request List Item: (12) Host Name
        Parameter Request List Item: (15) Domain Name
        Parameter Request List Item: (17) Root Path
        Parameter Request List Item: (23) Default IP Time-to-Live
        Parameter Request List Item: (28) Broadcast Address
        Parameter Request List Item: (29) Perform Mask Discovery
        Parameter Request List Item: (31) Perform Router Discover
        Parameter Request List Item: (33) Static Route
        Parameter Request List Item: (121) Classless Static Route
        Parameter Request List Item: (40) Network Information Service Domain
        Parameter Request List Item: (41) Network Information Service Servers
        Parameter Request List Item: (42) Network Time Protocol Servers
        Parameter Request List Item: (14) Merit Dump File
        Parameter Request List Item: (64) Network Information Service+ Domain
    Option: (12) Host Name
        Length: 13
        Host Name: NETGEM-845ea8
    Option: (60) Vendor class identifier
        Length: 30
        Vendor class identifier: Netgem-N7700 Telekom-Slovenije
    Option: (61) Client identifier
        Length: 7
        Hardware type: Ethernet (0x01)
        Client MAC address: Netgem_84:5e:a8 (00:04:30:84:5e:a8)
    Option: (255) End
        Option End: 255
    Padding: 00

how would I acomplish that? (can I use interactive mode for that?) or is there some else command
Thanks for Anwsering and Best Regards

--bind option is not working on a different machine from the dhcp server

I tried to use --bind option to send out the DHCP request to test the DHCP server on another machine. However, it never receives the DHCP offer from the DHCP server. But I can see the DHCP offer comes back by using dhcpdump.

I also noticed that sometimes it cannot send out the DHCP discovery without --bind.

Please add DHCP option 119

Please add DHCP option 119 for domain search, accompanies DHCP option 15.
[https://www.rfc-editor.org/rfc/rfc3397]

I am not sure how to interpret multiple strings as per RFC vs. OptionFormat.str?

As FYI: In my environment the search domain typically just matches the domain name. Some OS's (even some versions of Win11) ignore option 15 and use option 119 for the default domain, which is how I ended up adding option 119.

Trying to compile on macOS

Hello,

I'm trying to compile dhcptest on macOS Sonoma (x64 architecture), using DMD64 D Compiler v2.105.3, but I get this error from the linker:

ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/gc/Desktop/sorgente/dhcptest.o' in '/Users/gc/Desktop/sorgente/dhcptest.o'; address=0x0 points to section(2) with no content in '/usr/local/opt/dmd/lib/libphobos2.a3177'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1

Am I missing something?

Thanks

Gabriele

P.S. : if needed, please find the verbose output from the compiler attached

verbose.txt

Fails on Linux : Socket descriptor index exceeds SocketSet capacity (port already in use by dhclient?)

Compiles fine on Ubuntu 15.10 with ldc2

$ ldc2 -O3 dhcptest.d 
$ ldc2 --version
LDC - the LLVM D compiler (0.14.0):
  based on DMD v2.065 and LLVM 3.5.2

Fails to open a socket when run (as root)

# ./dhcptest --query
dhcptest v0.5 - Created by Vladimir Panteleev
https://github.com/CyberShadow/dhcptest
Run with --help for a list of command-line options.

Listening for DHCP replies on port 68.
Sending packet:
  op=BOOTREQUEST chaddr=C7:01:A7:63:74:0A hops=0 xid=3B5EE740 secs=0 flags=8000
  ciaddr=0.0.0.0 yiaddr=0.0.0.0 siaddr=0.0.0.0 giaddr=0.0.0.0 sname= file=
  1 options:
     53 (DHCP Message Type): discover
std.socket.SocketParameterException@/build/ldc-o1m9aK/ldc-0.14.0.dfsg/runtime/phobos/std/socket.d(2112): Socket descriptor index exceeds SocketSet capacity

Most likely, because on linux (at least Ubuntu), dhclient is running in the background and already using port 68. There doesn't seem to be a simple way to temporarily stop dhclient.

I might try run this inside docker at some point to investigate some more / test out the explanation.

Recompile Windows with latest version

Hi

The windows version does not have all the options in your code.

So I guess it's not the last version?

If I'm right can u please recompile the latest version to an exe file

Thanks

Setting lease time does not work correctly

When specifying a lease time, such as with --option 51=0060 , I see an output like:

  2 options:
     53 (DHCP Message Type): discover
     51 (IP Address Lease Time): 808465968 (1336 weeks, 5 days, 5 hours, 52 minutes, and 48 secs)

Using --option 51="0060" or --option "51=0060" results in the same output as above.

Multiple options

hi,What combination of commands sends more than one option, for example, option60 is carried at the same time as option55?

Problems if certain virtual adapters exist.

I wanted to use this tool to create an automated script that runs on a timer to test my DHCP server(s) and take remedial action/generate email alerts if issues are found.
My configuration is admittedly somewhat out of the ordinary.
I have two Windows Server 2019 instances, each one running as a virtual machine on two different hardware platforms, each also running the Server 2019 HyperVisor. There are DHCP servers running on each of the HyperVisor images (real machines) in a DHCP failover configuration.
The two virtual Servers are also configured in a Windows Failover Cluster, which is at least part of the problem I'm about to describe.
I wanted to use dhcptest inside an automation script, running on a timer, to verify DHCP servers are working and take action if not.
What I think is happening, is that dhcptest is perhaps by default sending its DISCOVER packets out over the first IP interface it finds, which in my case just happens to be the virtual adapter that Failover Clustering uses. This adapter will always have an APIPA address in subnet 169.254/16 so that's what goes out from the two VM's. I think when the Hypervisor sees those packets, it drops/blocks them because of those APIPA addresses. I say this because via Wireshark I can see the packets going out on on the VM side, but they never "arrive" in Wireshark on the Hypervisor side. I'm not sure if this is a solvable situation, but if it is, I'd certainly appreciate it.
Thanks.

Update archive/0.7.zip

I'm building brew recipe to simplify the build & installation process for dhcptest in MacOS with brew.sh Homebrew. There's one problem: I can't refer to general master.zip tarball. Instead, I'd like to use archive/0.7.zip. However it's still the old one, from Aug 3, 2017. Can you recreate this tag?

Compilation errors

I've never used D before. I got the same errors with DMD.

$ ldc2 dhcptest.d
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5600): Error: template std.format.unformatValueImpl cannot deduce function from argument types !(RelayAge
ntInformationSuboption)(string, const(FormatSpec!char)), candidates are:
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5710):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = RelayAgentInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       is(Unqual!T == bool)
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5724):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = RelayAgentInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       is(T == typeof(null))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5735):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = RelayAgentInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       !is(T == enum)
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5771):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = RelayAgentInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       isFloatingPoint!T
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5797):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = RelayAgentInformationSuboption,
       Range = string,
       Char = char                                                                                                                                              must satisfy the following constraint:
       isSomeChar!T
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5600):        ... (3 more, -v to show) ...
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(713): Error: template instance std.format.unformatValue!(RelayAgentInformationSuboption, string, char) er
ror instantiating
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(656):        instantiated from here: formattedRead!(string, char, RelayAgentInformationSuboption*)
dhcptest.d(431):        instantiated from here: formattedRead!("%s", string, RelayAgentInformationSuboption*)
dhcptest.d(506):        instantiated from here: VLList!(RelayAgentInformationSuboption)
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5600): Error: template std.format.unformatValueImpl cannot deduce function from argument types !(VendorSp
ecificInformationSuboption)(string, const(FormatSpec!char)), candidates are:
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5710):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = VendorSpecificInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       is(Unqual!T == bool)
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5724):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = VendorSpecificInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       is(T == typeof(null))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5735):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = VendorSpecificInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       !is(T == enum)
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5771):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = VendorSpecificInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       isFloatingPoint!T
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5797):        unformatValueImpl(T, Range, Char)(ref Range input, ref scope const FormatSpec!Char spec)
  with T = VendorSpecificInformationSuboption,
       Range = string,
       Char = char
  must satisfy the following constraint:
       isSomeChar!T
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(5600):        ... (3 more, -v to show) ...
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(713): Error: template instance std.format.unformatValue!(VendorSpecificInformationSuboption, string, char
) error instantiating
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/format.d(656):        instantiated from here: formattedRead!(string, char, VendorSpecificInformationSuboption*)
dhcptest.d(431):        instantiated from here: formattedRead!("%s", string, VendorSpecificInformationSuboption*)
dhcptest.d(551):        instantiated from here: VLList!(VendorSpecificInformationSuboption)

Problem with failover clustering -revised

If the utility is run from a Windows Server instance that is also a member of a Windows failover cluster, one of two things is happening:
If run from the instance that is NOT the current cluster "owner", the source IP address in the DISCOVER packet will be an APIPA address and not 0.0.0.0
If run from the instance that IS the current cluster "owner", the DISCOVER packet will not be sent at all.

Decide on / add licensing information

I'd like to contribute some code to this, but I would be doing it as part of my day job.

Having this under a standard open source license would make that possible...

Support using the device MAC address

I would like to use device MAC address in the --mac option. For example, on Linux, a possible usage may be:

$ sudo ./dhcptest --quiet
d @eth0
  op=BOOTREPLY chaddr=[MAC address of device eth0] hops=1 xid=D772D15D secs=0 flags=8000
  ciaddr=0.0.0.0 yiaddr=[my IP] siaddr=0.0.0.0 giaddr=[my IP] sname= file=
  10 options:
     53 (DHCP Message Type): offer
     54 (Server Identifier): [DHCP server IP]
     51 (IP Address Lease Time): 86400 (1 day)
      1 (Subnet Mask): 255.255.255.0
      3 (Router Option): [Router IP]
      6 (Domain Name Server Option): [DNS servers' IPs]
     58 (Renewal (T1) Time Value): 43200 (12 hours)
     59 (Rebinding (T2) Time Value): 75600 (21 hours)
     28 (Broadcast Address Option): [Broadcast address]
     15 (Domain Name): [Domain name]
q

I have an implementation at https://github.com/yan12125/dhcptest, however, I'm not familiar with D and the implementation is naive. Could you add the support?

Consider modifying "forever" timeout as default for single query

Just suggesting that before you consider v0.6 done, that you change the timeout behavior default when using query. Perhaps make the default timeout 60 seconds for a single try, or 10 seconds for multiple tries, as defaults. You could still support "0" seconds timeout as a way to enable the "forever" mode,

Maybe initialize the timeout as "-1" seconds (so you can distinguish when "0" was specified), and then when checking the value you can set any negative value (including invalid negative value passed on the command line) to the default 60 or 10 seconds, 0 to forever, or use any positive timeout value passed.

You could also add some more enforce logic around line 564, to kick out people specifying --timeout, --tries, --print-only, --option, or any other parameter that is only supported in query mode when --query was not specified.

I think those features would make for a nice v0.6 with some "official" binaries to go with it.

Thank you for your work creating this product. I'm sure it scratched a need you had, it definitely has scratched a need I had. :)

Can't compile under MacOS

# dmd dhcptest.d
dhcptest.d(888): Error: undefined identifier ifreq
dhcptest.d(891): Error: undefined identifier ioctl

compiler: DMD64 D Compiler v2.094.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.