[patch] tcpdump/libpcap pcap_platform_finddevs broken
|Reported by:||mjw||Owned by:||axeld|
|Component:||Network & Internet/Stack||Version:||R1/pre-alpha1|
|Has a Patch:||no||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.