From 557d40dcedb90325726e9aa478f6e8280bd8b3f9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 30 Dec 2016 01:03:40 +0100 Subject: [PATCH] Attempt to improve network type detection (and log it). --- src/ne2000.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/ne2000.c b/src/ne2000.c index b8121e9c6..8e840386b 100644 --- a/src/ne2000.c +++ b/src/ne2000.c @@ -1765,16 +1765,15 @@ void *ne2000_init() // net_is_slirp = config_get_int(NULL, "net_type", 1); /* Network type is now specified in device config. */ net_is_slirp = config_net_type ? 1 : 0; + net_is_pcap = config_net_type ? 0 : 1; + if(!strcmp("nothing", config_get_string(NULL, "pcap_device", "nothing"))) + { + net_is_pcap = 0; + net_is_slirp = 1; + } + pclog("net_is_pcap = %i, net_is_slirp = %i\n", net_is_pcap, net_is_slirp); + // ne2000_log("ne2000 pcap device %s\n",config_get_string(NULL,"pcap_device","nothing")); - - //Check that we have a string setup, otherwise turn pcap off - if(!strcmp("nothing",config_get_string(NULL,"pcap_device","nothing"))) { - net_is_pcap = 0; - } - else { - if( net_is_slirp == 0) - net_is_pcap = 1; - } ne2000_io_set(ne2000->base_address, ne2000); memcpy(ne2000->physaddr, maclocal, 6); @@ -1938,16 +1937,13 @@ void *rtl8029as_init() // net_is_slirp = config_get_int(NULL, "net_type", 1); /* Network type is now specified in device config. */ net_is_slirp = config_net_type ? 1 : 0; + net_is_pcap = config_net_type ? 0 : 1; + if(!strcmp("nothing", config_get_string(NULL, "pcap_device", "nothing"))) + { + net_is_pcap = 0; + net_is_slirp = 1; + } // ne2000_log("ne2000 pcap device %s\n",config_get_string(NULL,"pcap_device","nothing")); - - //Check that we have a string setup, otherwise turn pcap off - if(!strcmp("nothing",config_get_string(NULL,"pcap_device","nothing"))) { - net_is_pcap = 0; - } - else { - if( net_is_slirp == 0) - net_is_pcap = 1; - } pci_add(ne2000_pci_read, ne2000_pci_write, ne2000);