From 7f7c78ad96d08e160ca1b6ec605d2a9622bcd90f Mon Sep 17 00:00:00 2001 From: david Date: Thu, 10 Feb 2011 05:52:22 +0000 Subject: [PATCH] Fix a bug in Windows interface matching. The code was supposed to check if a MAC address matched the expected address, and if so, take that as a preliminary match before checking the description string for a stronger match. But if retrieving the the MAC address failed completely, it was still being accepted as a preliminary match, and would prevent later matches with only the MAC address from being accepted. --- libdnet-stripped/src/intf-win32.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libdnet-stripped/src/intf-win32.c b/libdnet-stripped/src/intf-win32.c index 4152fe0bb..85b63a3c2 100644 --- a/libdnet-stripped/src/intf-win32.c +++ b/libdnet-stripped/src/intf-win32.c @@ -441,12 +441,12 @@ intf_get_pcap_devname(const char *intf_name, char *pcapdev, int pcapdevlen) /* Check the MAC address if available. */ data->Oid = OID_802_3_CURRENT_ADDRESS; data->Length = sizeof(buf) - sizeof(*data); - if (PacketRequest(lpa, FALSE, data) == TRUE) { - if (data->Length != ifrow.dwPhysAddrLen) - goto close_adapter; - if (memcmp(ifrow.bPhysAddr, data->Data, data->Length) != 0) - goto close_adapter; - } + if (!PacketRequest(lpa, FALSE, data)) + goto close_adapter; + if (data->Length != ifrow.dwPhysAddrLen) + goto close_adapter; + if (memcmp(ifrow.bPhysAddr, data->Data, data->Length) != 0) + goto close_adapter; /* A hardware address match is good enough, but we will prefer an additional match with the description if available. */