diff options
author | Hiren Tandel <hirent@marvell.com> | 2014-05-05 06:52:27 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-05-19 18:23:59 -0400 |
commit | 0515829642c65a4e3c6f44a2209bb426828d26d9 (patch) | |
tree | 7b313e253aa910401221e1bdb6859df074955d97 /net/nfc/nci | |
parent | 57be1f3f3ec1ccab6432615ca161c4c9ece2a2aa (diff) |
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: Hiren Tandel <hirent@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/nci')
-rw-r--r-- | net/nfc/nci/core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 6c34ac978501..2b400e1a8695 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -861,6 +861,10 @@ static int nci_send_frame(struct nci_dev *ndev, struct sk_buff *skb) | |||
861 | /* Get rid of skb owner, prior to sending to the driver. */ | 861 | /* Get rid of skb owner, prior to sending to the driver. */ |
862 | skb_orphan(skb); | 862 | skb_orphan(skb); |
863 | 863 | ||
864 | /* Send copy to sniffer */ | ||
865 | nfc_send_to_raw_sock(ndev->nfc_dev, skb, | ||
866 | RAW_PAYLOAD_NCI, NFC_DIRECTION_TX); | ||
867 | |||
864 | return ndev->ops->send(ndev, skb); | 868 | return ndev->ops->send(ndev, skb); |
865 | } | 869 | } |
866 | 870 | ||
@@ -935,6 +939,11 @@ static void nci_rx_work(struct work_struct *work) | |||
935 | struct sk_buff *skb; | 939 | struct sk_buff *skb; |
936 | 940 | ||
937 | while ((skb = skb_dequeue(&ndev->rx_q))) { | 941 | while ((skb = skb_dequeue(&ndev->rx_q))) { |
942 | |||
943 | /* Send copy to sniffer */ | ||
944 | nfc_send_to_raw_sock(ndev->nfc_dev, skb, | ||
945 | RAW_PAYLOAD_NCI, NFC_DIRECTION_RX); | ||
946 | |||
938 | /* Process frame */ | 947 | /* Process frame */ |
939 | switch (nci_mt(skb->data)) { | 948 | switch (nci_mt(skb->data)) { |
940 | case NCI_MT_RSP_PKT: | 949 | case NCI_MT_RSP_PKT: |