diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2009-10-14 00:48:27 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-14 15:04:15 -0700 |
commit | f14001fcd7bd03983c872810a3b11af4148bae72 (patch) | |
tree | 11b283fe73d751f584d34b684fbfcb077c37f096 /net/phonet/socket.c | |
parent | 67ca0e5fa884f483d655ef19f22ad8509138dd3e (diff) |
Phonet: deliver broadcast packets to broadcast sockets
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet/socket.c')
-rw-r--r-- | net/phonet/socket.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/phonet/socket.c b/net/phonet/socket.c index aa5b5a972bf..8c84190f22d 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c @@ -94,7 +94,28 @@ struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *spn) spin_unlock_bh(&pnsocks.lock); return rval; +} + +/* Deliver a broadcast packet (only in bottom-half) */ +void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb) +{ + struct hlist_node *node; + struct sock *sknode; + + spin_lock(&pnsocks.lock); + sk_for_each(sknode, node, &pnsocks.hlist) { + struct sk_buff *clone; + + if (!net_eq(sock_net(sknode), net)) + continue; + if (!sock_flag(sknode, SOCK_BROADCAST)) + continue; + clone = skb_clone(skb, GFP_ATOMIC); + if (clone) + sk_receive_skb(sknode, clone, 0); + } + spin_unlock(&pnsocks.lock); } void pn_sock_hash(struct sock *sk) |