6lowpan: set 6lowpan network and transport header

This is necessary for upcomming patches to calculate the 6lowpan header.
It's a little bit tricky here because a UDP transport header can be
compressed in the network header, so the UDP header is merged in the
6lowpan header. In this case the transport header points to the payload
of the UDP header.

For now it's okay to make it in this way, because we use this to calculate
the 6lowpan header size only.
6lowpan: remove unnecessary ret variable
6lowpan: use netdev_alloc_skb instead dev_alloc_skb

This patch uses the netdev_alloc_skb instead dev_alloc_skb function.
Also dropping the assign to skb->dev to netdev.
6lowpan: remove unnecessary check on err >= 0
6lowpan: cleanup skb copy data

This patch drops the directly memcpy on skb and uses the right skb
memcpy functions. Also remove an unnecessary check if plen is non zero.
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: remove unecessary set of headers

On receiving side we don't need to set any headers in skb. The deliver
function delivers the skb to ipv6 handler and the ipv6 handler will set
these headers.
6lowpan: remove lowpan_skb_deliver func

Since we drop the skb copies, we don't need this function.
6lowpan: remove skb->dev assign

This patch removes the assign of skb->dev. We don't need it here because
we use a netdev_alloc_skb... function.
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: add match for address

Currently we match fragmentation frames only on his tagid. This patch
adds support to match also on source and destination address.
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>
6lowpan: clean lowpan netdev setup

This patch replaces a redundant open-coded calculation
with the already defined MAC802154_FRAME_HARD_HEADER_LEN.

Also replace a magic number with the already defined
IEEE802154_MFR_SIZE.

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 destination
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 byte order
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>