diff --git a/doc/sphinx/man/perfdhcp.8.rst b/doc/sphinx/man/perfdhcp.8.rst index 222486d3fc..e3867bac3e 100644 --- a/doc/sphinx/man/perfdhcp.8.rst +++ b/doc/sphinx/man/perfdhcp.8.rst @@ -225,6 +225,10 @@ Options integer up to 65535. A value of 0 (the default) allows ``perfdhcp`` to choose its own port. + Note that ``perfdhcp -4`` behaves as a relay agent, and the server may send + replies to the BOOTPS port (67) irrespective of what port ``perfdhcp`` is + listening on. + ``-M mac-list-file`` Specifies a text file containing a list of MAC addresses, one per line. If provided, a MAC address is chosen randomly from this list for diff --git a/src/bin/perfdhcp/perf_socket.cc b/src/bin/perfdhcp/perf_socket.cc index aa67796a1d..4cf1a9388f 100644 --- a/src/bin/perfdhcp/perf_socket.cc +++ b/src/bin/perfdhcp/perf_socket.cc @@ -13,6 +13,7 @@ #include #include +#include using namespace isc::dhcp; using namespace isc::asiolink; @@ -53,8 +54,16 @@ PerfSocket::openSocket(CommandOptions& options) const { port = DHCP6_SERVER_PORT; } } else if (options.getIpVersion() == 4) { - port = 67; /// @todo: find out why port 68 is wrong here. + // perfdhcp sets giaddr to the bound socket address, so kea always + // responds to the server port. perfdhcp doesn't currently have a + // client behavior for DHCPv4; it either sets giaddr to the bound + // socket address or to a random address in the multi_subnet_ case. + port = DHCP4_SERVER_PORT; } + } else if ((options.getIpVersion() == 4) && (port != DHCP4_SERVER_PORT)) { + std::cerr << "WARNING: Port " << port << " specified, but server will " + << "respond to port " << DHCP4_SERVER_PORT << "." + << std::endl; } // Local name is specified along with '-l' option.