From 49fc395f363ca02105cf03479e62e2c5d40fc90d Mon Sep 17 00:00:00 2001 From: "remi.denis-courmont@nokia" Date: Fri, 23 Jan 2009 03:00:26 +0000 Subject: [PATCH] --- yaml --- r: 133909 b: refs/heads/master c: 4b8f704bea70a2c8719e47f53197678a87a0c62f h: refs/heads/master i: 133907: b6ef06cd340eecd1ed0973ca7b525df7e3023041 v: v3 --- [refs] | 2 +- trunk/net/phonet/af_phonet.c | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index 6f0538b7eefa..ed974c53892a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5075138d67ac66adab777163907d92d1a955ff50 +refs/heads/master: 4b8f704bea70a2c8719e47f53197678a87a0c62f diff --git a/trunk/net/phonet/af_phonet.c b/trunk/net/phonet/af_phonet.c index 13cb323f8c38..c7c39d92ee5e 100644 --- a/trunk/net/phonet/af_phonet.c +++ b/trunk/net/phonet/af_phonet.c @@ -275,8 +275,6 @@ static inline int can_respond(struct sk_buff *skb) return 0; ph = pn_hdr(skb); - if (phonet_address_get(skb->dev, ph->pn_rdev) != ph->pn_rdev) - return 0; /* we are not the destination */ if (ph->pn_res == PN_PREFIX && !pskb_may_pull(skb, 5)) return 0; if (ph->pn_res == PN_COMMGR) /* indications */ @@ -344,8 +342,8 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pkttype, struct net_device *orig_dev) { + struct net *net = dev_net(dev); struct phonethdr *ph; - struct sock *sk; struct sockaddr_pn sa; u16 len; @@ -364,21 +362,21 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev, skb_reset_transport_header(skb); pn_skb_get_dst_sockaddr(skb, &sa); - if (pn_sockaddr_get_addr(&sa) == 0) - goto out; /* currently, we cannot be device 0 */ - sk = pn_find_sock_by_sa(dev_net(dev), &sa); - if (sk == NULL) { + /* check if we are the destination */ + if (phonet_address_lookup(net, pn_sockaddr_get_addr(&sa)) == 0) { + /* Phonet packet input */ + struct sock *sk = pn_find_sock_by_sa(net, &sa); + + if (sk) + return sk_receive_skb(sk, skb, 0); + if (can_respond(skb)) { send_obj_unreachable(skb); send_reset_indications(skb); } - goto out; } - /* Push data to the socket (or other sockets connected to it). */ - return sk_receive_skb(sk, skb, 0); - out: kfree_skb(skb); return NET_RX_DROP;