Opened 12 years ago

Closed 12 years ago

#2246 closed bug (fixed)

[patch] tcpdump/libpcap pcap_platform_finddevs broken

Reported by: mjw Owned by: axeld
Priority: normal Milestone: R1
Component: Network & Internet/Stack Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All


pcap_platform_finddevs implementation modifies internal libpcap structures when adding devices to the device list. However, libpcap expects the device list to be ordered in a subtle way: the first device in the list should not be a loopback device.

When tcpdump was run on my machine without any arguments, the loopback device ended up as the first device in the list, which caused tcpdump to exit immediately complaining that there were no suitable devices found.

This patch adds devices to the device list using pcap_add_if() to ensure the device list is suitably ordered. tcpdump can now be executed without any arguments to make it listen on a default device.

I have also added suitable defines to that "tcpdump -D" will now show the list of available devices.

Attachments (1)

pcap.diff (2.1 KB ) - added by mjw 12 years ago.

Download all attachments as: .zip

Change History (2)

by mjw, 12 years ago

Attachment: pcap.diff added

comment:1 by axeld, 12 years ago

Resolution: fixed
Status: newclosed

How could I miss pcap_add_if()? I was already wondering what I was doing back there :-) It definitely worked when I tested it, though; apparently the order of the interfaces might have differed in my configuration. I made some minor changes to your patch, and applied it in hrev25601. Thanks a lot!

Note: See TracTickets for help on using tickets.