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 indent
6lowpan: remove several copies of sk_buff

The current implementation does many copies of the sk_buff for
increasing headroom which are not necessary.

This patch increases the headroom in the maclayer for a worst case
scenario of (sizeof(struct ipv6hdr) + sizeof(struct udphdr)).

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: set and use mac_len for mac header length

Set the mac header length while creating the 802.15.4 mac header.

Drop the function for recalculate mac header length in upper layers
which was static and works for intra pan communication only.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
6lowpan: set 6lowpan network and transport header
6lowpan: remove unnecessary ret variable
6lowpan: use netdev_alloc_skb instead dev_alloc_skb
6lowpan: remove unnecessary check on err >= 0
6lowpan: cleanup skb copy data
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 setting of header
6lowpan: remove lowpan_skb_deliver func
6lowpan: remove skb->dev assign
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
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>