summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2013-04-25 13:03:02 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-05-02 10:02:53 +0200
commit65a9f06870d14d77b81115955e6df81f9c7593e0 (patch)
treece70329500470ed57a51ff4e5ae936ce940a268a /tools
parent551e7ee82c7ca39df879fc8d1fe7498e0d8ca329 (diff)
downloadneard-65a9f06870d14d77b81115955e6df81f9c7593e0.tar.gz
neard-65a9f06870d14d77b81115955e6df81f9c7593e0.tar.bz2
neard-65a9f06870d14d77b81115955e6df81f9c7593e0.zip
nfctool: sniffer: ssap and dsap were displayed switched
In the LLCP header of a received frame, dsap is the local port and ssap is the remote port. ssap and dsap fields of the sniffer_packet structure have been renamed to local_sap and remote_sap to avoid confusion.
Diffstat (limited to 'tools')
-rw-r--r--tools/nfctool/llcp-decode.c12
-rw-r--r--tools/nfctool/sniffer.h4
2 files changed, 11 insertions, 5 deletions
diff --git a/tools/nfctool/llcp-decode.c b/tools/nfctool/llcp-decode.c
index 6247fe9..7cadd0f 100644
--- a/tools/nfctool/llcp-decode.c
+++ b/tools/nfctool/llcp-decode.c
@@ -243,8 +243,14 @@ static int llcp_decode_packet(guint8 *data, guint32 data_len,
packet->direction = data[1] & 0x01;
/* LLCP header */
- packet->llcp.dsap = (data[2] & 0xFC) >> 2;
- packet->llcp.ssap = data[3] & 0x3F;
+ if (packet->direction == NFC_LLCP_DIRECTION_TX) {
+ packet->llcp.remote_sap = (data[2] & 0xFC) >> 2;
+ packet->llcp.local_sap = data[3] & 0x3F;
+ } else {
+ packet->llcp.remote_sap = data[3] & 0x3F;
+ packet->llcp.local_sap = (data[2] & 0xFC) >> 2;
+ }
+
packet->llcp.ptype = ((data[2] & 0x03) << 2) | ((data[3] & 0xC0) >> 6);
if (packet->llcp.ptype >= ARRAY_SIZE(llcp_ptype_str))
@@ -445,7 +451,7 @@ int llcp_print_pdu(guint8 *data, guint32 data_len, struct timeval *timestamp)
printf("%s nfc%d: local:0x%02x remote:0x%02x",
direction_str, packet.adapter_idx,
- packet.llcp.ssap, packet.llcp.dsap);
+ packet.llcp.local_sap, packet.llcp.remote_sap);
if (opts.show_timestamp != SNIFFER_SHOW_TIMESTAMP_NONE) {
printf(" time: ");
diff --git a/tools/nfctool/sniffer.h b/tools/nfctool/sniffer.h
index fdb6bfc..4de0b3f 100644
--- a/tools/nfctool/sniffer.h
+++ b/tools/nfctool/sniffer.h
@@ -32,8 +32,8 @@ struct sniffer_packet {
struct {
guint8 ptype;
- guint8 ssap;
- guint8 dsap;
+ guint8 local_sap;
+ guint8 remote_sap;
guint8 send_seq;
guint8 recv_seq;