linux blocks until a packet arrives which the rest of the code does not expect
This commit is contained in:
@@ -122,6 +122,9 @@ static const unsigned char
|
|||||||
*(*f_pcap_next)(void *,void *);
|
*(*f_pcap_next)(void *,void *);
|
||||||
static int (*f_pcap_sendpacket)(void *,const unsigned char *,int);
|
static int (*f_pcap_sendpacket)(void *,const unsigned char *,int);
|
||||||
static void (*f_pcap_close)(void *);
|
static void (*f_pcap_close)(void *);
|
||||||
|
#ifdef __linux__
|
||||||
|
static int (*f_pcap_setnonblock)(void*, int, char*);
|
||||||
|
#endif
|
||||||
static dllimp_t pcap_imports[] = {
|
static dllimp_t pcap_imports[] = {
|
||||||
{ "pcap_lib_version", &f_pcap_lib_version },
|
{ "pcap_lib_version", &f_pcap_lib_version },
|
||||||
{ "pcap_findalldevs", &f_pcap_findalldevs },
|
{ "pcap_findalldevs", &f_pcap_findalldevs },
|
||||||
@@ -132,6 +135,9 @@ static dllimp_t pcap_imports[] = {
|
|||||||
{ "pcap_next", &f_pcap_next },
|
{ "pcap_next", &f_pcap_next },
|
||||||
{ "pcap_sendpacket", &f_pcap_sendpacket },
|
{ "pcap_sendpacket", &f_pcap_sendpacket },
|
||||||
{ "pcap_close", &f_pcap_close },
|
{ "pcap_close", &f_pcap_close },
|
||||||
|
#ifdef __linux__
|
||||||
|
{ "pcap_setnonblock", &f_pcap_setnonblock },
|
||||||
|
#endif
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -382,6 +388,11 @@ net_pcap_reset(const netcard_t *card, uint8_t *mac)
|
|||||||
pcap_log(" Unable to open device: %s!\n", network_host);
|
pcap_log(" Unable to open device: %s!\n", network_host);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
#ifdef __linux__
|
||||||
|
if (f_pcap_setnonblock((void*)pcap, 1, errbuf) != 0)
|
||||||
|
pcap_log("PCAP: failed nonblock %s\n", errbuf);
|
||||||
|
#endif
|
||||||
|
|
||||||
pcap_log("PCAP: interface: %s\n", network_host);
|
pcap_log("PCAP: interface: %s\n", network_host);
|
||||||
|
|
||||||
/* Create a MAC address based packet filter. */
|
/* Create a MAC address based packet filter. */
|
||||||
|
Reference in New Issue
Block a user