code: func (p *Packet) MarshalBinary() ([]byte, error) {
  	// 2 bytes: hardware type
  	// 2 bytes: protocol type
  	// 1 byte : hardware address length
  	// 1 byte : protocol length
  	// 2 bytes: operation
  	// N bytes: source hardware address
  	// N bytes: source protocol address
  	// N bytes: target hardware address
  	// N bytes: target protocol address
  
  	// Though an IPv4 address should always 4 bytes, go-fuzz
  	// very quickly created several crasher scenarios which
  	// indicated that these values can lie.
  	b := make([]byte, 2+2+1+1+2+(p.IPLength*2)+(p.HardwareAddrLength*2))
  
  	// Marshal fixed length data
  
  	binary.BigEndian.PutUint16(b[0:2], p.HardwareType)
  	binary.BigEndian.PutUint16(b[2:4], p.ProtocolType)
  
  	b[4] = p.HardwareAddrLength
  	b[5] = p.IPLength
  
  	binary.BigEndian.PutUint16(b[6:8], uint16(p.Operation))
  
  	// Marshal variable length data at correct offset using lengths
  	// defined in p
  
  	n := 8
  	hal := int(p.HardwareAddrLength)
  	pl := int(p.IPLength)
  
  	copy(b[n:n+hal], p.SenderHardwareAddr)
  	n += hal
  
  	copy(b[n:n+pl], p.SenderIP)
  	n += pl
  
  	copy(b[n:n+hal], p.TargetHardwareAddr)
  	n += hal
  
  	copy(b[n:n+pl], p.TargetIP)
  
  	return b, nil
  }
docs: // MarshalBinary allocates a byte slice containing the data from a Packet.
  //
  // MarshalBinary never returns an error.