LibPCAP is needed just for Ethernet transport. Someone can use it also in IP transport but it has no benefits now.
Some user also reported difficulties building against libpcap. This was caused because we don't use pcap-config to determine link time dependencies.
We can make it optional same as net-snmp.
Agreed. This dependency is also an obstacle for people building ptpd on minimal platforms.
Attached is a patch against r462 of the trunk with pcap as an optional dependency. I also made a minor update to use absolute paths with --with-pcap-config and --with-net-snmp-config in configure.
I tested with the following build and runtime configurations on Ubuntu 12.04 with libpcap installed, and RHEL 6.5 with and without libpcap installed.
./configure
./configure --disable-pcap (with libpcap installed)
./configure (without libpcap installed)
./ptpd2 (default ipv4)
./ptpd2 --ptpengine:use_libpcap=1 (ipv4 using libpcap)
./ptpd2 --ptpengine:ethernet (ethernet using libpcap)
Please try it and let me know whether this can be applied to the trunk.
Looks good at first glance Iñaqui, I think we needed this. Let's see what others say.
At the same time I retract my previous comment - on low latency 10G NICs the use of libpcap gives very good results vs. software timestamping. To my great surprise on Mellanox 10GE NICs on RHEL 6.5 I managed to remove nearly 10us of accuracy penalty resulting from TX vs. RX timestamp asymmetry normally introduced by looping the packets.
In svn already. Committed Inaqui's patch with some changes to the autoconf part: