reservereleasearg.go
func (r *ReserveReleaseArg) UnmarshalBinary(b []byte) error {
	// Must contain minimum length for argument
	if len(b) < reserveReleaseArgLen {
		return io.ErrUnexpectedEOF
	}

	r.Command = ReserveReleaseCommand(b[0])
	r.NMACs = b[1]

	// Must have exact number of bytes for hardware addresses with
	// this count
	if len(b[2:]) != (6 * int(r.NMACs)) {
		return io.ErrUnexpectedEOF
	}

	// Copy each hardware address into slice
	r.MACs = make([]net.HardwareAddr, r.NMACs)
	for i := 0; i < int(r.NMACs); i++ {
		m := make(net.HardwareAddr, 6)
		copy(m, b[2+(i*6):2+(i*6)+6])
		r.MACs[i] = m
	}

	return nil
}
func (r *ReserveReleaseArg) UnmarshalBinary(b []byte) error {
	// Must contain minimum length for argument
	if len(b) < reserveReleaseArgLen {
		return io.ErrUnexpectedEOF
	}

	r.Command = ReserveReleaseCommand(b[0])
	r.NMACs = b[1]

	// Must have exact number of bytes for hardware addresses with
	// this count
	if len(b[2:]) != (6 * int(r.NMACs)) {
		return io.ErrUnexpectedEOF
	}

	// Copy each hardware address into slice
	r.MACs = make([]net.HardwareAddr, r.NMACs)
	for i := 0; i < int(r.NMACs); i++ {
		m := make(net.HardwareAddr, 6)
		copy(m, b[2+(i*6):2+(i*6)+6])
		r.MACs[i] = m
	}

	return nil
}
// UnmarshalBinary unmarshals a byte slice into a ReserveReleaseArg.
//
// If the byte slice does not contain enough bytes to form a valid
// ReserveReleaseArg, or a hardware address is malformed, io.ErrUnexpectedEOF
// is returned.