Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315383
b: refs/heads/master
c: 5e96855
h: refs/heads/master
i:
  315381: e59ba14
  315379: fb6083d
  315375: d4e257e
v: v3
  • Loading branch information
Tony Cheneau authored and David S. Miller committed Jul 17, 2012
1 parent 78ce1e9 commit da8fc19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4576039ffc04ffe672081159a11cf6e0b875a069
refs/heads/master: 5e96855fc505082389813afcf796d4c46301d4fe
20 changes: 12 additions & 8 deletions trunk/net/ieee802154/6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ static void lowpan_fragment_timer_expired(unsigned long entry_addr)
}

static struct lowpan_fragment *
lowpan_alloc_new_frame(struct sk_buff *skb, u8 iphc0, u8 len, u16 tag)
lowpan_alloc_new_frame(struct sk_buff *skb, u8 len, u16 tag)
{
struct lowpan_fragment *frame;

Expand All @@ -656,7 +656,7 @@ lowpan_alloc_new_frame(struct sk_buff *skb, u8 iphc0, u8 len, u16 tag)

INIT_LIST_HEAD(&frame->list);

frame->length = (iphc0 & 7) | (len << 3);
frame->length = len;
frame->tag = tag;

/* allocate buffer for frame assembling */
Expand Down Expand Up @@ -714,14 +714,18 @@ lowpan_process_data(struct sk_buff *skb)
case LOWPAN_DISPATCH_FRAGN:
{
struct lowpan_fragment *frame;
u8 len, offset;
u16 tag;
/* slen stores the rightmost 8 bits of the 11 bits length */
u8 slen, offset;
u16 len, tag;
bool found = false;

if (lowpan_fetch_skb_u8(skb, &len) || /* frame length */
if (lowpan_fetch_skb_u8(skb, &slen) || /* frame length */
lowpan_fetch_skb_u16(skb, &tag)) /* fragment tag */
goto drop;

/* adds the 3 MSB to the 8 LSB to retrieve the 11 bits length */
len = ((iphc0 & 7) << 8) | slen;

/*
* check if frame assembling with the same tag is
* already in progress
Expand All @@ -736,7 +740,7 @@ lowpan_process_data(struct sk_buff *skb)

/* alloc new frame structure */
if (!found) {
frame = lowpan_alloc_new_frame(skb, iphc0, len, tag);
frame = lowpan_alloc_new_frame(skb, len, tag);
if (!frame)
goto unlock_and_drop;
}
Expand Down Expand Up @@ -1004,8 +1008,8 @@ lowpan_skb_fragmentation(struct sk_buff *skb)
tag = fragment_tag++;

/* first fragment header */
head[0] = LOWPAN_DISPATCH_FRAG1 | (payload_length & 0x7);
head[1] = (payload_length >> 3) & 0xff;
head[0] = LOWPAN_DISPATCH_FRAG1 | ((payload_length >> 8) & 0x7);
head[1] = payload_length & 0xff;
head[2] = tag >> 8;
head[3] = tag & 0xff;

Expand Down

0 comments on commit da8fc19

Please sign in to comment.