1
0
mirror of https://github.com/solemnwarning/ipxwrapper synced 2024-12-30 16:45:37 +01:00

Added support for win10pcap format interface names.

This commit is contained in:
Daniel Collins 2017-08-06 14:57:08 +01:00
parent d9133fd8dd
commit 8c55242b10

View File

@ -706,7 +706,8 @@ int ipx_interface_count(void)
return count;
}
#define PCAP_NAME_PREFIX "rpcap://\\Device\\NPF_"
#define PCAP_NAME_PREFIX_OLD "rpcap://\\Device\\NPF_"
#define PCAP_NAME_PREFIX_NEW "rpcap://"
ipx_pcap_interface_t *ipx_get_pcap_interfaces(void)
{
@ -726,10 +727,23 @@ ipx_pcap_interface_t *ipx_get_pcap_interfaces(void)
for(pcap_if_t *pcap_if = pcap_interfaces; pcap_if; pcap_if = pcap_if->next)
{
if(strncmp(pcap_if->name, PCAP_NAME_PREFIX, strlen(PCAP_NAME_PREFIX)) == 0)
const char *ifname = NULL;
if(strncmp(pcap_if->name, PCAP_NAME_PREFIX_OLD, strlen(PCAP_NAME_PREFIX_OLD)) == 0)
{
ifname = pcap_if->name + strlen(PCAP_NAME_PREFIX_OLD);
}
else if(strncmp(pcap_if->name, PCAP_NAME_PREFIX_NEW, strlen(PCAP_NAME_PREFIX_NEW)) == 0)
{
ifname = pcap_if->name + strlen(PCAP_NAME_PREFIX_NEW);
}
else{
log_printf(LOG_WARNING, "WinPcap interface with unexpected name format: '%s'", pcap_if->name);
log_printf(LOG_WARNING, "This interface will not be available for IPX use");
}
if(ifname != NULL)
{
char *ifname = pcap_if->name + strlen(PCAP_NAME_PREFIX);
IP_ADAPTER_INFO *ip_if = ip_interfaces;
while(ip_if && strcmp(ip_if->AdapterName, ifname))
{
@ -769,10 +783,6 @@ ipx_pcap_interface_t *ipx_get_pcap_interfaces(void)
log_printf(LOG_WARNING, "This interface will not be available for IPX use");
}
}
else{
log_printf(LOG_WARNING, "WinPcap interface with unexpected name format: '%s'", pcap_if->name);
log_printf(LOG_WARNING, "This interface will not be available for IPX use");
}
}
pcap_freealldevs(pcap_interfaces);