From: Thierry Escande Date: Mon, 8 Apr 2013 16:55:27 +0000 (+0200) Subject: nfctool: Set sniffer buffer large enough to handle MAX_MIU bytes frames X-Git-Tag: 0.11~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=238e9b466758cd0f2b6bc6c9e20262b7b19890a1;p=platform%2Fupstream%2Fneard.git 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. --- 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);