6lowpan: fix fragmentation on sending side

This patch fix the fragmentation on sending side according to rfc4944.

Also add improvement to use the full payload of a PDU which calculate the
nearest divided to 8 payload length for the fragmentation datagram
offset attribute.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: allow to skip bytes in lowpan_fetch_skb

This will add support to skip bytes from skb with the lowpan_fetch_skb
function.

This is necessary for upcomming patches.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: fix fragmentation on receiving side

This patch fixes the fragmentation of receiving 6lowpan packets.
The current fragmentation isn't rfc4944 compatible.

Add support for fragmentation frame match with source and destination
addresses, instead of using tag id of fragmentation header only.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: fix udp nullpointer dereferencing

Sometimes a nullpointer dereferencing occurs because of using a wrong
pointer arithmetic in udp_uncompression.

This patch changes "**(hc06_ptr + 3)" to the right one "*(*hc06_ptr +
3)". Dereferencing like "**(hc06_ptr + 3)" works in a random case only.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: fix udp compress ordering

In case ((ntohs(uh->source) & LOWPAN_NHC_UDP_8BIT_MASK) the order of
uncompression is wrong. It's always first source port then destionation
port as second.

See:
http://tools.ietf.org/html/rfc6282#section-4.3.3

"Fields carried in-line (in part or in whole) appear in the same order
as they do in the UDP header format"

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: fix udp byte ordering

The incoming udp header in lowpan_compress_udp_header function is
already in network byte order.

Everytime we read this values for source and destination port we need
to convert this value to host byte order.

In the outcoming header we need to set this value in network byteorder
which the upcoming process assumes.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: add udp warning for elided checksum

Bit 5 of "UDP LOWPAN_NHC Format" indicate that the checksum can be elided.
The host need to calculate the udp checksum afterwards but this isn't
supported right now.

See:
http://tools.ietf.org/html/rfc6282#section-4.3.3
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: udp use lowpan_fetch_skb function

Cleanup the lowpan_uncompress_udp_header function to use the
lowpan_fetch_skb function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: udp use subtraction on both conditions

Cleanup code to handle both calculation in the same way.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: udp remove unecessary break

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: fix fragmentation race condition

If the timer expire on fragmentation handling we need to hold the
flist_lock spinlock while accessing fraglist.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: use try_to_del_timer_sync instead del_timer_sync

This is a race condition fix if the timer expire occurs when the last
frame is arrived otherwise we cleanup the list entry twice.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>