appneta / tcpreplay

Pcap editing and replay tools for *NIX and Windows - Users please download source from
http://tcpreplay.appneta.com/wiki/installation.html#downloads
1.18k stars 268 forks source link

[Bug] incorrect use of pcap_lib_version() in the configure scripts #750

Closed infrastation closed 1 year ago

infrastation commented 2 years ago

The file configure.ac includes three test programs for libpcap, each of which includes at least one test of the following form:

#define PCAP_TEST "0.7.2"

if (strncmp(pcap_lib_version(), PCAP_TEST, 3) >= 0)

Please note that in modern versions of libpcap the value returned from pcap_lib_version() is not just the version, but a loosely formatted string that depends on the underlying module, such as libpcap version 1.11.0-PRE-GIT (with TPACKET_V3), so the test needs to be different to work correctly for all cases (I do not have an immediate idea what in particular would work best).

fklassen commented 1 year ago

Only checking the first few characters. The above will find that string "1.11" is greater than "0.7.2", and therefore it works.

I'll grant you that the test could be updated to test first character is > "0" to make this easier to read.

fklassen commented 1 year ago

Fixed in PR #764 for version 4.4.3

infrastation commented 1 year ago

Thank you for looking into this. Please note that the first three characters of the string libpcap version 1.11.0-PRE-GIT (with TPACKET_V3) are lib, not 1.11 or 1.1.

fklassen commented 1 year ago

Did more testing, and your comment is correct. Reopening.

fklassen commented 1 year ago

Better detection of libpcap version detection in PR #766 including detecting the correct copy of libpcap.

infrastation commented 1 year ago

Thank you!