Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183327
b: refs/heads/master
c: 0f7b67d
h: refs/heads/master
i:
  183325: 42dfc07
  183323: 877cab5
  183319: e8b378c
  183311: 226195c
  183295: 762fad2
v: v3
  • Loading branch information
Octavian Purdila authored and David S. Miller committed Dec 27, 2009
1 parent d847fe1 commit 3df31f9
Show file tree
Hide file tree
Showing 2 changed files with 29 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: b76f5a8427ac2928c07fa4ff2144bb8db072c240
refs/heads/master: 0f7b67dd9e1192976f5e5a78934c7a339ff7c45f
36 changes: 28 additions & 8 deletions trunk/net/llc/llc_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,24 @@ static inline bool llc_mcast_match(const struct llc_sap *sap,
llc->dev == skb->dev;
}

static void llc_do_mcast(struct llc_sap *sap, struct sk_buff *skb,
struct sock **stack, int count)
{
struct sk_buff *skb1;
int i;

for (i = 0; i < count; i++) {
skb1 = skb_clone(skb, GFP_ATOMIC);
if (!skb1) {
sock_put(stack[i]);
continue;
}

llc_sap_rcv(sap, skb1, stack[i]);
sock_put(stack[i]);
}
}

/**
* llc_sap_mcast - Deliver multicast PDU's to all matching datagram sockets.
* @sap: SAP
Expand All @@ -367,25 +385,27 @@ static void llc_sap_mcast(struct llc_sap *sap,
const struct llc_addr *laddr,
struct sk_buff *skb)
{
struct sock *sk;
int i = 0, count = 256 / sizeof(struct sock *);
struct sock *sk, *stack[count];
struct hlist_nulls_node *node;

spin_lock_bh(&sap->sk_lock);
sk_nulls_for_each_rcu(sk, node, &sap->sk_list) {
struct sk_buff *skb1;

if (!llc_mcast_match(sap, laddr, skb, sk))
continue;

skb1 = skb_clone(skb, GFP_ATOMIC);
if (!skb1)
break;

sock_hold(sk);
llc_sap_rcv(sap, skb1, sk);
sock_put(sk);
if (i < count)
stack[i++] = sk;
else {
llc_do_mcast(sap, skb, stack, i);
i = 0;
}
}
spin_unlock_bh(&sap->sk_lock);

llc_do_mcast(sap, skb, stack, i);
}


Expand Down

0 comments on commit 3df31f9

Please sign in to comment.