diff options
Diffstat (limited to 'net/phonet/af_phonet.c')
-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 */ |