@@ -84,6 +84,15 @@ Pkt4::pack() {
8484
8585 try {
8686 size_t hw_len = hwaddr_->hwaddr_ .size ();
87+ size_t hw_offset = 0 ;
88+
89+ if (hwaddr_->htype_ == HTYPE_INFINIBAND && hw_len == HWAddr::INFINIBAND_HWADDR_LEN) {
90+ // According to RFC4390, hlen MUST be zero and chaddr zeroed out.
91+ // However, at least dhclient can't handle that and fails.
92+ // Instead, return the last 8 bytes, which contain the actual unique hw part.
93+ hw_len = 8 ;
94+ hw_offset = HWAddr::INFINIBAND_HWADDR_LEN - 8 ;
95+ }
8796
8897 buffer_out_.writeUint8 (op_);
8998 buffer_out_.writeUint8 (hwaddr_->htype_ );
@@ -101,7 +110,7 @@ Pkt4::pack() {
101110 if ((hw_len > 0 ) && (hw_len <= MAX_CHADDR_LEN)) {
102111 // write up to 16 bytes of the hardware address (CHADDR field is 16
103112 // bytes long in DHCPv4 message).
104- buffer_out_.writeData (&hwaddr_->hwaddr_ [0 ],
113+ buffer_out_.writeData (&hwaddr_->hwaddr_ [hw_offset ],
105114 (hw_len < MAX_CHADDR_LEN ?
106115 hw_len : MAX_CHADDR_LEN) );
107116 hw_len = MAX_CHADDR_LEN - hw_len;
@@ -473,13 +482,7 @@ void
473482Pkt4::setHWAddrMember (const uint8_t htype, const uint8_t hlen,
474483 const std::vector<uint8_t >& mac_addr,
475484 HWAddrPtr& hw_addr) {
476- // / @todo Rewrite this once support for client-identifier option
477- // / is implemented (ticket 1228?)
478- if (hlen > MAX_CHADDR_LEN) {
479- isc_throw (OutOfRange, " Hardware address (len=" << static_cast <uint32_t >(hlen)
480- << " ) too long. Max " << MAX_CHADDR_LEN << " supported." );
481-
482- } else if (mac_addr.empty () && (hlen > 0 ) ) {
485+ if (mac_addr.empty () && (hlen > 0 ) ) {
483486 isc_throw (OutOfRange, " Invalid HW Address specified" );
484487 }
485488
0 commit comments