fix segfault when fetching a packet by buffer_id

In save_packet(), we store the buffer in packet_in_buffers,
duplicate_buffer() does memory copy for us. Unfortunately,
the content of user_data is a set of pointers which points to
buffer address. So copying the address will point to old buffer,
which will be freed. Fetching by buffer_id and access to
user_data causes segmentation fault.
add copy packet_info that holds packet_parse() result

Instead of discarding invalid data, copy_packet_info() copies
buffer->user_data with fixing the pointer address to new one.
reset_buffer() should reset associated user_data
always reset_buffer() before reusing device recieve buffer.

buffers fetched from device->recv_queue were not reset.
fix typo
Add explicit cast for pointer-arith
fix segfault when fetching a packet by buffer_id

In save_packet(), we store the buffer in packet_in_buffers,
duplicate_buffer() does memory copy for us. Unfortunately,
the content of user_data is a set of pointers which points to
buffer address. So copying the address will point to old buffer,
which will be freed. Fetching by buffer_id and access to
user_data causes segmentation fault.
add copy packet_info that holds packet_parse() result

Instead of discarding invalid data, copy_packet_info() copies
buffer->user_data with fixing the pointer address to new one.
reset_buffer() should reset associated user_data
always reset_buffer() before reusing device recieve buffer.

buffers fetched from device->recv_queue were not reset.
fix typo
Add explicit cast for pointer-arith
Merge branches 'buffer_id_segfault' and 'buffer_id_segfault' of https://github.com/iHiroakiKawai/trema-edge into buffer_id_segfault
fix for pointer-arith warnings
Merge pull request #62 from iHiroakiKawai/buffer_id_segfault

fix segfault when fetching a packet by buffer_id