diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-11-25 21:21:25 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-11-25 21:21:25 +0000 |
commit | 2c9ea8a51fc4fbeabd37f9aad6f00fdbfa7bb6c1 (patch) | |
tree | f08e078cd9b648cb1ac7fa75f8af7ae286a6a41a /ui/iface_lists.c | |
parent | 5e65315e29c35ebf4ca2946c1fb81992d1e47f6c (diff) |
If we don't have any preference set for the link-layer header type for
an interface, don't destroy the default link-layer header type from the
list of types.
I.e., first get the type from the preference (which sets the type to -1
if there isn't a preference), and then loop through the list of types
and, if there was no value obtained from the preference (i.e., the type
is -1), set it to the first type in the list.
Also, don't bother with the link-layer header type from the global
default options, as a global (all-interface) link-layer header type
makes little sense, given that the list of link-layer header types for
an interface depends on the type of interface and hence may differ from
interface to interface.
Fixes bug 9473.
svn path=/trunk/; revision=53581
Diffstat (limited to 'ui/iface_lists.c')
-rw-r--r-- | ui/iface_lists.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ui/iface_lists.c b/ui/iface_lists.c index baefd24f0d..bfdfe294b0 100644 --- a/ui/iface_lists.c +++ b/ui/iface_lists.c @@ -213,9 +213,27 @@ scan_local_interfaces(void (*update_cb)(void)) device.monitor_mode_enabled = monitor_mode; device.monitor_mode_supported = caps->can_set_rfmon; #endif + /* + * If there's a preference for the link-layer header type for + * this interface, use it. + * + * The global capture options has a link-layer header type, + * but that's just because the capture options structure + * has one; a global link-layer header type makes little + * sense, as not all interfaces support the same sets of + * link-layer header types, so we don't use it. + */ + device.active_dlt = capture_dev_user_linktype_find(if_info->name); + + /* + * Process the list of link-layer header types. + * If the active link-layer header type wasn't set from a + * preference (meaning it's -1), default to the first + * link-layer header type in the list. + */ for (lt_entry = caps->data_link_types; lt_entry != NULL; lt_entry = g_list_next(lt_entry)) { data_link_info = (data_link_info_t *)lt_entry->data; - if (linktype_count == 0) { + if (linktype_count == 0 && device.active_dlt == -1) { device.active_dlt = data_link_info->dlt; } link = (link_row *)g_malloc(sizeof(link_row)); @@ -229,11 +247,6 @@ scan_local_interfaces(void (*update_cb)(void)) device.links = g_list_append(device.links, link); linktype_count++; } - if (linktype_count > 0) { - if ((device.active_dlt = capture_dev_user_linktype_find(if_info->name)) == -1) { - device.active_dlt = global_capture_opts.default_options.linktype; - } - } } else { #if defined(HAVE_PCAP_CREATE) device.monitor_mode_enabled = FALSE; |