aboutsummaryrefslogtreecommitdiffstats
path: root/net/phonet/socket.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>2009-10-13 20:48:27 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-14 18:04:15 -0400
commitf14001fcd7bd03983c872810a3b11af4148bae72 (patch)
tree11b283fe73d751f584d34b684fbfcb077c37f096 /net/phonet/socket.c
parent67ca0e5fa884f483d655ef19f22ad8509138dd3e (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.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index aa5b5a972bff..8c84190f22de 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)
94 spin_unlock_bh(&pnsocks.lock); 94 spin_unlock_bh(&pnsocks.lock);
95 95
96 return rval; 96 return rval;
97}
98
99/* Deliver a broadcast packet (only in bottom-half) */
100void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb)
101{
102 struct hlist_node *node;
103 struct sock *sknode;
104
105 spin_lock(&pnsocks.lock);
106 sk_for_each(sknode, node, &pnsocks.hlist) {
107 struct sk_buff *clone;
108
109 if (!net_eq(sock_net(sknode), net))
110 continue;
111 if (!sock_flag(sknode, SOCK_BROADCAST))
112 continue;
97 113
114 clone = skb_clone(skb, GFP_ATOMIC);
115 if (clone)
116 sk_receive_skb(sknode, clone, 0);
117 }
118 spin_unlock(&pnsocks.lock);
98} 119}
99 120
100void pn_sock_hash(struct sock *sk) 121void pn_sock_hash(struct sock *sk)