Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351462
b: refs/heads/master
c: 0c44621
h: refs/heads/master
v: v3
  • Loading branch information
Alan Ott authored and David S. Miller committed Jan 18, 2013
1 parent 7d96224 commit f815451
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 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: baa70a5c48a01ea02e32270eb96eb19bd3b76667
refs/heads/master: 0c446212c4f68e51ba03a9b172599437d6660a9d
38 changes: 24 additions & 14 deletions trunk/net/ieee802154/6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,32 @@ static int lowpan_header_create(struct sk_buff *skb,
}
}

static int lowpan_give_skb_to_devices(struct sk_buff *skb)
{
struct lowpan_dev_record *entry;
struct sk_buff *skb_cp;
int stat = NET_RX_SUCCESS;

rcu_read_lock();
list_for_each_entry_rcu(entry, &lowpan_devices, list)
if (lowpan_dev_info(entry->ldev)->real_dev == skb->dev) {
skb_cp = skb_copy(skb, GFP_ATOMIC);
if (!skb_cp) {
stat = -ENOMEM;
break;
}

skb_cp->dev = entry->ldev;
stat = netif_rx(skb_cp);
}
rcu_read_unlock();

return stat;
}

static int lowpan_skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr)
{
struct sk_buff *new;
struct lowpan_dev_record *entry;
int stat = NET_RX_SUCCESS;

new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb),
Expand All @@ -614,19 +636,7 @@ static int lowpan_skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr)
new->protocol = htons(ETH_P_IPV6);
new->pkt_type = PACKET_HOST;

rcu_read_lock();
list_for_each_entry_rcu(entry, &lowpan_devices, list)
if (lowpan_dev_info(entry->ldev)->real_dev == new->dev) {
skb = skb_copy(new, GFP_ATOMIC);
if (!skb) {
stat = -ENOMEM;
break;
}

skb->dev = entry->ldev;
stat = netif_rx(skb);
}
rcu_read_unlock();
stat = lowpan_give_skb_to_devices(new);

kfree_skb(new);

Expand Down

0 comments on commit f815451

Please sign in to comment.