aboutsummaryrefslogtreecommitdiffstats
path: root/capture_ui_utils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-11-22 06:02:49 +0000
committerGuy Harris <guy@alum.mit.edu>2012-11-22 06:02:49 +0000
commitbd976ae6c06b2111bd82df16b77739731dc17402 (patch)
tree406d65d00129abb45868150687f267a139bbf670 /capture_ui_utils.c
parentb9e8e95ffe9f352cde5847d458081826523cf46f (diff)
On UN*X, if an interface has a description, use it as the "friendly
name". If it doesn't have a description, on OS X, use the System Configuration framework to attempt to get a "friendly name" for interfaces. If a loopback device doesn't have a friendly name, give it "Loopback" as the friendly name. Move the "turn a CFString into a mallocated C string" routine into common code, as it's used in more than one place. svn path=/trunk/; revision=46131
Diffstat (limited to 'capture_ui_utils.c')
-rw-r--r--capture_ui_utils.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/capture_ui_utils.c b/capture_ui_utils.c
index 7af80a9a72..922f4aecd5 100644
--- a/capture_ui_utils.c
+++ b/capture_ui_utils.c
@@ -180,14 +180,18 @@ get_interface_descriptive_name(const char *if_name)
do {
if_info = if_entry->data;
if (strcmp(if_info->name, if_name) == 0) {
- if (if_info->friendly_name!= NULL) {
- /* use the friendly name */
+ if (if_info->friendly_name != NULL) {
+ /* We have a "friendly name"; return a copy of that
+ as the description - when we free the interface
+ list, that'll also free up the strings to which
+ it refers. */
descr = g_strdup(if_info->friendly_name);
- }else if (if_info->description != NULL) {
- /* Return a copy of that - when we free the interface
- list, that'll also free up the strings to which
- it refers. */
- descr = g_strdup(if_info->description);
+ } else if (if_info->vendor_description != NULL) {
+ /* We have no "friendly name", but we have a vendor
+ description; return a copy of that - when we free
+ the interface list, that'll also free up the strings
+ to which it refers. */
+ descr = g_strdup(if_info->vendor_description);
}
break;
}
@@ -243,9 +247,9 @@ build_capture_combo_name(GList *if_list, gchar *if_name)
/* No, we don't have a user-supplied description; did we get
one from the OS or libpcap? */
if_info = search_info(if_list, if_name);
- if (if_info != NULL && if_info->description != NULL) {
+ if (if_info != NULL && if_info->vendor_description != NULL) {
/* Yes - use it. */
- if_string = g_strdup_printf("%s: %s", if_info->description,
+ if_string = g_strdup_printf("%s: %s", if_info->vendor_description,
if_info->name);
} else {
/* No. */
@@ -287,9 +291,10 @@ build_capture_combo_list(GList *if_list, gboolean do_hide)
} else {
/* No, we don't have a user-supplied description; did we get
one from the OS or libpcap? */
- if (if_info->description != NULL) {
+ if (if_info->vendor_description != NULL) {
/* Yes - use it. */
- if_string = g_strdup_printf("%s: %s", if_info->description,
+ if_string = g_strdup_printf("%s: %s",
+ if_info->vendor_description,
if_info->name);
} else {
/* No. */