diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-10-15 11:44:44 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-10-26 12:26:50 -0400 |
commit | 31ca61a8dffa5c7171d00cfa40a2845e190863c0 (patch) | |
tree | d2a1bf33e53f7225edcc72eab8f36dc1b6b79606 /net/nfc/llcp/sock.c | |
parent | 968272bf0087b9a4e19e876fddccd162da0390a8 (diff) |
NFC: Forward LLCP datagrams to userspace
With connection less PDUs we have to send the SSAP and DSAP as well.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r-- | net/nfc/llcp/sock.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index debc54aa8a41..d511a4c2fef6 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c | |||
@@ -663,11 +663,28 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
663 | return -EFAULT; | 663 | return -EFAULT; |
664 | } | 664 | } |
665 | 665 | ||
666 | if (sk->sk_type == SOCK_DGRAM && msg->msg_name) { | ||
667 | struct nfc_llcp_ui_cb *ui_cb = nfc_llcp_ui_skb_cb(skb); | ||
668 | struct sockaddr_nfc_llcp sockaddr; | ||
669 | |||
670 | pr_debug("Datagram socket %d %d\n", ui_cb->dsap, ui_cb->ssap); | ||
671 | |||
672 | sockaddr.sa_family = AF_NFC; | ||
673 | sockaddr.nfc_protocol = NFC_PROTO_NFC_DEP; | ||
674 | sockaddr.dsap = ui_cb->dsap; | ||
675 | sockaddr.ssap = ui_cb->ssap; | ||
676 | |||
677 | memcpy(msg->msg_name, &sockaddr, sizeof(sockaddr)); | ||
678 | msg->msg_namelen = sizeof(sockaddr); | ||
679 | } | ||
680 | |||
666 | /* Mark read part of skb as used */ | 681 | /* Mark read part of skb as used */ |
667 | if (!(flags & MSG_PEEK)) { | 682 | if (!(flags & MSG_PEEK)) { |
668 | 683 | ||
669 | /* SOCK_STREAM: re-queue skb if it contains unreceived data */ | 684 | /* SOCK_STREAM: re-queue skb if it contains unreceived data */ |
670 | if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_RAW) { | 685 | if (sk->sk_type == SOCK_STREAM || |
686 | sk->sk_type == SOCK_DGRAM || | ||
687 | sk->sk_type == SOCK_RAW) { | ||
671 | skb_pull(skb, copied); | 688 | skb_pull(skb, copied); |
672 | if (skb->len) { | 689 | if (skb->len) { |
673 | skb_queue_head(&sk->sk_receive_queue, skb); | 690 | skb_queue_head(&sk->sk_receive_queue, skb); |