Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170697
b: refs/heads/master
c: f14001f
h: refs/heads/master
i:
  170695: 27f3d42
v: v3
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Oct 14, 2009
1 parent b270ef1 commit b914077
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 67ca0e5fa884f483d655ef19f22ad8509138dd3e
refs/heads/master: f14001fcd7bd03983c872810a3b11af4148bae72
1 change: 1 addition & 0 deletions trunk/include/net/phonet/phonet.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static inline struct pn_sock *pn_sk(struct sock *sk)
extern const struct proto_ops phonet_dgram_ops;

struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa);
void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb);
void phonet_get_local_port_range(int *min, int *max);
void pn_sock_hash(struct sock *sk);
void pn_sock_unhash(struct sock *sk);
Expand Down
6 changes: 6 additions & 0 deletions trunk/net/phonet/af_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,

pn_skb_get_dst_sockaddr(skb, &sa);

/* check if this is broadcasted */
if (pn_sockaddr_get_addr(&sa) == PNADDR_BROADCAST) {
pn_deliver_sock_broadcast(net, skb);
goto out;
}

/* check if we are the destination */
if (phonet_address_lookup(net, pn_sockaddr_get_addr(&sa)) == 0) {
/* Phonet packet input */
Expand Down
21 changes: 21 additions & 0 deletions trunk/net/phonet/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b914077

Please sign in to comment.