aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorStephen Röttger <stephen.roettger@zero-entropy.de>2013-03-26 08:41:29 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-27 00:52:06 -0400
commit6364e6ee788ae60f1c2de5c59e39adb157327e6c (patch)
tree93c47db3c7df64e46d5db181390b476a4a156fb9 /net/ieee802154
parent5abb0029c8df0312c6095e7a336d2b80ea358e77 (diff)
ieee802154/dgram: Pass source address in dgram_recvmsg
This patch lets dgram_recvmsg fill in the sockaddr struct in msg->msg_name with the source address of the packet. This is used by the userland functions recvmsg and recvfrom to get the senders address. [Stefan: Changed from old zigbee legacy tree to mainline] Signed-off-by: Stephen Röttger <stephen.roettger@zero-entropy.de> Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/dgram.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
index e0da175f8e5b..581a59504bd5 100644
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -291,6 +291,9 @@ static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk,
291 size_t copied = 0; 291 size_t copied = 0;
292 int err = -EOPNOTSUPP; 292 int err = -EOPNOTSUPP;
293 struct sk_buff *skb; 293 struct sk_buff *skb;
294 struct sockaddr_ieee802154 *saddr;
295
296 saddr = (struct sockaddr_ieee802154 *)msg->msg_name;
294 297
295 skb = skb_recv_datagram(sk, flags, noblock, &err); 298 skb = skb_recv_datagram(sk, flags, noblock, &err);
296 if (!skb) 299 if (!skb)
@@ -309,6 +312,13 @@ static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk,
309 312
310 sock_recv_ts_and_drops(msg, sk, skb); 313 sock_recv_ts_and_drops(msg, sk, skb);
311 314
315 if (saddr) {
316 saddr->family = AF_IEEE802154;
317 saddr->addr = mac_cb(skb)->sa;
318 }
319 if (addr_len)
320 *addr_len = sizeof(*saddr);
321
312 if (flags & MSG_TRUNC) 322 if (flags & MSG_TRUNC)
313 copied = skb->len; 323 copied = skb->len;
314done: 324done: