summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorStephen Röttger <stephen.roettger@zero-entropy.de>2013-03-26 12:41:29 +0000
committerDavid S. Miller <davem@davemloft.net>2013-03-27 00:52:06 -0400
commit6364e6ee788ae60f1c2de5c59e39adb157327e6c (patch)
tree93c47db3c7df64e46d5db181390b476a4a156fb9 /net
parent5abb0029c8df0312c6095e7a336d2b80ea358e77 (diff)
downloadlinux-3.10-6364e6ee788ae60f1c2de5c59e39adb157327e6c.tar.gz
linux-3.10-6364e6ee788ae60f1c2de5c59e39adb157327e6c.tar.bz2
linux-3.10-6364e6ee788ae60f1c2de5c59e39adb157327e6c.zip
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')
-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 e0da175f8e5..581a59504bd 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,
size_t copied = 0;
int err = -EOPNOTSUPP;
struct sk_buff *skb;
+ struct sockaddr_ieee802154 *saddr;
+
+ saddr = (struct sockaddr_ieee802154 *)msg->msg_name;
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (!skb)
@@ -309,6 +312,13 @@ static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk,
sock_recv_ts_and_drops(msg, sk, skb);
+ if (saddr) {
+ saddr->family = AF_IEEE802154;
+ saddr->addr = mac_cb(skb)->sa;
+ }
+ if (addr_len)
+ *addr_len = sizeof(*saddr);
+
if (flags & MSG_TRUNC)
copied = skb->len;
done: