Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the reason perfdhcp -4 defaults to port 67. #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/sphinx/man/perfdhcp.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/bin/perfdhcp/perf_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <dhcp/iface_mgr.h>
#include <asiolink/io_address.h>
#include <iostream>

using namespace isc::dhcp;
using namespace isc::asiolink;
Expand Down Expand Up @@ -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.
Expand Down