Re: [dpdk-dev] [PATCH v2 4/6] net/pcap: add libpcap wrappers
From: Dmitry Kozlyuk <hidden>
Date: 2021-02-25 19:04:44
2021-02-25 14:59, Ferruh Yigit:
On 2/14/2021 2:16 AM, Dmitry Kozlyuk wrote:quoted
libpcap headers can expose OS headers. On Windows, system networking headers are incompatible with DPDK ones, causing multiple name clashes. API of libpcap itself involves a non-standard u_char type. Add a limited set of trivial libpcap wrappers, so that libpcap headers are not included directly by OS-independent PMD code. Use EAL types and functions for time instead of POSIX ones.It is not nice to duplicate the pcap struct and macros and have dpdk versions of them, it may have long term maintanance issues too. What are the clashes in question? If they are macros, can the issue solved after undefining some after including 'pcap.h'? And at the end of the day, shouldn't we need to resolve these clashes globally since we may hit same things with other PMDs or libraries as we enable them. I am for a global solution instead of these changes in pcap, but I guess question is how possible that global solution is..
Your comment made me revise Windows EAL networking shims. Surprisingly, if changed to expose Windows networking headers (specifically, <ws2tcpip.h>) with some additions (but no hacks), they create no issues to any existing code. The only workaround remaining is `#undef s_addr` in <rte_ether.h>. So maybe this commit can be dropped, if Windows EAL networking headers be reworked in the following way: #if defined min #define USER_EXPLICITLY_WANTS_WINDOWS_H #endif #include <ws2tcpip.h> /* hide definitions that break portable code, * e.g. it had to be done once already for i40e */ #ifndef USER_EXPLICITLY_WANTS_WINDOWS_H #undef min, max, ... #endif #define what's missing from Windows headers, e.g. IPPROTO_SCTP + Windows maintainers, Nick Connolly, and Jie Zhou to discuss.