monitor: Use packet buffer of 16 kilobytes to allow large frames

This commit is contained in:
Marcel Holtmann 2014-08-10 12:25:20 -07:00
parent 9cdb52a167
commit b91bb55206
1 changed files with 10 additions and 2 deletions

View File

@ -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;
}