[intel_app] fix missing freelist

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
intel10g: Fix to avoid multicast traffic looping back to sender.

If multicast traffic is returned to sender it triggers IPv6 Duplicate
Address Detection (in Linux) and prevents traffic from being sent.

Fixed by clearing the LLE (Local Loopback Enable) bit of register
PFVMTXSW (PF VM Tx Switch Loopback Enable).

Relevant note in the 82599 datasheet on page 161:

    A VM might be set to receive it’s own traffic in case the source and
    the destination are in the same pool via the PFVMTXSW.LLE.
Merge pull request #168 from lukego/intel_no_loopback

intel10g: Fix to avoid multicast traffic looping back to sender.
add external flags
[datagram] fix missing ffi library

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[packet] fix clone()

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[datagram] fix creating datagram without packet

When creating empty datagram add a single iovec with an empty buffer.
Also ensure the _parse stack is initialised.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[datagram] fix payload setting

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[lib] Add random_data()

A new function for generating a random binary string with a specified length.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[lib] add deepcopy()

deepcopy implementation from http://lua-users.org/wiki/CopyTable, with added
naive ctype support. C pointers are not properly copied.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[packet] report returnis string, instread of printing it

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[packet] add scatter()

Add a packet function that does the opposite of the coalescse.
It take a packet and returnes a 'scattered' clone of it.
The second argument is a scatter pattern list. It has the form
{ {len, offset}, {len, offset} ... }

An example invocation:

scattered = packet.scatter(p, {{10}, {100, 20}}

This will create a new packet with the following iovec layout:
 - 10 bytes at offset 0
 - 100 bytes starting at offset 20
 - the rest starting at offset 0

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] header add eq()

Add a method for raw bit-to-bit comapring of header data. This can be overriden
in the ancestors, for more fine comparing (specific flags etc.)

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] ipv6 add version() dscp() ecn()

dscp and ecn are subfields of the traffic class, should be able to set/get
separetely.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] add ipv4 support

Add IPv4 support in the protocol library.
This version does not support IPv4 header options (rarely used)

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] udp support

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] tcp support

The optional URG pointer and TCP options are nto supported.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[apps] add fuzz app

The generation is done in 2 phases:
 - payload generation - stacking Raw data, Ethernet, IPv4, IPv6,
   TCP and UDP protocol layers
 - scatter the data to predefined iovec layouts

Each packet is marked at its payload end with a unique number. Upon
receiving this number is used to find the originating match. Their
parsed headers are then compared and verified.

NOTE: This implies that the the packets are received assembled if
any fragmentation was used. So GSO should be enabled on both TX/RX.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[virtio] performance optimize guest map

When mapping addresses from the guest, do not use ipairs.
They seem to be slow, as is said in this link:
http://lua-users.org/lists/lua-l/2011-05/msg00007.html

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[memory] cache virtual to physical page translation

For better performance cache the results of virtual to physical page
address translation and reuse them later. This saves system calls later.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>