@@ -84,6 +84,15 @@ Pkt4::pack() {
84
84
85
85
try {
86
86
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
+ }
87
96
88
97
buffer_out_.writeUint8 (op_);
89
98
buffer_out_.writeUint8 (hwaddr_->htype_ );
@@ -101,7 +110,7 @@ Pkt4::pack() {
101
110
if ((hw_len > 0 ) && (hw_len <= MAX_CHADDR_LEN)) {
102
111
// write up to 16 bytes of the hardware address (CHADDR field is 16
103
112
// bytes long in DHCPv4 message).
104
- buffer_out_.writeData (&hwaddr_->hwaddr_ [0 ],
113
+ buffer_out_.writeData (&hwaddr_->hwaddr_ [hw_offset ],
105
114
(hw_len < MAX_CHADDR_LEN ?
106
115
hw_len : MAX_CHADDR_LEN) );
107
116
hw_len = MAX_CHADDR_LEN - hw_len;
@@ -481,13 +490,7 @@ void
481
490
Pkt4::setHWAddrMember (const uint8_t htype, const uint8_t hlen,
482
491
const std::vector<uint8_t >& mac_addr,
483
492
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 ) ) {
493
+ if (mac_addr.empty () && (hlen > 0 ) ) {
491
494
isc_throw (OutOfRange, " Invalid HW Address specified" );
492
495
}
493
496
0 commit comments