Skip to content

Commit

Permalink
Allow Pkt4 to handle large hw addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoRoth committed May 21, 2024
1 parent 83405d5 commit 5db69a2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/lib/dhcp/pkt4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ Pkt4::pack() {
try {
size_t hw_len = hwaddr_->hwaddr_.size();

if (hwaddr_->htype_ == HTYPE_INFINIBAND) {
// According to RFC4390, hlen MUST be zero and chaddr zeroed out.
hw_len = 0;
}

buffer_out_.writeUint8(op_);
buffer_out_.writeUint8(hwaddr_->htype_);
buffer_out_.writeUint8(hw_len < MAX_CHADDR_LEN ?
Expand Down Expand Up @@ -481,13 +486,7 @@ void
Pkt4::setHWAddrMember(const uint8_t htype, const uint8_t hlen,
const std::vector<uint8_t>& mac_addr,
HWAddrPtr& hw_addr) {
/// @todo Rewrite this once support for client-identifier option
/// is implemented (ticket 1228?)
if (hlen > MAX_CHADDR_LEN) {
isc_throw(OutOfRange, "Hardware address (len=" << static_cast<uint32_t>(hlen)
<< ") too long. Max " << MAX_CHADDR_LEN << " supported.");

} else if (mac_addr.empty() && (hlen > 0) ) {
if (mac_addr.empty() && (hlen > 0) ) {
isc_throw(OutOfRange, "Invalid HW Address specified");
}

Expand Down

0 comments on commit 5db69a2

Please sign in to comment.