Skip to content

Commit

Permalink
6lowpan: Make a copy of skb's delivered to 6lowpan
Browse files Browse the repository at this point in the history
Since lowpan_process_data() modifies the skb (by calling skb_pull()), we
need our own copy so that it doesn't affect the data received by other
protcols (in this case, af_ieee802154).

Signed-off-by: Alan Ott <alan@signal11.us>
Signed-off-by: David S. Miller <davem@tempietto.lan>
  • Loading branch information
Alan Ott authored and David S. Miller committed Sep 2, 2012
1 parent 1bed966 commit a437d27
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion net/ieee802154/6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,8 @@ static int lowpan_validate(struct nlattr *tb[], struct nlattr *data[])
static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
{
struct sk_buff *local_skb;

if (!netif_running(dev))
goto drop;

Expand All @@ -1144,7 +1146,12 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
case LOWPAN_DISPATCH_IPHC: /* ipv6 datagram */
case LOWPAN_DISPATCH_FRAG1: /* first fragment header */
case LOWPAN_DISPATCH_FRAGN: /* next fragments headers */
lowpan_process_data(skb);
local_skb = skb_clone(skb, GFP_ATOMIC);
if (!local_skb)
goto drop;
lowpan_process_data(local_skb);

kfree_skb(skb);
break;
default:
break;
Expand Down

0 comments on commit a437d27

Please sign in to comment.