Added pcap_fileno to the dynamically loaded libpcap entry points since it is needed by OS X.
This commit is contained in:
parent
2793d49bf9
commit
934836483b
2 changed files with 11 additions and 1 deletions
2
makefile
2
makefile
|
@ -117,7 +117,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
|
|||
$(info using libpcap: $(call find_lib,pcap) $(call find_include,pcap))
|
||||
else # default build uses dynamic libpcap
|
||||
NETWORK_CCDEFS = -DUSE_SHARED
|
||||
$(info using libpcap: $$(call find_include,pcap))
|
||||
$(info using libpcap: $(call find_include,pcap))
|
||||
endif
|
||||
else
|
||||
NETWORK_CCDEFS = -DUSE_SHARED
|
||||
|
|
10
sim_ether.c
10
sim_ether.c
|
@ -863,6 +863,7 @@ static int (*p_pcap_setmintocopy) (pcap_t* handle, int);
|
|||
static HANDLE (*p_pcap_getevent) (pcap_t *);
|
||||
#else
|
||||
static int (*p_pcap_get_selectable_fd) (pcap_t *);
|
||||
static int (*p_pcap_fileno) (pcap_t *);
|
||||
#endif
|
||||
static int (*p_pcap_sendpacket) (pcap_t* handle, const u_char* msg, int len);
|
||||
static int (*p_pcap_setfilter) (pcap_t *, struct bpf_program *);
|
||||
|
@ -933,6 +934,7 @@ int load_pcap(void) {
|
|||
load_function("pcap_getevent", (void**) &p_pcap_getevent);
|
||||
#else
|
||||
load_function("pcap_get_selectable_fd", (void**) &p_pcap_get_selectable_fd);
|
||||
load_function("pcap_fileno", (void**) &p_pcap_fileno);
|
||||
#endif
|
||||
load_function("pcap_sendpacket", (void**) &p_pcap_sendpacket);
|
||||
load_function("pcap_setfilter", (void**) &p_pcap_setfilter);
|
||||
|
@ -1054,6 +1056,14 @@ int pcap_get_selectable_fd(pcap_t* a) {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_fileno(pcap_t * a) {
|
||||
if (load_pcap() != 0) {
|
||||
return p_pcap_fileno(a);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int pcap_sendpacket(pcap_t* a, const u_char* b, int c) {
|
||||
|
|
Loading…
Add table
Reference in a new issue