Fix ui/iface_lists.c - type attribute is not copied
authorRoland Knall <roland.knall@br-automation.com>
Wed, 26 Feb 2014 12:14:01 +0000 (13:14 +0100)
committerAlexis La Goutte <alexis.lagoutte@gmail.com>
Sun, 2 Mar 2014 09:53:40 +0000 (09:53 +0000)
 temp is a clone of the local if_info, but the type
 attribute is not copied correctly

 Additionally, the if_type member is exposed via the
 capture options

Change-Id: Id53f0dfd1e127921e1b89bbf78cb431ee257a96c
Reviewed-on: https://code.wireshark.org/review/404
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
capture_opts.c
capture_opts.h
ui/iface_lists.c

index 4ab473a5700db2d2da7e1a6302089335f16ce313..172c2d09961179f6624739e959559b5146f0a607 100644 (file)
@@ -67,6 +67,7 @@ capture_opts_init(capture_options *capture_opts)
   capture_opts->default_options.snaplen         = WTAP_MAX_PACKET_SIZE;
   capture_opts->default_options.linktype        = -1; /* use interface default */
   capture_opts->default_options.promisc_mode    = TRUE;
+  capture_opts->default_options.if_type         = IF_WIRED;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   capture_opts->default_options.buffer_size     = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
@@ -597,6 +598,7 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
     interface_opts.has_snaplen = capture_opts->default_options.has_snaplen;
     interface_opts.linktype = capture_opts->default_options.linktype;
     interface_opts.promisc_mode = capture_opts->default_options.promisc_mode;
+    interface_opts.if_type = capture_opts->default_options.if_type;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     interface_opts.buffer_size = capture_opts->default_options.buffer_size;
 #endif
@@ -1055,6 +1057,7 @@ collect_ifaces(capture_options *capture_opts)
       interface_opts.snaplen = device.snaplen;
       interface_opts.has_snaplen = device.has_snaplen;
       interface_opts.promisc_mode = device.pmode;
+      interface_opts.if_type = device.if_info.type;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
       interface_opts.buffer_size =  device.buffer;
 #endif
index 06e81698992967e0d3b67801390f8bf2ca87d9dd..771cdfd69b7f8be0586dd769f41deb6d2899ffc4 100644 (file)
@@ -147,6 +147,7 @@ typedef struct interface_options_tag {
     int snaplen;
     int linktype;
     gboolean promisc_mode;
+    interface_type if_type;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
     int buffer_size;
 #endif
index a55318cf5ff8ee337a23f592392711ca65e13262..2dcf7498c75f414363020fc21c792d8a63d1ee6b 100644 (file)
@@ -116,6 +116,7 @@ scan_local_interfaces(void (*update_cb)(void))
         temp->friendly_name = g_strdup(if_info->friendly_name);
         temp->vendor_description = g_strdup(if_info->vendor_description);
         temp->loopback = if_info->loopback;
+        temp->type = if_info->type;
         /* Is this interface hidden and, if so, should we include it anyway? */
 
         /* Do we have a user-supplied description? */