The WinPcap handler now forces non-blocking mode again.

This commit is contained in:
OBattler
2017-05-20 22:23:54 +02:00
parent 1ad94224ca
commit 2c7b6f004a
2 changed files with 49 additions and 2 deletions

View File

@@ -1809,12 +1809,13 @@ nic_init(int board)
mac = device_get_config_int_ex("mac", -1);
/* Set up our MAC address. */
#if 0
if (dev->is_rtl8029as) {
dev->maclocal[0] = 0x00; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */
dev->maclocal[0] = 0xDE /* 0x00 */; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */
dev->maclocal[1] = 0x20;
dev->maclocal[2] = 0x18;
} else {
dev->maclocal[0] = 0x00; /* 00:00:D8 (NE2000 ISA vendor prefix). */
dev->maclocal[0] = 0xDE /* 0x00 */; /* 00:00:D8 (NE2000 ISA vendor prefix). */
dev->maclocal[1] = 0x00;
dev->maclocal[2] = 0xD8;
}
@@ -1833,6 +1834,14 @@ nic_init(int board)
dev->maclocal[5] = (mac & 0xff) | 1;
#endif
}
#else
dev->maclocal[0] = 0xac;
dev->maclocal[1] = 0xde;
dev->maclocal[2] = 0x48;
dev->maclocal[3] = 0x88;
dev->maclocal[4] = 0xbb;
dev->maclocal[5] = 0xaa;
#endif
memcpy(dev->physaddr, dev->maclocal, sizeof(dev->maclocal));
pclog(1,"%s: I/O=%04x, IRQ=%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x BIOS=%d\n",

View File

@@ -109,6 +109,7 @@ poll_thread(void *arg)
int
network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
{
int rc;
char temp[PCAP_ERRBUF_SIZE];
char filter_exp[255];
struct bpf_program fp;
@@ -147,6 +148,43 @@ network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
return(-1);
}
/* Time to check that we are in non-blocking mode. */
rc=pcap_getnonblock(pcap,temp);
pclog("pcap is currently in %s mode\n",rc? "non-blocking":"blocking");
switch(rc)
{
case 0:
pclog("Setting interface to non-blocking mode..");
rc = pcap_setnonblock(pcap,1,temp);
if (rc==0)
{ /* no errors! */
pclog("..");
rc=pcap_getnonblock(pcap,temp);
if(rc == 1)
{
pclog("..!",rc);
}
else
{
pclog("\tunable to set pcap into non-blocking mode!\nContinuining without pcap.\n");
return(-1);
}
} /* end set nonblock */
else
{
pclog("There was an unexpected error of [%s]\n\nexiting.\n",temp);return(-1);}
pclog("\n");
break;
case 1:
pclog("non blocking\n");
break;
default:
pclog("this isn't right!!!\n");
return(-1);
break;
}
/* Create a MAC address based packet filter. */
pclog("Building packet filter ...");
sprintf(filter_exp,