On OS X, get the interface type from the System Configuration framework.
authorGuy Harris <guy@alum.mit.edu>
Wed, 22 May 2013 01:19:18 +0000 (01:19 -0000)
committerGuy Harris <guy@alum.mit.edu>
Wed, 22 May 2013 01:19:18 +0000 (01:19 -0000)
svn path=/trunk/; revision=49486

Makefile.am
Makefile.common
capture-pcap-util.c
capture_ifinfo.c
capture_ifinfo.h
capture_opts.h
capture_unix_ifnames.c [deleted file]
capture_unix_ifnames.h [deleted file]
dumpcap.c
ui/iface_lists.c

index c3218f74db4615fc8d9f6e16ac2394f1d93d5112..4ee865075d6255fe0052d6ffa016970fb0ae3c31 100644 (file)
@@ -285,8 +285,7 @@ wimaxasncp_DATA = \
        wimaxasncp/dictionary.dtd
 
 PLATFORM_SRC = \
-       capture-pcap-util-unix.c \
-       capture_unix_ifnames.c
+       capture-pcap-util-unix.c
 
 if HAVE_PLUGINS
 -include plugins/Custom.make
index 3553ab9d3ed7f32bc7399920b04302b6dcd06e72..411c8d9cdab9595e83cc60931e57cfd5e88bb2be 100644 (file)
@@ -66,7 +66,6 @@ WIRESHARK_COMMON_INCLUDES =   \
        svnversion.h            \
        capture-pcap-util.h     \
        capture-pcap-util-int.h \
-       capture_unix_ifnames.h  \
        cfile.h                 \
        cfutils.h               \
        clopts_common.h         \
index abb220b85115ae7f23d0d0a2c8d775b211167cf8..f2573f06c57e3b9124bc12c5dd7480cc4a1efb28 100644 (file)
 
 #ifdef _WIN32
 #include "capture_win_ifnames.h" /* windows friendly interface names */
+#endif
+
+/*
+ * Given an interface name, find the "friendly name" and interface
+ * type for the interface.
+ */
+
+#if defined(__APPLE__)
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+#include "cfutils.h"
+
+/*
+ * On OS X, we get the "friendly name" and interface type for the interface
+ * from the System Configuration framework.
+ *
+ * To find the System Configuration framework information for the
+ * interface, we get all the interfaces that the System Configuration
+ * framework knows about and look for the one with a "BSD name" matching
+ * the interface name.
+ *
+ * If we find it, we use its "localized display name", if it has one, as
+ * the "friendly name".
+ *
+ * As for the interface type:
+ *
+ * Yes, fetching all the network addresses for an interface gets you an
+ * AF_LINK address, of type "struct sockaddr_dl", and, yes, that includes
+ * an SNMP MIB-II ifType value.
+ *
+ * However, it's IFT_ETHER, i.e. Ethernet, for AirPort interfaces,
+ * not IFT_IEEE80211 (which isn't defined in OS X in any case).
+ *
+ * Perhaps some other BSD-flavored OSes won't make this mistake;
+ * however, FreeBSD 7.0 and OpenBSD 4.2, at least, appear to have
+ * made the same mistake, at least for my Belkin ZyDAS stick.
+ *
+ * SCNetworkInterfaceGetInterfaceType() will get the interface
+ * type.  The interface type is a CFString, and:
+ *
+ *    kSCNetworkInterfaceTypeIEEE80211 means IF_WIRELESS;
+ *    kSCNetworkInterfaceTypeBluetooth means IF_BLUETOOTH;
+ *    kSCNetworkInterfaceTypeModem or
+ *    kSCNetworkInterfaceTypePPP or
+ *    maybe kSCNetworkInterfaceTypeWWAN means IF_DIALUP
+ */
+static void
+add_unix_interface_ifinfo(if_info_t *if_info, const char *name,
+    const char *description _U_)
+{
+       CFStringRef name_CFString;
+       CFArrayRef interfaces;
+       CFIndex num_interfaces;
+       CFIndex i;
+       SCNetworkInterfaceRef interface;
+       CFStringRef bsdname_CFString;
+       CFStringRef friendly_name_CFString;
+       CFStringRef interface_type_CFString;
+
+       interfaces = SCNetworkInterfaceCopyAll();
+       if (interfaces == NULL) {
+               /*
+                * Couldn't get a list of interfaces.
+                */
+               return;
+       }
+
+       name_CFString = CFStringCreateWithCString(kCFAllocatorDefault,
+           name, kCFStringEncodingUTF8);
+       if (name_CFString == NULL) {
+               /*
+                * Couldn't convert the interface name to a CFString.
+                */
+               CFRelease(interfaces);
+               return;
+       }
+
+       num_interfaces = CFArrayGetCount(interfaces);
+       for (i = 0; i < num_interfaces; i++) {
+               interface = (SCNetworkInterfaceRef)CFArrayGetValueAtIndex(interfaces, i);
+               bsdname_CFString = SCNetworkInterfaceGetBSDName(interface);
+               if (bsdname_CFString == NULL) {
+                       /*
+                        * This interface has no BSD name, so it's not
+                        * a regular network interface.
+                        */
+                       continue;
+               }
+               if (CFStringCompare(name_CFString, bsdname_CFString, 0) == 0) {
+                       /*
+                        * This is the interface.
+                        * First, get the friendly name.
+                        */
+                       friendly_name_CFString = SCNetworkInterfaceGetLocalizedDisplayName(interface);
+                       if (friendly_name_CFString != NULL)
+                               if_info->friendly_name = CFString_to_C_string(friendly_name_CFString);
+
+                       /*
+                        * Now get the interface type.
+                        */
+                       interface_type_CFString = SCNetworkInterfaceGetInterfaceType(interface);
+                       if (CFStringCompare(interface_type_CFString,
+                           kSCNetworkInterfaceTypeIEEE80211, 0) == kCFCompareEqualTo)
+                               if_info->type = IF_WIRELESS;
+                       else if (CFStringCompare(interface_type_CFString,
+                           kSCNetworkInterfaceTypeBluetooth, 0) == kCFCompareEqualTo)
+                               if_info->type = IF_BLUETOOTH;
+                       else if (CFStringCompare(interface_type_CFString,
+                           kSCNetworkInterfaceTypeModem, 0) == kCFCompareEqualTo)
+                               if_info->type = IF_DIALUP;
+                       else if (CFStringCompare(interface_type_CFString,
+                           kSCNetworkInterfaceTypePPP, 0) == kCFCompareEqualTo)
+                               if_info->type = IF_DIALUP;
+                       else if (CFStringCompare(interface_type_CFString,
+                           kSCNetworkInterfaceTypeWWAN, 0) == kCFCompareEqualTo)
+                               if_info->type = IF_DIALUP;
+                       else
+                               if_info->type = IF_WIRED;
+                       break;
+               }
+       }
+
+       CFRelease(interfaces);
+}
+#elif defined(__linux__)
+/*
+ * Linux doesn't offer any form of "friendly name", but you can
+ * determine an interface type to some degree.
+ */
+static void
+add_unix_interface_ifinfo(if_info_t *if_info, const char *name,
+    const char *description _U_)
+{
+       char *wireless_path;
+       ws_statb64 statb;
+
+       /*
+        * Look for /sys/class/net/{device}/wireless.  If it exists,
+        * it's a wireless interface.
+        */
+       wireless_path = g_strdup_printf("/sys/class/net/%s/wireless", name);
+       if (wireless_path != NULL) {
+               if (ws_stat64(wireless_path, &statb) == 0)
+                       if_info->type = IF_WIRELESS;
+               g_free(wireless_path);
+       }
+       if (if_info->type == IF_WIRED) {
+               /*
+                * We still don't know what it is.  Check for
+                * Bluetooth and USB devices.
+                */
+               if (strstr(name, "bluetooth") != NULL) {
+                       /*
+                        * XXX - this is for raw Bluetooth capture; what
+                        * about IP-over-Bluetooth devices?
+                        */
+                       if_info->type = IF_BLUETOOTH;
+               } else if (strstr(name, "usbmon") != NULL)
+                       if_info->type = IF_USB;
+       }
+}
 #else
-#include "capture_unix_ifnames.h"
+/*
+ * On other UN*Xes, if there is a description, it's a friendly
+ * name, and there is no vendor description.  ("Other UN*Xes"
+ * currently means "FreeBSD and OpenBSD".)
+ */
+void
+add_unix_interface_ifinfo(if_info_t *if_info, const char *name _U_,
+    const char *description)
+{
+       if_info->friendly_name = g_strdup(description);
+}
 #endif
 
 if_info_t *
@@ -69,7 +242,47 @@ if_info_new(const char *name, const char *description, gboolean loopback)
 
        if_info = (if_info_t *)g_malloc(sizeof (if_info_t));
        if_info->name = g_strdup(name);
+       if_info->friendly_name = NULL;  /* default - unknown */
+       if_info->vendor_description = NULL;
+       if_info->type = IF_WIRED;       /* default */
 #ifdef _WIN32
+       /*
+        * Get the interface type.
+        *
+        * Much digging failed to reveal any obvious way to get something
+        * such as the SNMP MIB-II ifType value for an interface:
+        *
+        *    http://www.iana.org/assignments/ianaiftype-mib
+        *
+        * by making some NDIS request.  And even if there were such
+        * a way, there's no guarantee that the ifType reflects an
+        * interface type that a user would view as correct (for
+        * example, some systems report Wi-Fi interfaces as
+        * Ethernet interfaces).
+        *
+        * So we look for keywords in the vendor's interface
+        * description.
+        */
+       if (description && (strstr(description, "generic dialup") != NULL ||
+           strstr(description, "PPP/SLIP") != NULL)) {
+               if_info->type = IF_DIALUP;
+       } else if (description && (strstr(description, "Wireless") != NULL ||
+           strstr(description,"802.11") != NULL)) {
+               if_info->type = IF_WIRELESS;
+       } else if (description && strstr(description, "AirPcap") != NULL ||
+           strstr(name, "airpcap") != NULL) {
+               if_info->type = IF_AIRPCAP;
+       } else if (description && strstr(description, "Bluetooth") != NULL ) {
+               if_info->type = IF_BLUETOOTH;
+       } else if (description && strstr(description, "VMware") != NULL) {
+               /*
+                * Bridge, NAT, or host-only interface on a VMware host.
+                *
+                * XXX - what about guest interfaces?
+                */
+               if_info->type = IF_VIRTUAL;
+       }
+
        /*
         * On Windows, the "description" is a vendor description,
         * and the friendly name isn't returned by WinPcap.
@@ -110,21 +323,39 @@ if_info_new(const char *name, const char *description, gboolean loopback)
        /*
         * On UN*X, if there is a description, it's a friendly
         * name, and there is no vendor description.
-        * If there's no description, fetch a friendly name
-        * if we can; if that fails, then, for a loopback
-        * interface, give it the friendly name "Loopback".
+        *
+        * Try the platform's way of getting a friendly name and
+        * interface type first.
+        *
+        * If that fails, then, for a loopback interface, give it the
+        * friendly name "Loopback" and, for VMware interfaces,
+        * give them the type IF_VIRTUAL.
         */
-       if_info->friendly_name = g_strdup(description);
+       add_unix_interface_ifinfo(if_info, name, description);
+       if (if_info->type == IF_WIRED) {
+               /*
+                * This is the default interface type.
+                *
+                * Bridge, NAT, or host-only interfaces on VMWare hosts
+                * have the name vmnet[0-9]+. Guests might use a native
+                * (LANCE or E1000) driver or the vmxnet driver.  Check
+                * the name.
+                */
+               if (g_ascii_strncasecmp(name, "vmnet", 5) == 0)
+                       if_info->type = IF_VIRTUAL;
+               else if (g_ascii_strncasecmp(name, "vmxnet", 6) == 0)
+                       if_info->type = IF_VIRTUAL;
+       }
        if (if_info->friendly_name == NULL) {
-               if_info->friendly_name = get_unix_interface_friendly_name(name);
-               if (if_info->friendly_name == NULL) {
-                       /*
-                        * If this is a loopback interface, give it a
-                        * "friendly name" of "Loopback".
-                        */
-                       if (loopback)
-                               if_info->friendly_name = g_strdup("Loopback");
-               }
+               /*
+                * We couldn't get interface information using platform-
+                * dependent calls.
+                *
+                * If this is a loopback interface, give it a
+                * "friendly name" of "Loopback".
+                */
+               if (loopback)
+                       if_info->friendly_name = g_strdup("Loopback");
        }
        if_info->vendor_description = NULL;
 #endif
index 7899b5f7a0dc6d118ba0a97811fbaf5f7cf04acc..9f24f0e70a38af891c601810aa323a96d7668890 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
 
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
@@ -141,9 +142,9 @@ capture_interface_list(int *err, char **err_str)
     g_free(data);
 
     for (i = 0; raw_list[i] != NULL; i++) {
-        if_parts = g_strsplit(raw_list[i], "\t", 5);
+        if_parts = g_strsplit(raw_list[i], "\t", 6);
         if (if_parts[0] == NULL || if_parts[1] == NULL || if_parts[2] == NULL ||
-                if_parts[3] == NULL || if_parts[4] == NULL) {
+                if_parts[3] == NULL || if_parts[4] == NULL || if_parts[5] == NULL) {
             g_strfreev(if_parts);
             continue;
         }
@@ -163,7 +164,8 @@ capture_interface_list(int *err, char **err_str)
             if_info->vendor_description = g_strdup(if_parts[1]);
         if (strlen(if_parts[2]) > 0)
             if_info->friendly_name = g_strdup(if_parts[2]);
-        addr_parts = g_strsplit(if_parts[3], ",", 0);
+        if_info->type = (interface_type)strtol(if_parts[3], NULL, 10);
+        addr_parts = g_strsplit(if_parts[4], ",", 0);
         for (j = 0; addr_parts[j] != NULL; j++) {
             if_addr = g_new0(if_addr_t,1);
             if (inet_pton(AF_INET, addr_parts[j], &if_addr->addr.ip4_addr)) {
@@ -179,7 +181,7 @@ capture_interface_list(int *err, char **err_str)
                 if_info->addrs = g_slist_append(if_info->addrs, if_addr);
             }
         }
-        if (strcmp(if_parts[4], "loopback") == 0)
+        if (strcmp(if_parts[5], "loopback") == 0)
             if_info->loopback = TRUE;
         g_strfreev(if_parts);
         g_strfreev(addr_parts);
@@ -340,82 +342,4 @@ void add_interface_to_remote_list(if_info_t *if_info)
     remote_interface_list = g_list_append(remote_interface_list, temp);
 }
 #endif
-
-guint
-get_interface_type(gchar *name, gchar *description)
-{
-#if defined(__linux__)
-    ws_statb64 statb;
-    char *wireless_path;
-#endif
-#if defined(_WIN32)
-    /*
-     * Much digging failed to reveal any obvious way to get something such
-     * as the SNMP MIB-II ifType value for an interface:
-     *
-     *    http://www.iana.org/assignments/ianaiftype-mib
-     *
-     * by making some NDIS request.
-     */
-    if (description && (strstr(description,"generic dialup") != NULL ||
-            strstr(description,"PPP/SLIP") != NULL )) {
-        return IF_DIALUP;
-    } else if (description && (strstr(description,"Wireless") != NULL ||
-            strstr(description,"802.11") != NULL)) {
-        return IF_WIRELESS;
-    } else if (description && strstr(description,"AirPcap") != NULL ||
-            strstr(name,"airpcap")) {
-        return IF_AIRPCAP;
-    } else if (description && strstr(description, "Bluetooth") != NULL ) {
-        return IF_BLUETOOTH;
-    }
-#elif defined(__linux__)
-    /*
-     * Look for /sys/class/net/{device}/wireless.
-     */
-    wireless_path = g_strdup_printf("/sys/class/net/%s/wireless", name);
-    if (wireless_path != NULL) {
-        if (ws_stat64(wireless_path, &statb) == 0) {
-            g_free(wireless_path);
-            return IF_WIRELESS;
-        }
-        g_free(wireless_path);
-    }
-    /*
-     * Bluetooth devices.
-     *
-     * XXX - this is for raw Bluetooth capture; what about IP-over-Bluetooth
-     * devices?
-     */
-    if ( strstr(name,"bluetooth") != NULL) {
-        return IF_BLUETOOTH;
-    }
-
-    /*
-     * USB devices.
-     */
-    if ( strstr(name,"usbmon") != NULL ) {
-        return IF_USB;
-    }
-#endif
-    /*
-     * Bridge, NAT, or host-only interfaces on VMWare hosts have the name
-     * vmnet[0-9]+ or VMnet[0-9+ on Windows. Guests might use a native
-     * (LANCE or E1000) driver or the vmxnet driver. These devices have an
-     * IFT_ of IFT_ETHER, so we have to check the name.
-     */
-    if ( g_ascii_strncasecmp(name, "vmnet", 5) == 0) {
-        return IF_VIRTUAL;
-    }
-
-    if ( g_ascii_strncasecmp(name, "vmxnet", 6) == 0) {
-        return IF_VIRTUAL;
-    }
-
-    if (description && strstr(description, "VMware") != NULL ) {
-        return IF_VIRTUAL;
-    }
-
-    return IF_WIRED;
-}
 #endif /* HAVE_LIBPCAP */
index 7802598bef466f66a5399bba891802acce0de818..097d9e10ba7330b39907f45b0fb78e891099b827 100644 (file)
 extern "C" {
 #endif /* __cplusplus */
 
+typedef enum {
+       IF_WIRED,
+       IF_AIRPCAP,
+       IF_PIPE,
+       IF_STDIN,
+       IF_BLUETOOTH,
+       IF_WIRELESS,
+       IF_DIALUP,
+       IF_USB,
+       IF_VIRTUAL
+} interface_type;
+
 /*
  * The list of interfaces returned by "get_interface_list()" is
  * a list of these structures.
@@ -42,6 +54,7 @@ typedef struct {
                                   e.g. "Realtek PCIe GBE Family Controller",
                                   or NULL if not available */
        GSList  *addrs;         /* containing address values of if_addr_t */
+       interface_type type;    /* type of interface */
        gboolean loopback;      /* TRUE if loopback, FALSE otherwise */
 } if_info_t;
 
@@ -103,12 +116,6 @@ void free_if_capabilities(if_capabilities_t *caps);
 
 void add_interface_to_remote_list(if_info_t *if_info);
 
-/**
- * Get the type of an interface, given its name and description.
- */
-extern guint
-get_interface_type(gchar *name, gchar *description);
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 67a5bfe34967e8cbb0f175b398bc750d1e5a1589..b6dfa80ece59486ecc7471a8f52bebfe33b4edc5 100644 (file)
@@ -77,18 +77,6 @@ typedef enum {
 } capture_sampling;
 #endif
 
-typedef enum {
-    IF_WIRED,
-    IF_AIRPCAP,
-    IF_PIPE,
-    IF_STDIN,
-    IF_BLUETOOTH,
-    IF_WIRELESS,
-    IF_DIALUP,
-    IF_USB,
-    IF_VIRTUAL
-} interface_type;
-
 #ifdef HAVE_PCAP_REMOTE
 struct remote_host_info {
     gchar *remote_host;          /**< Host name or network address for remote capturing */
diff --git a/capture_unix_ifnames.c b/capture_unix_ifnames.c
deleted file mode 100644 (file)
index 42d0d7a..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* capture_unix_ifnames.c
- * Routines supporting the use of UN*X friendly interface names, if any,
- * within Wireshark
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 2001 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <glib.h>
-
-#include "capture_unix_ifnames.h"
-
-/*
- * Given an interface name, find the "friendly name" for the interface.
- */
-
-#ifdef __APPLE__
-
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/SystemConfiguration.h>
-
-#include "cfutils.h"
-
-/*
- * On OS X, we do that by getting all the interfaces that the System
- * Configuration framework knows about, look for the one with a "BSD
- * name" matching the interface name, and, if we find it, return its
- * "localized display name", if it has one.
- */
-char *
-get_unix_interface_friendly_name(const char *ifname)
-{
-       CFStringRef ifname_CFString;
-       CFArrayRef interfaces;
-       CFIndex num_interfaces;
-       CFIndex i;
-       SCNetworkInterfaceRef interface;
-       CFStringRef bsdname_CFString;
-       CFStringRef friendly_name_CFString;
-       char *friendly_name = NULL;
-
-       interfaces = SCNetworkInterfaceCopyAll();
-       if (interfaces == NULL) {
-               /*
-                * Couldn't get a list of interfaces.
-                */
-               return NULL;
-       }
-
-       ifname_CFString = CFStringCreateWithCString(kCFAllocatorDefault,
-           ifname, kCFStringEncodingUTF8);
-       if (ifname_CFString == NULL) {
-               /*
-                * Couldn't convert the interface name to a CFString.
-                */
-               CFRelease(interfaces);
-               return NULL;
-       }
-
-       num_interfaces = CFArrayGetCount(interfaces);
-       for (i = 0; i < num_interfaces; i++) {
-               interface = (SCNetworkInterfaceRef)CFArrayGetValueAtIndex(interfaces, i);
-               bsdname_CFString = SCNetworkInterfaceGetBSDName(interface);
-               if (bsdname_CFString == NULL) {
-                       /*
-                        * This interface has no BSD name, so it's not
-                        * a regular network interface.
-                        */
-                       continue;
-               }
-               if (CFStringCompare(ifname_CFString, bsdname_CFString, 0) == 0) {
-                       /*
-                        * This is the interface.
-                        */
-                       friendly_name_CFString = SCNetworkInterfaceGetLocalizedDisplayName(interface);
-                       if (friendly_name_CFString != NULL)
-                               friendly_name = CFString_to_C_string(friendly_name_CFString);
-                       break;
-               }
-       }
-
-       CFRelease(interfaces);
-       return friendly_name;
-}
-
-#else /* __APPLE__ */
-
-/*
- * Nothing supported on other platforms.
- */
-char *
-get_unix_interface_friendly_name(const char *ifname _U_)
-{
-       return NULL;
-}
-
-#endif /* __APPLE__ */
diff --git a/capture_unix_ifnames.h b/capture_unix_ifnames.h
deleted file mode 100644 (file)
index 7e93754..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* capture_unix_ifnames.h
- * Routines supporting the use of UN*X friendly interface names, if any,
- * within Wireshark
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef CAPTURE_UNIX_IFNAMES_H
-#define CAPTURE_UNIX_IFNAMES_H
-
-/* returns the interface friendly name for a device name; if it is unable to
- * resolve the name, NULL is returned */
-char *get_unix_interface_friendly_name(const char *ifname);
-
-#endif
index e52c2660ec0adf44f3bff63a0e3156fa9f508179..bea453717684184b207b45af8556f6ff25528cfd 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -1294,7 +1294,7 @@ print_machine_readable_interfaces(GList *if_list)
     for (if_entry = g_list_first(if_list); if_entry != NULL;
          if_entry = g_list_next(if_entry)) {
         if_info = (if_info_t *)if_entry->data;
-        printf("%d. %s", i++, if_info->name);
+        printf("%d. %s\t", i++, if_info->name);
 
         /*
          * Print the contents of the if_entry struct in a parseable format.
@@ -1303,9 +1303,9 @@ print_machine_readable_interfaces(GList *if_list)
          */
         /* XXX - Make sure our description doesn't contain a tab */
         if (if_info->vendor_description != NULL)
-            printf("\t%s\t", if_info->vendor_description);
+            printf("%s\t", if_info->vendor_description);
         else
-            printf("\t\t");
+            printf("\t");
 
         /* XXX - Make sure our friendly name doesn't contain a tab */
         if (if_info->friendly_name != NULL)
@@ -1313,6 +1313,8 @@ print_machine_readable_interfaces(GList *if_list)
         else
             printf("\t");
 
+        printf("%u\t", if_info->type);
+
         for (addr = g_slist_nth(if_info->addrs, 0); addr != NULL;
                     addr = g_slist_next(addr)) {
             if (addr != g_slist_nth(if_info->addrs, 0))
index bbd8041a69b8be83433fb125070b767df7063d6b..4483033374953bbd3b1a89d4dbc1771f5da6c13f 100644 (file)
@@ -159,7 +159,7 @@ scan_local_interfaces(void)
         if (prefs_is_capture_device_hidden(if_info->name)) {
             device.hidden = TRUE;
         }
-        device.type = get_interface_type(if_info->name, if_info->vendor_description);
+        device.type = if_info->type;
         monitor_mode = prefs_capture_device_monitor_mode(if_info->name);
         caps = capture_get_if_capabilities(if_info->name, monitor_mode, NULL);
         for (; (curr_addr = g_slist_nth(if_info->addrs, ips)) != NULL; ips++) {