Commit 05158296 authored by Hiren Tandel's avatar Hiren Tandel Committed by Samuel Ortiz

NFC: NCI: Send all NCI frames to raw sockets

So that anyone listening on SOCKPROTO_RAW for raw frames will get all
NCI frames, in both directions. This actually implements userspace NFC
NCI sniffing.
It's now up to userspace to decode those frames.
Signed-off-by: default avatarHiren Tandel <hirent@marvell.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 57be1f3f
...@@ -861,6 +861,10 @@ static int nci_send_frame(struct nci_dev *ndev, struct sk_buff *skb) ...@@ -861,6 +861,10 @@ static int nci_send_frame(struct nci_dev *ndev, struct sk_buff *skb)
/* Get rid of skb owner, prior to sending to the driver. */ /* Get rid of skb owner, prior to sending to the driver. */
skb_orphan(skb); skb_orphan(skb);
/* Send copy to sniffer */
nfc_send_to_raw_sock(ndev->nfc_dev, skb,
RAW_PAYLOAD_NCI, NFC_DIRECTION_TX);
return ndev->ops->send(ndev, skb); return ndev->ops->send(ndev, skb);
} }
...@@ -935,6 +939,11 @@ static void nci_rx_work(struct work_struct *work) ...@@ -935,6 +939,11 @@ static void nci_rx_work(struct work_struct *work)
struct sk_buff *skb; struct sk_buff *skb;
while ((skb = skb_dequeue(&ndev->rx_q))) { while ((skb = skb_dequeue(&ndev->rx_q))) {
/* Send copy to sniffer */
nfc_send_to_raw_sock(ndev->nfc_dev, skb,
RAW_PAYLOAD_NCI, NFC_DIRECTION_RX);
/* Process frame */ /* Process frame */
switch (nci_mt(skb->data)) { switch (nci_mt(skb->data)) {
case NCI_MT_RSP_PKT: case NCI_MT_RSP_PKT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment