diff options
-rw-r--r-- | include/net/phonet/phonet.h | 1 | ||||
-rw-r--r-- | net/phonet/af_phonet.c | 19 | ||||
-rw-r--r-- | net/phonet/socket.c | 4 |
3 files changed, 17 insertions, 7 deletions
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h index 5395e09187df..68e509750caa 100644 --- a/include/net/phonet/phonet.h +++ b/include/net/phonet/phonet.h | |||
@@ -36,6 +36,7 @@ | |||
36 | struct pn_sock { | 36 | struct pn_sock { |
37 | struct sock sk; | 37 | struct sock sk; |
38 | u16 sobject; | 38 | u16 sobject; |
39 | u16 dobject; | ||
39 | u8 resource; | 40 | u8 resource; |
40 | }; | 41 | }; |
41 | 42 | ||
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index 1072b2c19d31..30cc676c35fd 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -110,6 +110,7 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol, | |||
110 | sk->sk_protocol = protocol; | 110 | sk->sk_protocol = protocol; |
111 | pn = pn_sk(sk); | 111 | pn = pn_sk(sk); |
112 | pn->sobject = 0; | 112 | pn->sobject = 0; |
113 | pn->dobject = 0; | ||
113 | pn->resource = 0; | 114 | pn->resource = 0; |
114 | sk->sk_prot->init(sk); | 115 | sk->sk_prot->init(sk); |
115 | err = 0; | 116 | err = 0; |
@@ -242,8 +243,18 @@ int pn_skb_send(struct sock *sk, struct sk_buff *skb, | |||
242 | struct net_device *dev; | 243 | struct net_device *dev; |
243 | struct pn_sock *pn = pn_sk(sk); | 244 | struct pn_sock *pn = pn_sk(sk); |
244 | int err; | 245 | int err; |
245 | u16 src; | 246 | u16 src, dst; |
246 | u8 daddr = pn_sockaddr_get_addr(target), saddr = PN_NO_ADDR; | 247 | u8 daddr, saddr, res; |
248 | |||
249 | src = pn->sobject; | ||
250 | if (target != NULL) { | ||
251 | dst = pn_sockaddr_get_object(target); | ||
252 | res = pn_sockaddr_get_resource(target); | ||
253 | } else { | ||
254 | dst = pn->dobject; | ||
255 | res = pn->resource; | ||
256 | } | ||
257 | daddr = pn_addr(dst); | ||
247 | 258 | ||
248 | err = -EHOSTUNREACH; | 259 | err = -EHOSTUNREACH; |
249 | if (sk->sk_bound_dev_if) | 260 | if (sk->sk_bound_dev_if) |
@@ -271,12 +282,10 @@ int pn_skb_send(struct sock *sk, struct sk_buff *skb, | |||
271 | if (saddr == PN_NO_ADDR) | 282 | if (saddr == PN_NO_ADDR) |
272 | goto drop; | 283 | goto drop; |
273 | 284 | ||
274 | src = pn->sobject; | ||
275 | if (!pn_addr(src)) | 285 | if (!pn_addr(src)) |
276 | src = pn_object(saddr, pn_obj(src)); | 286 | src = pn_object(saddr, pn_obj(src)); |
277 | 287 | ||
278 | err = pn_send(skb, dev, pn_sockaddr_get_object(target), | 288 | err = pn_send(skb, dev, dst, src, res, 0); |
279 | src, pn_sockaddr_get_resource(target), 0); | ||
280 | dev_put(dev); | 289 | dev_put(dev); |
281 | return err; | 290 | return err; |
282 | 291 | ||
diff --git a/net/phonet/socket.c b/net/phonet/socket.c index ceb5143f5ef9..65a03338769e 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c | |||
@@ -633,8 +633,8 @@ static int pn_sock_seq_show(struct seq_file *seq, void *v) | |||
633 | 633 | ||
634 | seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu " | 634 | seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu " |
635 | "%d %p %d%n", | 635 | "%d %p %d%n", |
636 | sk->sk_protocol, pn->sobject, 0, pn->resource, | 636 | sk->sk_protocol, pn->sobject, pn->dobject, |
637 | sk->sk_state, | 637 | pn->resource, sk->sk_state, |
638 | sk_wmem_alloc_get(sk), sk_rmem_alloc_get(sk), | 638 | sk_wmem_alloc_get(sk), sk_rmem_alloc_get(sk), |
639 | sock_i_uid(sk), sock_i_ino(sk), | 639 | sock_i_uid(sk), sock_i_ino(sk), |
640 | atomic_read(&sk->sk_refcnt), sk, | 640 | atomic_read(&sk->sk_refcnt), sk, |