Skip to content

Commit 5db69a2

Browse files
committed
Allow Pkt4 to handle large hw addresses
1 parent 83405d5 commit 5db69a2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/lib/dhcp/pkt4.cc

+6-7
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ Pkt4::pack() {
8585
try {
8686
size_t hw_len = hwaddr_->hwaddr_.size();
8787

88+
if (hwaddr_->htype_ == HTYPE_INFINIBAND) {
89+
// According to RFC4390, hlen MUST be zero and chaddr zeroed out.
90+
hw_len = 0;
91+
}
92+
8893
buffer_out_.writeUint8(op_);
8994
buffer_out_.writeUint8(hwaddr_->htype_);
9095
buffer_out_.writeUint8(hw_len < MAX_CHADDR_LEN ?
@@ -481,13 +486,7 @@ void
481486
Pkt4::setHWAddrMember(const uint8_t htype, const uint8_t hlen,
482487
const std::vector<uint8_t>& mac_addr,
483488
HWAddrPtr& hw_addr) {
484-
/// @todo Rewrite this once support for client-identifier option
485-
/// is implemented (ticket 1228?)
486-
if (hlen > MAX_CHADDR_LEN) {
487-
isc_throw(OutOfRange, "Hardware address (len=" << static_cast<uint32_t>(hlen)
488-
<< ") too long. Max " << MAX_CHADDR_LEN << " supported.");
489-
490-
} else if (mac_addr.empty() && (hlen > 0) ) {
489+
if (mac_addr.empty() && (hlen > 0) ) {
491490
isc_throw(OutOfRange, "Invalid HW Address specified");
492491
}
493492

0 commit comments

Comments
 (0)