diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2010-09-15 08:30:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-16 00:31:33 -0400 |
commit | b6a563b2af4ec5b0363cf89869ba234c0e2cd3da (patch) | |
tree | de4a7c16d3dc1efb93401b1862a94b7777f66523 /net/phonet | |
parent | 7417fa83c1a8b75a03bd9b9b358999f38e771eab (diff) |
Phonet: look up the resource routing table when forwarding
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')
-rw-r--r-- | net/phonet/af_phonet.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index 73aee7f2fcdc..fd95beb72f5d 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -251,6 +251,16 @@ int pn_skb_send(struct sock *sk, struct sk_buff *skb, | |||
251 | else if (phonet_address_lookup(net, daddr) == 0) { | 251 | else if (phonet_address_lookup(net, daddr) == 0) { |
252 | dev = phonet_device_get(net); | 252 | dev = phonet_device_get(net); |
253 | skb->pkt_type = PACKET_LOOPBACK; | 253 | skb->pkt_type = PACKET_LOOPBACK; |
254 | } else if (pn_sockaddr_get_object(target) == 0) { | ||
255 | /* Resource routing (small race until phonet_rcv()) */ | ||
256 | struct sock *sk = pn_find_sock_by_res(net, | ||
257 | target->spn_resource); | ||
258 | if (sk) { | ||
259 | sock_put(sk); | ||
260 | dev = phonet_device_get(net); | ||
261 | skb->pkt_type = PACKET_LOOPBACK; | ||
262 | } else | ||
263 | dev = phonet_route_output(net, daddr); | ||
254 | } else | 264 | } else |
255 | dev = phonet_route_output(net, daddr); | 265 | dev = phonet_route_output(net, daddr); |
256 | 266 | ||
@@ -383,6 +393,13 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev, | |||
383 | goto out; | 393 | goto out; |
384 | } | 394 | } |
385 | 395 | ||
396 | /* resource routing */ | ||
397 | if (pn_sockaddr_get_object(&sa) == 0) { | ||
398 | struct sock *sk = pn_find_sock_by_res(net, sa.spn_resource); | ||
399 | if (sk) | ||
400 | return sk_receive_skb(sk, skb, 0); | ||
401 | } | ||
402 | |||
386 | /* check if we are the destination */ | 403 | /* check if we are the destination */ |
387 | if (phonet_address_lookup(net, pn_sockaddr_get_addr(&sa)) == 0) { | 404 | if (phonet_address_lookup(net, pn_sockaddr_get_addr(&sa)) == 0) { |
388 | /* Phonet packet input */ | 405 | /* Phonet packet input */ |