Discussion:
[uClinux-dev] tcpdump on uClinux run “No such device”
zhou
2015-04-08 02:38:38 UTC
Permalink
tcpdump on uClinux run “No Such device”

kernel linux-3.x uClinux,the target CPU is Cortex R7,

#tcpdump -i any
munmap of memory not mmapped by process 383 (tcpdump): 0xffffffff -0x20bffe
tcpdump: any: can't mmap rx ring: No such device

I check source code,libpcap.a source file Pcap-linux.c function
create_ring() print this error,handle->fd is socket handle.

/* memory map the rx ring */
handle->md.mmapbuflen = req.tp_block_nr * req.tp_block_size;
handle->md.mmapbuf = mmap(0, handle->md.mmapbuflen,
PROT_READ|PROT_WRITE, MAP_SHARED, handle->fd, 0);
if (handle->md.mmapbuf == MAP_FAILED) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"can't mmap rx ring: %s", pcap_strerror(errno));

/* clear the allocated ring on error*/
destroy_ring(handle);
return -1;
}

the further reason is mm/nommu.c validate_mmap_request() return -ENODEV in
kernel

if (!(capabilities & BDI_CAP_MAP_DIRECT)
return -ENODEV;

Can tcpdump run on uClinux and how?

PS.
I have configured CONFIG_PACKET=y and CONFIG_PACKET_DIAG=y linux kernel
.config,I can not find CONFIG_PACKET_MMAP

Loading...