From b91bb552062fd706a198663a288d136ac63b7074 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 10 Aug 2014 12:25:20 -0700 Subject: [PATCH] monitor: Use packet buffer of 16 kilobytes to allow large frames --- monitor/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/monitor/main.c b/monitor/main.c index 83314176..66faabad 100644 --- a/monitor/main.c +++ b/monitor/main.c @@ -142,12 +142,18 @@ static struct l_netlink *genl_lookup(const char *ifname) static int process_pcap(struct pcap *pcap) { struct nlmon *nlmon = NULL; - uint8_t buf[8192]; + uint8_t *buf; uint32_t len; + buf = malloc(1024 * 16); + if (!buf) { + fprintf(stderr, "Failed to allocate packet buffer\n"); + return EXIT_FAILURE; + } + nlmon = nlmon_create(); - while (pcap_read(pcap, NULL, buf, sizeof(buf), &len)) { + while (pcap_read(pcap, NULL, buf, 1024 * 16, &len)) { uint16_t arphrd_type; uint16_t proto_type; @@ -178,6 +184,8 @@ static int process_pcap(struct pcap *pcap) nlmon_destroy(nlmon); + free(buf); + return EXIT_SUCCESS; }