jagornet/dhcp

Unable to specify only one IPv4 unicast address

Closed this issue · 1 comments

I have many network interfaces on a server machine, and I want to be able to configure Jagornet to act as a DHCP server for a network that is attached to just one of those interfaces. Currently if a single IP address is provided to the --v4ucast parameter, Jagornet does not start successfully.

It looks like it is due to the following code, that parses the options. The case of specifying just one IPv4 unicast address results in a null value for v4UcastAddrs.

Thanks for reporting this issue. The same problem exists for unicast IPv6 addresses due to the same option parsing bug.

As a workaround, you can specify two addresses - one for the interface you want to listen on and the second for the loopback/127.0.0.1 address, and the server will (by default) ignore the loopback IP. For example:

bin/dhcpserver start -4u 10.0.0.10 127.0.0.1