mbox series

[0/6] net/pcap: build on Windows

Message ID 20210214012013.23165-1-dmitry.kozliuk@gmail.com (mailing list archive)
Headers show
Series net/pcap: build on Windows | expand

Message

Dmitry Kozlyuk Feb. 14, 2021, 1:20 a.m. UTC
Most modern and actively maintained distribution of libpcap for Windows is Npcap
(https://nmap.org/npcap). It is free (as in "free beer") and open-source, but
Npcap redistribution with commercial products may be limited by its license.

Npcap can be installed anywhere, so a new Meson option is provided to find it:

    meson -Dpcap_sdk=C:\Npcap -Dexamples=skeleton build

Example of collecting packets from an interface to a file:

    .\build\examples\dpdk-skeleton.exe `
        --vdev "eth_pcap0,iface=\Device\NPF_{DDD48985-A77C-4FC9-AF48-61E547C8797E}" `
        --vdev "eth_pcap1,tx_pcap=capture.pcap"

Implementation in "pcap_osdep_windows.c" does some guesswork to convert
between variants of an interface name. Microsoft experts and interested
users, please take a look and/or give it a try in your environment.

There are no release notes for 21.05 yet, will send update after they appear.

Dmitry Kozlyuk (6):
  eal: add internal API for current time
  net/pcap: fix format string
  net/pcap: move OS-dependent code to separate files
  net/pcap: add libpcap wrappers
  config: discover libpcap on Windows
  net/pcap: build on Windows

 config/meson.build                            |  21 +-
 drivers/net/pcap/meson.build                  |  17 +-
 .../pcap/{rte_eth_pcap.c => pcap_ethdev.c}    | 251 ++++++------------
 drivers/net/pcap/pcap_osdep.c                 | 122 +++++++++
 drivers/net/pcap/pcap_osdep.h                 |  72 +++++
 drivers/net/pcap/pcap_osdep_freebsd.c         |  59 ++++
 drivers/net/pcap/pcap_osdep_linux.c           |  42 +++
 drivers/net/pcap/pcap_osdep_windows.c         | 118 ++++++++
 lib/librte_eal/include/rte_time.h             |  17 ++
 lib/librte_eal/rte_eal_exports.def            |   1 +
 lib/librte_eal/unix/eal_unix_timer.c          |  13 +
 lib/librte_eal/version.map                    |   1 +
 lib/librte_eal/windows/eal_timer.c            |  20 +-
 meson_options.txt                             |   6 +-
 14 files changed, 584 insertions(+), 176 deletions(-)
 rename drivers/net/pcap/{rte_eth_pcap.c => pcap_ethdev.c} (88%)
 create mode 100644 drivers/net/pcap/pcap_osdep.c
 create mode 100644 drivers/net/pcap/pcap_osdep.h
 create mode 100644 drivers/net/pcap/pcap_osdep_freebsd.c
 create mode 100644 drivers/net/pcap/pcap_osdep_linux.c
 create mode 100644 drivers/net/pcap/pcap_osdep_windows.c