summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2013-04-08 18:55:27 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-11 13:52:48 +0200
commit238e9b466758cd0f2b6bc6c9e20262b7b19890a1 (patch)
tree3bc1a79f85f31135af7960bcaa6bcafcc693aead
parenta823ea893207e4b24c693f6e2bd5921bac87f17b (diff)
downloadneard-238e9b466758cd0f2b6bc6c9e20262b7b19890a1.tar.gz
neard-238e9b466758cd0f2b6bc6c9e20262b7b19890a1.tar.bz2
neard-238e9b466758cd0f2b6bc6c9e20262b7b19890a1.zip
nfctool: Set sniffer buffer large enough to handle MAX_MIU bytes frames
This fixes the size of the recv buffer for the sniffer. Frames can be up to 7ff+128+(llcp, seq, and raw headers) bytes.
-rw-r--r--tools/nfctool/sniffer.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/nfctool/sniffer.c b/tools/nfctool/sniffer.c
index 2e89ddc..062925a 100644
--- a/tools/nfctool/sniffer.c
+++ b/tools/nfctool/sniffer.c
@@ -47,7 +47,7 @@
#define PCAP_SNAP_LEN 0xFFFF
#define PCAP_NETWORK 0xF5
-#define SNAP_LEN 1024
+#define BUFFER_LEN 0x8FF
static GIOChannel *gio_channel = NULL;
guint watch = 0;
@@ -251,7 +251,7 @@ static gboolean gio_handler(GIOChannel *channel,
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
iov.iov_base = buffer;
- iov.iov_len = opts.snap_len;
+ iov.iov_len = BUFFER_LEN;
len = recvmsg(sock, &msg, 0);
if (len < 0) {
@@ -295,10 +295,7 @@ int sniffer_init(void)
int err;
int one = 1;
- if (opts.snap_len < SNAP_LEN)
- opts.snap_len = SNAP_LEN;
-
- buffer = g_malloc(opts.snap_len);
+ buffer = g_malloc(BUFFER_LEN);
sock = socket(AF_NFC, SOCK_RAW, NFC_SOCKPROTO_LLCP);