NFC: Implement LLCP connection less Tx path
authorSamuel Ortiz <sameo@linux.intel.com>
Tue, 16 Oct 2012 13:04:10 +0000 (15:04 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 26 Oct 2012 16:26:51 +0000 (18:26 +0200)
It simply involves getting the client dsap and ssap and calling the UI
frame building and sending routine.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/llcp/sock.c

index d511a4c2fef630a6363a3e0cd7a74f2a9ac9e355..0fa1e92ceac8869f026a8bf2a61724ce102919fe 100644 (file)
@@ -608,6 +608,25 @@ static int llcp_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
 
        lock_sock(sk);
 
+       if (sk->sk_type == SOCK_DGRAM) {
+               struct sockaddr_nfc_llcp *addr =
+                       (struct sockaddr_nfc_llcp *)msg->msg_name;
+
+               if (msg->msg_namelen < sizeof(*addr)) {
+                       release_sock(sk);
+
+                       pr_err("Invalid socket address length %d\n",
+                              msg->msg_namelen);
+
+                       return -EINVAL;
+               }
+
+               release_sock(sk);
+
+               return nfc_llcp_send_ui_frame(llcp_sock, addr->dsap, addr->ssap,
+                                             msg, len);
+       }
+
        if (sk->sk_state != LLCP_CONNECTED) {
                release_sock(sk);
                return -ENOTCONN;