From a8c73197daae6f952b2f0edcc85e4bcf63dd38ee Mon Sep 17 00:00:00 2001 From: Stanislav Motylkov Date: Fri, 1 Oct 2021 20:02:09 +0300 Subject: [PATCH] net: Early initialize winpcap library This fixes problem when xemu is started with command-line parameters specifying pcap bridged network backend and NPF interface identifier. --- net/pcap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/pcap.c b/net/pcap.c index 121f8ae07a..44a0317989 100644 --- a/net/pcap.c +++ b/net/pcap.c @@ -141,6 +141,13 @@ int net_init_pcap(const Netdev *netdev, const char *name, NetClientState *peer, const int promisc = 1; int status; +#ifdef WIN32 + if (pcap_load_library()) { + error_setg(errp, "failed to load winpcap library"); + return -1; + } +#endif + pcap_t *p = pcap_open_live(pcap_opts->ifname, 65536, promisc, 1, err); if (p == NULL) { error_setg(errp, "failed to open interface '%s' for capture: %s",