nmap / npcap

Nmap Project's Windows packet capture and transmission library
https://npcap.com
Other
2.97k stars 514 forks source link

Resolve issue of compiling software with Npcap SDK 1.10+ using Visual Studio editions previous to VS 2015 #518

Closed fyodor closed 2 years ago

fyodor commented 3 years ago

The Npcap SDK is the first to use Libpcap 1.10 headers. Those headers impose a requirement on Visual Studio 2015 or later. It appears this was done to Libpcap in 2019 to ensure %zu format string support. We've opened an upstream issue https://github.com/the-tcpdump-group/libpcap/issues/1034 to determine whether this can be moved to an internal libpcap header just to ensure that people compiling Npcap itself have a recent VS (which we do for our Npcap builds of course) or whether it really needs to be imposed on people compiling code which simply links to the libpcap packet.dll included with Npcap. Until we get this resolved, people who MUST use such old versions of Visual Studio can use the Npcap SDK version 1.07 instead. It is available here.

guyharris commented 3 years ago

Does this mean that applications using Npcap will be built with older compilers and possibly deployed on systems without the Universal CRT? If so, is Npcap being statically linked with the C runtime? If not, then it probably needs to be.

Note that libpcap depends on having a C99-compliant snprintf(); I'm not sure when that was introduced in the C library.

This also indicates that libpcap might have to avoid using some C99 features in its API declarations. What's the oldest version of Visual Studio for which you support building applications with Npcap?

fyodor commented 3 years ago

Hi @guyharris. Good questions. Most of our customers haven't updated to Npcap SDK 1.10 yet since we only released it 2 weeks ago, but already one customer told us that they weren't able to upgrade because they use Visual Studio 2012 to compile their application and got 'error C1189: #error : "Building libpcap requires VS 2015 or later"'. They "solved" the issue by downgrading back to Npcap SDK 1.07, but it would be great if 1.10 could work for VS 2012. Obviously it would be better if the users would all upgrade to VS 2019, but that's not under our control. And Microsoft has committed to supporting VS 2012 (just extended support) until January 2023.

dmiller-nmap commented 3 years ago

We can't say libpcap sprang this on us: @guyharris filed #67 over 2 years ago.

Depending on how libpcap decides to go on that upstream issue, we will probably have to declare that certain SDK versions (and therefore access to certain features) will require a mainstream-supported VS. I am reasonably sure that regardless of compiler version, any software will be able to use any Npcap installation. Even ancient Wireshark versions still run fine which were built with the WinPcap SDK (libpcap 1.0.0).

dmiller-nmap commented 2 years ago

Was not aware of it at the time, but pulling in latest libpcap-1.10 branch changes for Npcap 1.55 resulted in the upstream fix for this issue being included in Npcap SDK 1.11. I will clarify the changelog for that release to note that it resolves this issue.