Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 30846: /trunk/gtk/ /trunk/gtk/: capt

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sat, 7 Nov 2009 11:45:45 -0800

On Nov 7, 2009, at 10:38 AM, Gerald Combs wrote:

In capture_interface_list we don't set the interface description if we
get an empty string from dumpcap:

        if (strlen(if_parts[1]) > 0)
            if_info->description = g_strdup(if_parts[1]);

Hmm.

Looking at capture_opts_list_interfaces(), which is what dumpcap uses to list the interfaces, if it's generating (more easily) machine- readable output, the output generated for a missing description (if_info->description is null) and the output generated for an empty description (if_info->description points to a null string) are the same.

This is apparently how we ended up with null description pointers in
capture_get_if_icon. Should we take out the if statement and set the
description no matter what?

An empty description is no more useful than a null description, and, as indicated, pcap_findalldevs() doesn't guarantee that it will return a description for every adapter, so I wouldn't be inclined to do that; I'd be inclined to leave the if statement there.

(I'm thinking of redoing the way that dumpcap communicates with its callers for various reasons, including adding support for all the new stuff I added in libpcap 1.0, so, for example, we can have a "monitor mode" checkbox for wireless adapters if the relevant APIs work; I'll see if I can distinguish between "no description" and "empty description".)

I'm also curious how the description managed to be null - at least according to the bug report, Marvell *does* supply a description:

   Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : Marvell Yukon 88E8056 PCI-E Gigabit Ethernet Controller
   Physical Address. . . . . . . . . : 00-22-15-##-##-##
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::####::####.....
   IPv4 Address. . . . . . . . . . . : a.b.c.h(Preferred)
   Subnet Mask . . . . . . . . . . . : w.x.y.z
   Lease Obtained. . . . . . . . . . : 06 November 2009 18:38:00
   Lease Expires . . . . . . . . . . : 09 November 2009 18:37:59
   Default Gateway . . . . . . . . . : a.b.c.d
   DHCP Server . . . . . . . . . . . : a.b.c.d
   DNS Servers . . . . . . . . . . . : a.b.c.d
   NetBIOS over Tcpip. . . . . . . . : Enabled

so there's presumably something odd going on in WinPcap here.