wireshark/capture/capture_ifinfo.c

361 lines
12 KiB
C
Raw Normal View History

/* capture_ifinfo.c
* Routines for getting interface information from dumpcap
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
Refactor our logging and extend the wslog API Experience has shown that: 1. The current logging methods are not very reliable or practical. A logging bitmask makes little sense as the user-facing interface (who would want debug but not crtical messages for example?); it's computer-friendly and user-unfriendly. More importantly the console log level preference is initialized too late in the startup process to be used for the logging subsystem and that fact raises a number of annoying and hard-to-fix usability issues. 2. Coding around G_MESSAGES_DEBUG to comply with our log level mask and not clobber the user's settings or not create unexpected log misses is unworkable and generally follows the principle of most surprise. The fact that G_MESSAGES_DEBUG="all" can leak to other programs using GLib is also annoying. 3. The non-structured GLib logging API is very opinionated and lacks configurability beyond replacing the log handler. 4. Windows GUI has some special code to attach to a console, but it would be nice to abstract away the rest under a single interface. 5. Using this logger seems to be noticeably faster. Deprecate the console log level preference and extend our API to implement a log handler in wsutil/wslog.h to provide easy-to-use, flexible and dependable logging during all execution phases. Log levels have a hierarchy, from most verbose to least verbose (debug to error). When a given level is set everything above that is also enabled. The log level can be set with an environment variable or a command line option (parsed as soon as possible but still later than the environment). The default log level is "message". Dissector logging is not included because it is not clear what log domain they should use. An explosion to thousands of domains is not desirable and putting everything in a single domain is probably too coarse and noisy. For now I think it makes sense to let them do their own thing using g_log_default_handler() and continue using the G_MESSAGES_DEBUG mechanism with specific domains for each individual dissector. In the future a mechanism may be added to selectively enable these domains at runtime while trying to avoid the problems introduced by G_MESSAGES_DEBUG.
2021-06-08 01:46:52 +00:00
#define WS_LOG_DOMAIN LOG_DOMAIN_CAPTURE
#ifdef HAVE_LIBPCAP
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <glib.h>
#include "capture_opts.h"
#include "capture/capture_session.h"
#include "capture/capture_sync.h"
Extcap Capture Interface Extcap is a plugin interface, which allows for the usage of external capture interfaces via pipes using a predefined configuration language which results in a graphical gui. This implementation seeks for a generic implementation, which results in a seamless integration with the current system, and does add all external interfaces as simple interfaces. Windows Note: Due to limitations with GTK and Windows, a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe is needed, which is part of any GTK windows installation. The default installation directory from the build is an extcap subdirectory underneath the run directory. The folder used by extcap may be viewed in the folders tab of the about dialog. The default installation directory for extcap plugins with a pre-build or installer version of wireshark is the extcap subdirectory underneath the main wireshark directory. For more information see: http://youtu.be/Nn84T506SwU bug #9009 Also take a look in doc/extcap_example.py for a Python-example and in extcap.pod for the arguments grammer. Todo: - Integrate with Qt - currently no GUI is generated, but the interfaces are still usable Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net> Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net> Signed-off-by: Roland Knall <rknall@gmail.com> Reviewed-on: https://code.wireshark.org/review/359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-02-25 13:05:11 +00:00
#include "extcap.h"
#include <capture/capture_ifinfo.h>
#include <wsutil/inet_addr.h>
#ifdef HAVE_PCAP_REMOTE
static GList *remote_interface_list = NULL;
static GList * append_remote_list(GList *iflist)
{
GSList *list;
GList *rlist;
if_addr_t *if_addr, *temp_addr;
if_info_t *if_info, *temp;
for (rlist = g_list_nth(remote_interface_list, 0); rlist != NULL; rlist = g_list_next(rlist)) {
if_info = (if_info_t *)rlist->data;
temp = g_new0(if_info_t, 1);
temp->name = g_strdup(if_info->name);
temp->friendly_name = g_strdup(if_info->friendly_name);
temp->vendor_description = g_strdup(if_info->vendor_description);
for (list = g_slist_nth(if_info->addrs, 0); list != NULL; list = g_slist_next(list)) {
temp_addr = g_new0(if_addr_t, 1);
if_addr = (if_addr_t *)list->data;
if (if_addr) {
temp_addr->ifat_type = if_addr->ifat_type;
if (temp_addr->ifat_type == IF_AT_IPv4) {
temp_addr->addr.ip4_addr = if_addr->addr.ip4_addr;
} else {
memcpy(temp_addr->addr.ip6_addr, if_addr->addr.ip6_addr, sizeof(if_addr->addr));
}
} else {
g_free(temp_addr);
temp_addr = NULL;
}
if (temp_addr) {
temp->addrs = g_slist_append(temp->addrs, temp_addr);
}
}
temp->loopback = if_info->loopback;
iflist = g_list_append(iflist, temp);
}
return iflist;
}
#endif
/**
* Fetch the interface list from a child process (dumpcap).
*
* @return A GList containing if_info_t structs if successful, NULL (with err and possibly err_str set) otherwise.
*
*/
/* XXX - We parse simple text output to get our interface list. Should
* we use "real" data serialization instead, e.g. via XML? */
GList *
capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
{
int ret;
GList *if_list = NULL;
int i, j;
gchar *data, *primary_msg, *secondary_msg;
gchar **raw_list, **if_parts, **addr_parts;
gchar *name;
if_info_t *if_info;
if_addr_t *if_addr;
*err = 0;
if (err_str) {
*err_str = NULL;
}
/* Try to get our interface list */
ret = sync_interface_list_open(&data, &primary_msg, &secondary_msg, update_cb);
if (ret != 0) {
/* Add the extcap interfaces that can exist, even if no native interfaces have been found */
ws_info("Loading External Capture Interface List ...");
if_list = append_extcap_interface_list(if_list, err_str);
/* err_str is ignored, as the error for the interface loading list will take precedence */
if ( g_list_length(if_list) == 0 ) {
ws_info("Capture Interface List failed. Error %d, %s (%s)",
*err, primary_msg ? primary_msg : "no message",
secondary_msg ? secondary_msg : "no secondary message");
if (err_str) {
*err_str = primary_msg;
} else {
g_free(primary_msg);
}
g_free(secondary_msg);
*err = CANT_GET_INTERFACE_LIST;
}
return if_list;
}
/* Split our lines */
#ifdef _WIN32
raw_list = g_strsplit(data, "\r\n", 0);
#else
raw_list = g_strsplit(data, "\n", 0);
#endif
g_free(data);
for (i = 0; raw_list[i] != NULL; i++) {
Extcap Capture Interface Extcap is a plugin interface, which allows for the usage of external capture interfaces via pipes using a predefined configuration language which results in a graphical gui. This implementation seeks for a generic implementation, which results in a seamless integration with the current system, and does add all external interfaces as simple interfaces. Windows Note: Due to limitations with GTK and Windows, a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe is needed, which is part of any GTK windows installation. The default installation directory from the build is an extcap subdirectory underneath the run directory. The folder used by extcap may be viewed in the folders tab of the about dialog. The default installation directory for extcap plugins with a pre-build or installer version of wireshark is the extcap subdirectory underneath the main wireshark directory. For more information see: http://youtu.be/Nn84T506SwU bug #9009 Also take a look in doc/extcap_example.py for a Python-example and in extcap.pod for the arguments grammer. Todo: - Integrate with Qt - currently no GUI is generated, but the interfaces are still usable Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net> Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net> Signed-off-by: Roland Knall <rknall@gmail.com> Reviewed-on: https://code.wireshark.org/review/359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-02-25 13:05:11 +00:00
if_parts = g_strsplit(raw_list[i], "\t", 7);
if (if_parts[0] == NULL || if_parts[1] == NULL || if_parts[2] == NULL ||
if_parts[3] == NULL || if_parts[4] == NULL || if_parts[5] == NULL ||
if_parts[6] == NULL) {
g_strfreev(if_parts);
continue;
}
/* Number followed by the name, e.g "1. eth0" */
name = strchr(if_parts[0], ' ');
if (name) {
name++;
} else {
g_strfreev(if_parts);
continue;
}
if_info = g_new0(if_info_t,1);
if_info->name = g_strdup(name);
if (strlen(if_parts[1]) > 0)
if_info->vendor_description = g_strdup(if_parts[1]);
From Mike Garratt: Friendly Names for interfaces on Windows Notes on the changes the patch covers: * if_info_t struct: addition of friendly_name * Dumpcap Interface list format changes: + Win32: "dumpcap -D" shows friendly_name in place of descript if known + All: machine interface "dumpcap -D -Z none" includes friendly_name in the list in addition to the existing parameters * interface_options struct: addition of console_display_name + When an interface name is displayed in a console, it will typically be the console_display_name (instead of name). + console_display_name is used as the basis of the autogenerated temp filenames + console_display_name is typically set to the friendly_name if known, otherwise it is set to the interface name * Enhancements to capture_opts_add_iface_opt() (the function which process -i options). + Can now specify the interface using its name and friendly_name + Interface name matching is case insenstive + Name matching first attempts exact matching, then falls back to prefix matching (e.g. dumpcap -i local) + Validates interface names, instead of blindly sending them off to winpcap/libpcap + Interface specification by number is still supported. * capture_opts_trim_iface() has been refactored: + Instead of repeating a decent chunk of the cost in capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the interface. * introduction of capture_win_ifnames.[ch] (windows only code) + Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a windows version independant function to convert an interface guid into its friendly name. Uses published api functions on windows vista and higher, but falls back to unpublished API functions on older windows releases. + void get_windows_interface_friendlyname(/* IN */ char *interface_devicename, /* OUT */char **interface_friendlyname); - extracts the GUID from the interface_devicename, then uses GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution * Auto temp filename generation: + Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format + Basis temp filename format on console_display_name + Win32: if console_display_name is a windows interface guid, extracts numbers from GUID here (instead of in interface option processing) GUI CHANGES: * Dialog that displays when you click the "Manage Interfaces" button (within Capture Options dialog) has been renamed from "Add new interfaces" to "Interface Management" * ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to interface_management_w * Win32: Local Interfaces tab on Interface Management dialog, shows includes friendly name as far left column * Interface Management dialog defaults to larger size on win32 - so it fits without resizing local interfaces tab * Interface Management dialog now saves preferences when you click the apply button (local hidden interfaces was not persisting across restarts) * Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces -> Details): + "Friendly Name" renamed to "NDIS Friendly Name" + Added "OS Friendly Name" to the top of the list * Win32: The "Capture Interfaces" dialog now shows the friendly name instead of device guid * Welcome screen: + The height of the interface list scrollbox dynamically adjusts & updates to the number visible interfaces. Up to 10 interfaces can be listed without a scroll bar, the minimum height is for 2 interfaces. + Win32: now shows just the Friendly Name if known - in place of "Interfacename_Guid:(Description)" svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
if (strlen(if_parts[2]) > 0)
if_info->friendly_name = g_strdup(if_parts[2]);
if_info->type = (interface_type)(int)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 (ws_inet_pton4(addr_parts[j], &if_addr->addr.ip4_addr)) {
if_addr->ifat_type = IF_AT_IPv4;
} else if (ws_inet_pton6(addr_parts[j], (ws_in6_addr *)&if_addr->addr.ip6_addr)) {
if_addr->ifat_type = IF_AT_IPv6;
} else {
g_free(if_addr);
if_addr = NULL;
}
if (if_addr) {
if_info->addrs = g_slist_append(if_info->addrs, if_addr);
}
}
if (strcmp(if_parts[5], "loopback") == 0)
if_info->loopback = TRUE;
Extcap Capture Interface Extcap is a plugin interface, which allows for the usage of external capture interfaces via pipes using a predefined configuration language which results in a graphical gui. This implementation seeks for a generic implementation, which results in a seamless integration with the current system, and does add all external interfaces as simple interfaces. Windows Note: Due to limitations with GTK and Windows, a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe is needed, which is part of any GTK windows installation. The default installation directory from the build is an extcap subdirectory underneath the run directory. The folder used by extcap may be viewed in the folders tab of the about dialog. The default installation directory for extcap plugins with a pre-build or installer version of wireshark is the extcap subdirectory underneath the main wireshark directory. For more information see: http://youtu.be/Nn84T506SwU bug #9009 Also take a look in doc/extcap_example.py for a Python-example and in extcap.pod for the arguments grammer. Todo: - Integrate with Qt - currently no GUI is generated, but the interfaces are still usable Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net> Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net> Signed-off-by: Roland Knall <rknall@gmail.com> Reviewed-on: https://code.wireshark.org/review/359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-02-25 13:05:11 +00:00
if_info->extcap = g_strdup(if_parts[6]);
g_strfreev(if_parts);
g_strfreev(addr_parts);
if_list = g_list_append(if_list, if_info);
}
g_strfreev(raw_list);
#ifdef HAVE_PCAP_REMOTE
if (remote_interface_list && g_list_length(remote_interface_list) > 0) {
if_list = append_remote_list(if_list);
}
#endif
/* Add the extcap interfaces after the native and remote interfaces */
ws_info("Loading External Capture Interface List ...");
if_list = append_extcap_interface_list(if_list, err_str);
return if_list;
}
/* XXX - We parse simple text output to get our interface list. Should
* we use "real" data serialization instead, e.g. via XML? */
if_capabilities_t *
capture_get_if_capabilities(const gchar *ifname, gboolean monitor_mode,
const gchar *auth_string,
char **err_primary_msg, char **err_secondary_msg,
void (*update_cb)(void))
{
if_capabilities_t *caps;
GList *linktype_list = NULL, *timestamp_list = NULL;
int err, i;
gchar *data, *primary_msg, *secondary_msg;
gchar **raw_list;
Extcap Capture Interface Extcap is a plugin interface, which allows for the usage of external capture interfaces via pipes using a predefined configuration language which results in a graphical gui. This implementation seeks for a generic implementation, which results in a seamless integration with the current system, and does add all external interfaces as simple interfaces. Windows Note: Due to limitations with GTK and Windows, a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe is needed, which is part of any GTK windows installation. The default installation directory from the build is an extcap subdirectory underneath the run directory. The folder used by extcap may be viewed in the folders tab of the about dialog. The default installation directory for extcap plugins with a pre-build or installer version of wireshark is the extcap subdirectory underneath the main wireshark directory. For more information see: http://youtu.be/Nn84T506SwU bug #9009 Also take a look in doc/extcap_example.py for a Python-example and in extcap.pod for the arguments grammer. Todo: - Integrate with Qt - currently no GUI is generated, but the interfaces are still usable Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net> Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net> Signed-off-by: Roland Knall <rknall@gmail.com> Reviewed-on: https://code.wireshark.org/review/359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-02-25 13:05:11 +00:00
/* see if the interface is from extcap */
caps = extcap_get_if_dlts(ifname, err_primary_msg);
Extcap Capture Interface Extcap is a plugin interface, which allows for the usage of external capture interfaces via pipes using a predefined configuration language which results in a graphical gui. This implementation seeks for a generic implementation, which results in a seamless integration with the current system, and does add all external interfaces as simple interfaces. Windows Note: Due to limitations with GTK and Windows, a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe is needed, which is part of any GTK windows installation. The default installation directory from the build is an extcap subdirectory underneath the run directory. The folder used by extcap may be viewed in the folders tab of the about dialog. The default installation directory for extcap plugins with a pre-build or installer version of wireshark is the extcap subdirectory underneath the main wireshark directory. For more information see: http://youtu.be/Nn84T506SwU bug #9009 Also take a look in doc/extcap_example.py for a Python-example and in extcap.pod for the arguments grammer. Todo: - Integrate with Qt - currently no GUI is generated, but the interfaces are still usable Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net> Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net> Signed-off-by: Roland Knall <rknall@gmail.com> Reviewed-on: https://code.wireshark.org/review/359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-02-25 13:05:11 +00:00
if (caps != NULL)
return caps;
/* return if the extcap interface generated an error */
if (err_primary_msg != NULL && *err_primary_msg != NULL)
Extcap Capture Interface Extcap is a plugin interface, which allows for the usage of external capture interfaces via pipes using a predefined configuration language which results in a graphical gui. This implementation seeks for a generic implementation, which results in a seamless integration with the current system, and does add all external interfaces as simple interfaces. Windows Note: Due to limitations with GTK and Windows, a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe is needed, which is part of any GTK windows installation. The default installation directory from the build is an extcap subdirectory underneath the run directory. The folder used by extcap may be viewed in the folders tab of the about dialog. The default installation directory for extcap plugins with a pre-build or installer version of wireshark is the extcap subdirectory underneath the main wireshark directory. For more information see: http://youtu.be/Nn84T506SwU bug #9009 Also take a look in doc/extcap_example.py for a Python-example and in extcap.pod for the arguments grammer. Todo: - Integrate with Qt - currently no GUI is generated, but the interfaces are still usable Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net> Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net> Signed-off-by: Roland Knall <rknall@gmail.com> Reviewed-on: https://code.wireshark.org/review/359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-02-25 13:05:11 +00:00
return NULL;
/* Try to get our interface list */
err = sync_if_capabilities_open(ifname, monitor_mode, auth_string, &data,
&primary_msg, &secondary_msg, update_cb);
if (err != 0) {
ws_info("Capture Interface Capabilities failed. Error %d, %s",
err, primary_msg ? primary_msg : "no message");
if (err_primary_msg)
*err_primary_msg = primary_msg;
else
g_free(primary_msg);
if (err_secondary_msg)
*err_secondary_msg = secondary_msg;
else
g_free(secondary_msg);
return NULL;
}
/* Split our lines */
#ifdef _WIN32
raw_list = g_strsplit(data, "\r\n", 0);
#else
raw_list = g_strsplit(data, "\n", 0);
#endif
g_free(data);
/*
* First line is 0 if monitor mode isn't supported, 1 if it is.
*/
if (raw_list[0] == NULL || *raw_list[0] == '\0') {
ws_info("Capture Interface Capabilities returned no information.");
if (err_primary_msg) {
*err_primary_msg = g_strdup("Dumpcap returned no interface capability information");
}
g_strfreev(raw_list);
return NULL;
}
/*
* Allocate the interface capabilities structure.
*/
caps = (if_capabilities_t *)g_malloc(sizeof *caps);
switch (*raw_list[0]) {
case '0':
caps->can_set_rfmon = FALSE;
break;
case '1':
caps->can_set_rfmon = TRUE;
break;
default:
ws_info("Capture Interface Capabilities returned bad information.");
if (err_primary_msg) {
*err_primary_msg = ws_strdup_printf("Dumpcap returned \"%s\" for monitor-mode capability",
raw_list[0]);
}
g_free(caps);
g_strfreev(raw_list);
return NULL;
}
/*
* The following are link-layer types.
*/
for (i = 1; raw_list[i] != NULL && *raw_list[i] != '\0'; i++) {
data_link_info_t *data_link_info;
/* ...and what if the interface name has a tab in it, Mr. Clever Programmer? */
char **lt_parts = g_strsplit(raw_list[i], "\t", 3);
if (lt_parts[0] == NULL || lt_parts[1] == NULL || lt_parts[2] == NULL) {
g_strfreev(lt_parts);
continue;
}
data_link_info = g_new(data_link_info_t,1);
data_link_info->dlt = (int) strtol(lt_parts[0], NULL, 10);
data_link_info->name = g_strdup(lt_parts[1]);
if (strcmp(lt_parts[2], "(not supported)") != 0)
data_link_info->description = g_strdup(lt_parts[2]);
else
data_link_info->description = NULL;
g_strfreev(lt_parts);
linktype_list = g_list_append(linktype_list, data_link_info);
}
if (raw_list[i]) { /* Oh, timestamp types! */
for (i++; raw_list[i] != NULL && *raw_list[i] != '\0'; i++) {
timestamp_info_t *timestamp_info;
char **tt_parts = g_strsplit(raw_list[i], "\t", 2);
if (tt_parts[0] == NULL || tt_parts[1] == NULL) {
g_strfreev(tt_parts);
continue;
}
timestamp_info = g_new(timestamp_info_t,1);
timestamp_info->name = g_strdup(tt_parts[0]);
timestamp_info->description = g_strdup(tt_parts[1]);
g_strfreev(tt_parts);
timestamp_list = g_list_append(timestamp_list, timestamp_info);
}
}
g_strfreev(raw_list);
caps->data_link_types = linktype_list;
/* Might be NULL. Not all systems report timestamp types */
caps->timestamp_types = timestamp_list;
return caps;
}
#ifdef HAVE_PCAP_REMOTE
void add_interface_to_remote_list(if_info_t *if_info)
{
GSList *list;
if_addr_t *if_addr, *temp_addr;
if_info_t *temp = g_new0(if_info_t, 1);
temp->name = g_strdup(if_info->name);
temp->friendly_name = g_strdup(if_info->friendly_name);
temp->vendor_description = g_strdup(if_info->vendor_description);
for (list = g_slist_nth(if_info->addrs, 0); list != NULL; list = g_slist_next(list)) {
temp_addr = g_new0(if_addr_t, 1);
if_addr = (if_addr_t *)list->data;
if (if_addr) {
temp_addr->ifat_type = if_addr->ifat_type;
if (temp_addr->ifat_type == IF_AT_IPv4) {
temp_addr->addr.ip4_addr = if_addr->addr.ip4_addr;
} else {
memcpy(temp_addr->addr.ip6_addr, if_addr->addr.ip6_addr, sizeof(if_addr->addr));
}
} else {
g_free(temp_addr);
temp_addr = NULL;
}
if (temp_addr) {
temp->addrs = g_slist_append(temp->addrs, temp_addr);
}
}
temp->loopback = if_info->loopback;
remote_interface_list = g_list_append(remote_interface_list, temp);
}
#endif
#endif /* HAVE_LIBPCAP */