diff options
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/llcp/llcp.c | 38 | ||||
-rw-r--r-- | net/nfc/llcp/llcp.h | 7 |
2 files changed, 45 insertions, 0 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c index 7f92a857b319..a2da0a4f367d 100644 --- a/net/nfc/llcp/llcp.c +++ b/net/nfc/llcp/llcp.c | |||
@@ -720,6 +720,39 @@ static u8 *nfc_llcp_connect_sn(struct sk_buff *skb, size_t *sn_len) | |||
720 | return NULL; | 720 | return NULL; |
721 | } | 721 | } |
722 | 722 | ||
723 | static void nfc_llcp_recv_ui(struct nfc_llcp_local *local, | ||
724 | struct sk_buff *skb) | ||
725 | { | ||
726 | struct nfc_llcp_sock *llcp_sock; | ||
727 | struct nfc_llcp_ui_cb *ui_cb; | ||
728 | u8 dsap, ssap; | ||
729 | |||
730 | dsap = nfc_llcp_dsap(skb); | ||
731 | ssap = nfc_llcp_ssap(skb); | ||
732 | |||
733 | ui_cb = nfc_llcp_ui_skb_cb(skb); | ||
734 | ui_cb->dsap = dsap; | ||
735 | ui_cb->ssap = ssap; | ||
736 | |||
737 | printk("%s %d %d\n", __func__, dsap, ssap); | ||
738 | |||
739 | pr_debug("%d %d\n", dsap, ssap); | ||
740 | |||
741 | /* We're looking for a bound socket, not a client one */ | ||
742 | llcp_sock = nfc_llcp_sock_get(local, dsap, LLCP_SAP_SDP); | ||
743 | if (llcp_sock == NULL || llcp_sock->sk.sk_type != SOCK_DGRAM) | ||
744 | return; | ||
745 | |||
746 | /* There is no sequence with UI frames */ | ||
747 | skb_pull(skb, LLCP_HEADER_SIZE); | ||
748 | if (sock_queue_rcv_skb(&llcp_sock->sk, skb)) { | ||
749 | pr_err("receive queue is full\n"); | ||
750 | skb_queue_head(&llcp_sock->tx_backlog_queue, skb); | ||
751 | } | ||
752 | |||
753 | nfc_llcp_sock_put(llcp_sock); | ||
754 | } | ||
755 | |||
723 | static void nfc_llcp_recv_connect(struct nfc_llcp_local *local, | 756 | static void nfc_llcp_recv_connect(struct nfc_llcp_local *local, |
724 | struct sk_buff *skb) | 757 | struct sk_buff *skb) |
725 | { | 758 | { |
@@ -1177,6 +1210,11 @@ static void nfc_llcp_rx_work(struct work_struct *work) | |||
1177 | pr_debug("SYMM\n"); | 1210 | pr_debug("SYMM\n"); |
1178 | break; | 1211 | break; |
1179 | 1212 | ||
1213 | case LLCP_PDU_UI: | ||
1214 | pr_debug("UI\n"); | ||
1215 | nfc_llcp_recv_ui(local, skb); | ||
1216 | break; | ||
1217 | |||
1180 | case LLCP_PDU_CONNECT: | 1218 | case LLCP_PDU_CONNECT: |
1181 | pr_debug("CONNECT\n"); | 1219 | pr_debug("CONNECT\n"); |
1182 | nfc_llcp_recv_connect(local, skb); | 1220 | nfc_llcp_recv_connect(local, skb); |
diff --git a/net/nfc/llcp/llcp.h b/net/nfc/llcp/llcp.h index 1c0a66fab570..e06d03571644 100644 --- a/net/nfc/llcp/llcp.h +++ b/net/nfc/llcp/llcp.h | |||
@@ -124,6 +124,13 @@ struct nfc_llcp_sock { | |||
124 | struct sock *parent; | 124 | struct sock *parent; |
125 | }; | 125 | }; |
126 | 126 | ||
127 | struct nfc_llcp_ui_cb { | ||
128 | __u8 dsap; | ||
129 | __u8 ssap; | ||
130 | }; | ||
131 | |||
132 | #define nfc_llcp_ui_skb_cb(__skb) ((struct nfc_llcp_ui_cb *)&((__skb)->cb[0])) | ||
133 | |||
127 | #define nfc_llcp_sock(sk) ((struct nfc_llcp_sock *) (sk)) | 134 | #define nfc_llcp_sock(sk) ((struct nfc_llcp_sock *) (sk)) |
128 | #define nfc_llcp_dev(sk) (nfc_llcp_sock((sk))->dev) | 135 | #define nfc_llcp_dev(sk) (nfc_llcp_sock((sk))->dev) |
129 | 136 | ||