* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
- * SPDX-License-Identifier: GPL-2.0+
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config.h>
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include "ui/iface_toolbar.h"
-#include <wsutil/glib-compat.h>
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
+#include <wsutil/ws_pipe.h>
#include <wsutil/tempfile.h>
#include "capture_opts.h"
#include "extcap.h"
#include "extcap_parser.h"
-#include "extcap_spawn.h"
+
+#include "version_info.h"
#ifdef _WIN32
static HANDLE pipe_h = INVALID_HANDLE_VALUE;
GHashTable *
extcap_loaded_interfaces(void)
{
+ if (prefs.capture_no_extcap)
+ return NULL;
+
if ( !_loaded_interfaces || g_hash_table_size(_loaded_interfaces) == 0 )
extcap_load_interface_list();
if (control->ctrl_type == INTERFACE_TYPE_STRING) {
g_free(control->default_value.string);
}
- g_list_foreach(control->values, (GFunc)extcap_free_toolbar_value, NULL);
- g_list_free(control->values);
+ g_list_free_full(control->values, (GDestroyNotify)extcap_free_toolbar_value);
g_free(control);
}
g_free(toolbar->menu_title);
g_free(toolbar->help);
g_list_free_full(toolbar->ifnames, g_free);
- g_list_foreach(toolbar->controls, (GFunc)extcap_free_toolbar_control, NULL);
- g_list_free(toolbar->controls);
+ g_list_free_full(toolbar->controls, (GDestroyNotify)extcap_free_toolbar_control);
g_free(toolbar);
}
g_free(toolname);
}
+static gchar **
+extcap_convert_arguments_to_array(GList * arguments)
+{
+ gchar ** result = NULL;
+ if ( arguments )
+ {
+ GList * walker = g_list_first(arguments);
+ int cnt = 0;
+
+ result = (gchar **) g_malloc0(sizeof(gchar *) * (g_list_length(arguments)));
+
+ while(walker)
+ {
+ result[cnt] = g_strdup((const gchar *)walker->data);
+ walker = g_list_next(walker);
+ cnt++;
+ }
+ }
+ return result;
+}
+
+static void extcap_free_array(gchar ** args, int argc)
+{
+ int cnt = 0;
+
+ for ( cnt = 0; cnt < argc; cnt++ )
+ g_free(args[cnt]);
+ g_free(args);
+}
+
/* Note: args does not need to be NULL-terminated. */
-static gboolean extcap_foreach(gint argc, gchar **args,
- extcap_cb_t cb, extcap_callback_info_t cb_info)
+static gboolean extcap_foreach(GList * arguments,
+ extcap_cb_t cb, extcap_callback_info_t cb_info, GList * fallback_arguments)
{
GDir *dir;
gboolean keep_going;
keep_going = TRUE;
- if ((dir = g_dir_open(dirname, 0, NULL)) != NULL)
+ if (arguments && (dir = g_dir_open(dirname, 0, NULL)) != NULL)
{
GString *extcap_path = NULL;
const gchar *file;
+ gchar ** args = extcap_convert_arguments_to_array(arguments);
+ int cnt = g_list_length(arguments);
extcap_path = g_string_new("");
while (keep_going && (file = g_dir_read_name(dir)) != NULL)
continue;
}
- if (extcap_spawn_sync((gchar *) dirname, extcap_path->str, argc, args, &command_output))
+ if (ws_pipe_spawn_sync((gchar *) dirname, extcap_path->str, cnt, args, &command_output))
{
cb_info.output = command_output;
cb_info.extcap = extcap_path->str;
keep_going = cb(cb_info);
}
+ else if ( fallback_arguments )
+ {
+ gchar ** fb_args = extcap_convert_arguments_to_array(fallback_arguments);
+
+ if (ws_pipe_spawn_sync((gchar *) dirname, extcap_path->str, g_list_length(fallback_arguments), fb_args, &command_output))
+ {
+ cb_info.output = command_output;
+ cb_info.extcap = extcap_path->str;
+
+ keep_going = cb(cb_info);
+ }
+ }
g_free(command_output);
}
+
}
+ extcap_free_array(args, cnt);
g_dir_close(dir);
g_string_free(extcap_path, TRUE);
if_capabilities_t *
extcap_get_if_dlts(const gchar *ifname, char **err_str)
{
- gchar *argv[3];
- gint i;
+ GList * arguments = NULL;
if_capabilities_t *caps = NULL;
if (err_str != NULL)
if (extcap_if_exists(ifname))
{
- argv[0] = g_strdup(EXTCAP_ARGUMENT_LIST_DLTS);
- argv[1] = g_strdup(EXTCAP_ARGUMENT_INTERFACE);
- argv[2] = g_strdup(ifname);
+ arguments = g_list_append(arguments, g_strdup(EXTCAP_ARGUMENT_LIST_DLTS));
+ arguments = g_list_append(arguments, g_strdup(EXTCAP_ARGUMENT_INTERFACE));
+ arguments = g_list_append(arguments, g_strdup(ifname));
extcap_callback_info_t cb_info;
cb_info.data = ∩︀
cb_info.err_str = err_str;
cb_info.ifname = ifname;
- extcap_foreach(3, argv, cb_dlt, cb_info);
+ extcap_foreach(arguments, cb_dlt, cb_info, NULL);
- for (i = 0; i < 3; ++i)
- {
- g_free(argv[i]);
- }
+ g_list_free_full(arguments, g_free);
}
return caps;
return;
}
- g_list_foreach(interfaces, (GFunc)extcap_free_interface, NULL);
- g_list_free(interfaces);
+ g_list_free_full(interfaces, extcap_free_interface);
}
static gint
extcap_interface *data = NULL;
GList *ifutilkeys_head = NULL, *ifutilkeys = NULL;
+ if (prefs.capture_no_extcap)
+ return list;
+
/* Update the extcap interfaces and get a list of their if_infos */
if ( !_loaded_interfaces || g_hash_table_size(_loaded_interfaces) == 0 )
extcap_load_interface_list();
void extcap_register_preferences(void)
{
+ if (prefs.capture_no_extcap)
+ return;
+
module_t *dev_module = prefs_find_module("extcap");
if (!dev_module)
GList *
extcap_get_if_configuration(const char *ifname)
{
- gchar *argv[3];
+ GList * arguments = NULL;
GList *ret = NULL;
gchar **err_str = NULL;
- int i;
if (extcap_if_exists(ifname))
{
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Extcap path %s",
get_extcap_dir());
- argv[0] = g_strdup(EXTCAP_ARGUMENT_CONFIG);
- argv[1] = g_strdup(EXTCAP_ARGUMENT_INTERFACE);
- argv[2] = g_strdup(ifname);
+ arguments = g_list_append(arguments, g_strdup(EXTCAP_ARGUMENT_CONFIG));
+ arguments = g_list_append(arguments, g_strdup(EXTCAP_ARGUMENT_INTERFACE));
+ arguments = g_list_append(arguments, g_strdup(ifname));
extcap_callback_info_t cb_info;
cb_info.data = &ret;
cb_info.err_str = err_str;
cb_info.ifname = ifname;
- extcap_foreach(3, argv, cb_preference, cb_info);
+ extcap_foreach(arguments, cb_preference, cb_info, NULL);
- for (i = 0; i < 3; i++)
+ g_list_free_full(arguments, g_free);
+ }
+
+ return ret;
+}
+
+static gboolean cb_reload_preference(extcap_callback_info_t cb_info)
+{
+ GList *arguments = NULL, * walker = NULL;
+ GList **il = (GList **) cb_info.data;
+
+ arguments = extcap_parse_values(cb_info.output);
+
+ walker = g_list_first((GList *)(arguments));
+ while (walker != NULL)
+ {
+ extcap_value * val = (extcap_value *)walker->data;
+ *il = g_list_append(*il, val);
+ walker = g_list_next(walker);
+ }
+ g_list_free(arguments);
+
+ /* By returning false, extcap_foreach will break on first found */
+ return FALSE;
+}
+
+GList *
+extcap_get_if_configuration_values(const char * ifname, const char * argname, GHashTable *arguments)
+{
+ GList * args = NULL;
+ GList *ret = NULL;
+ gchar **err_str = NULL;
+
+ if (extcap_if_exists(ifname))
+ {
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Extcap path %s",
+ get_extcap_dir());
+
+ args = g_list_append(args, g_strdup(EXTCAP_ARGUMENT_CONFIG));
+ args = g_list_append(args, g_strdup(EXTCAP_ARGUMENT_INTERFACE));
+ args = g_list_append(args, g_strdup(ifname));
+ args = g_list_append(args, g_strdup(EXTCAP_ARGUMENT_RELOAD_OPTION));
+ args = g_list_append(args, g_strdup(argname));
+
+ if ( arguments )
{
- g_free(argv[i]);
+ GList * keys = g_hash_table_get_keys(arguments);
+ while ( keys )
+ {
+ const gchar * key_data = (const gchar *)keys->data;
+ args = g_list_append(args, g_strdup(key_data));
+ args = g_list_append(args, g_strdup((const gchar *)g_hash_table_lookup(arguments, key_data)));
+ keys = g_list_next(keys);
+ }
}
+
+ extcap_callback_info_t cb_info;
+ cb_info.data = &ret;
+ cb_info.err_str = err_str;
+ cb_info.ifname = ifname;
+
+ extcap_foreach(args, cb_reload_preference, cb_info, NULL);
+
+ g_list_free_full(args, g_free);
}
return ret;
extcap_filter_status
extcap_verify_capture_filter(const char *ifname, const char *filter, gchar **err_str)
{
- gchar *argv[4];
+ GList * arguments = NULL;
extcap_filter_status status = EXTCAP_FILTER_UNKNOWN;
if (extcap_if_exists(ifname))
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Extcap path %s",
get_extcap_dir());
- argv[0] = EXTCAP_ARGUMENT_CAPTURE_FILTER;
- argv[1] = (gchar*)filter;
- argv[2] = EXTCAP_ARGUMENT_INTERFACE;
- argv[3] = (gchar*)ifname;
+ arguments = g_list_append(arguments, g_strdup(EXTCAP_ARGUMENT_CAPTURE_FILTER));
+ arguments = g_list_append(arguments, g_strdup(filter));
+ arguments = g_list_append(arguments, g_strdup(EXTCAP_ARGUMENT_INTERFACE));
+ arguments = g_list_append(arguments, g_strdup(ifname));
extcap_callback_info_t cb_info;
cb_info.data = &status;
cb_info.err_str = err_str;
cb_info.ifname = ifname;
- extcap_foreach(4, argv, cb_verify_filter, cb_info);
+ extcap_foreach(arguments, cb_verify_filter, cb_info, NULL);
+ g_list_free_full(arguments, g_free);
}
return status;
return FALSE;
}
-/* taken from capchild/capture_sync.c */
-static gboolean pipe_data_available(int pipe_fd)
-{
-#ifdef _WIN32 /* PeekNamedPipe */
- HANDLE hPipe = (HANDLE) _get_osfhandle(pipe_fd);
- DWORD bytes_avail;
-
- if (hPipe == INVALID_HANDLE_VALUE)
- {
- return FALSE;
- }
-
- if (! PeekNamedPipe(hPipe, NULL, 0, NULL, &bytes_avail, NULL))
- {
- return FALSE;
- }
-
- if (bytes_avail > 0)
- {
- return TRUE;
- }
- return FALSE;
-#else /* select */
- fd_set rfds;
- struct timeval timeout;
-
- FD_ZERO(&rfds);
- FD_SET(pipe_fd, &rfds);
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
- if (select(pipe_fd + 1, &rfds, NULL, NULL, &timeout) > 0)
- {
- return TRUE;
- }
-
- return FALSE;
-#endif
-}
-
void extcap_if_cleanup(capture_options *capture_opts, gchar **errormsg)
{
interface_options *interface_opts;
- extcap_userdata *userdata;
+ ws_pipe_t *pipedata;
guint icnt = 0;
gboolean overwrite_exitcode;
gchar *buffer;
"Extcap [%s] - Closing spawned PID: %d", interface_opts->name,
interface_opts->extcap_pid);
- userdata = (extcap_userdata *) interface_opts->extcap_userdata;
- if (userdata)
+ pipedata = (ws_pipe_t *) interface_opts->extcap_pipedata;
+ if (pipedata)
{
- if (userdata->extcap_stderr_rd > 0 && pipe_data_available(userdata->extcap_stderr_rd))
+ if (pipedata->stderr_fd > 0 && ws_pipe_data_available(pipedata->stderr_fd))
{
- buffer = (gchar *)g_malloc0(sizeof(gchar) * STDERR_BUFFER_SIZE + 1);
-#ifdef _WIN32
- win32_readfrompipe((HANDLE)_get_osfhandle(userdata->extcap_stderr_rd), STDERR_BUFFER_SIZE, buffer);
-#else
- if (read(userdata->extcap_stderr_rd, buffer, sizeof(gchar) * STDERR_BUFFER_SIZE) <= 0)
- {
- buffer[0] = '\0';
- }
-#endif
+ buffer = (gchar *)g_malloc0(STDERR_BUFFER_SIZE + 1);
+ ws_read_string_from_pipe(ws_get_pipe_handle(pipedata->stderr_fd), buffer, STDERR_BUFFER_SIZE + 1);
if (strlen(buffer) > 0)
{
- userdata->extcap_stderr = g_strdup_printf("%s", buffer);
- userdata->exitcode = 1;
+ pipedata->stderr_msg = g_strdup_printf("%s", buffer);
+ pipedata->exitcode = 1;
}
g_free(buffer);
}
/* Final child watch may not have been called */
if (interface_opts->extcap_child_watch != 0)
{
- extcap_child_watch_cb(userdata->pid, 0, capture_opts);
+ extcap_child_watch_cb(pipedata->pid, 0, capture_opts);
/* it will have changed in extcap_child_watch_cb */
interface_opts = &g_array_index(capture_opts->ifaces, interface_options,
icnt);
}
#endif
- if (userdata->extcap_stderr != NULL)
+ if (pipedata->stderr_msg != NULL)
{
overwrite_exitcode = TRUE;
}
- if (overwrite_exitcode || userdata->exitcode != 0)
+ if (overwrite_exitcode || pipedata->exitcode != 0)
{
- if (userdata->extcap_stderr != 0)
+ if (pipedata->stderr_msg != 0)
{
if (*errormsg == NULL)
{
- *errormsg = g_strdup_printf("Error by extcap pipe: %s", userdata->extcap_stderr);
+ *errormsg = g_strdup_printf("Error by extcap pipe: %s", pipedata->stderr_msg);
}
else
{
- gchar *temp = g_strconcat(*errormsg, "\nError by extcap pipe: " , userdata->extcap_stderr, NULL);
+ gchar *temp = g_strconcat(*errormsg, "\nError by extcap pipe: " , pipedata->stderr_msg, NULL);
g_free(*errormsg);
*errormsg = temp;
}
- g_free(userdata->extcap_stderr);
+ g_free(pipedata->stderr_msg);
}
- userdata->extcap_stderr = NULL;
- userdata->exitcode = 0;
+ pipedata->stderr_msg = NULL;
+ pipedata->exitcode = 0;
}
}
interface_opts->extcap_child_watch = 0;
}
- if (interface_opts->extcap_pid != INVALID_EXTCAP_PID)
+ if (interface_opts->extcap_pid != WS_INVALID_PID)
{
#ifdef _WIN32
TerminateProcess(interface_opts->extcap_pid, 0);
#endif
g_spawn_close_pid(interface_opts->extcap_pid);
- interface_opts->extcap_pid = INVALID_EXTCAP_PID;
+ interface_opts->extcap_pid = WS_INVALID_PID;
- g_free(interface_opts->extcap_userdata);
- interface_opts->extcap_userdata = NULL;
+ g_free(interface_opts->extcap_pipedata);
+ interface_opts->extcap_pipedata = NULL;
}
}
}
{
guint i;
interface_options *interface_opts;
- extcap_userdata *userdata = NULL;
+ ws_pipe_t *pipedata = NULL;
capture_options *capture_opts = (capture_options *)(user_data);
if (capture_opts == NULL || capture_opts->ifaces == NULL || capture_opts->ifaces->len == 0)
interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
if (interface_opts->extcap_pid == pid)
{
- userdata = (extcap_userdata *)interface_opts->extcap_userdata;
- if (userdata != NULL)
+ pipedata = (ws_pipe_t *)interface_opts->extcap_pipedata;
+ if (pipedata != NULL)
{
- interface_opts->extcap_pid = INVALID_EXTCAP_PID;
- userdata->exitcode = 0;
+ interface_opts->extcap_pid = WS_INVALID_PID;
+ pipedata->exitcode = 0;
#ifndef _WIN32
if (WIFEXITED(status))
{
if (WEXITSTATUS(status) != 0)
{
- userdata->exitcode = WEXITSTATUS(status);
+ pipedata->exitcode = WEXITSTATUS(status);
}
}
else
{
- userdata->exitcode = G_SPAWN_ERROR_FAILED;
+ pipedata->exitcode = G_SPAWN_ERROR_FAILED;
}
#else
if (status != 0)
{
- userdata->exitcode = status;
+ pipedata->exitcode = status;
}
#endif
- if (status == 0 && userdata->extcap_stderr != NULL)
+ if (status == 0 && pipedata->stderr_msg != NULL)
{
- userdata->exitcode = 1;
+ pipedata->exitcode = 1;
}
}
g_source_remove(interface_opts->extcap_child_watch);
return result;
}
+static void ptr_array_free(gpointer data, gpointer user_data _U_)
+{
+ g_free(data);
+}
+
/* call mkfifo for each extcap,
* returns FALSE if there's an error creating a FIFO */
gboolean
{
guint i;
interface_options *interface_opts;
- extcap_userdata *userdata;
+ ws_pipe_t *pipedata;
for (i = 0; i < capture_opts->ifaces->len; i++)
{
GPtrArray *args = NULL;
- GPid pid = INVALID_EXTCAP_PID;
+ GPid pid = WS_INVALID_PID;
interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
if (extcap_has_toolbar(interface_opts->name))
{
extcap_create_pipe(interface_opts->name, &interface_opts->extcap_control_in,
- EXTCAP_CONTROL_IN_PREFIX, FALSE);
+ EXTCAP_CONTROL_IN_PREFIX);
#ifdef _WIN32
interface_opts->extcap_control_in_h = pipe_h;
#endif
extcap_create_pipe(interface_opts->name, &interface_opts->extcap_control_out,
- EXTCAP_CONTROL_OUT_PREFIX, FALSE);
+ EXTCAP_CONTROL_OUT_PREFIX);
#ifdef _WIN32
interface_opts->extcap_control_out_h = pipe_h;
#endif
/* create pipe for fifo */
if (!extcap_create_pipe(interface_opts->name, &interface_opts->extcap_fifo,
- EXTCAP_PIPE_PREFIX, TRUE))
+ EXTCAP_PIPE_PREFIX))
{
return FALSE;
}
/* Create extcap call */
args = extcap_prepare_arguments(interface_opts);
- userdata = g_new0(extcap_userdata, 1);
+ pipedata = g_new0(ws_pipe_t, 1);
- pid = extcap_spawn_async(userdata, args);
+ pid = ws_pipe_spawn_async(pipedata, args);
- g_ptr_array_foreach(args, (GFunc)g_free, NULL);
+ g_ptr_array_foreach(args, ptr_array_free, NULL);
g_ptr_array_free(args, TRUE);
- if (pid == INVALID_EXTCAP_PID)
+ if (pid == WS_INVALID_PID)
{
- g_free(userdata);
+ g_free(pipedata);
continue;
}
+ ws_close(pipedata->stdin_fd);
interface_opts->extcap_pid = pid;
interface_opts->extcap_child_watch =
* connect to named pipe (including user interaction).
* Wait on multiple object in case of extcap termination
* without opening pipe.
- *
- * Minimum supported version of Windows: XP / Server 2003.
*/
- if (pid != INVALID_EXTCAP_PID)
+ if (pid != WS_INVALID_PID)
{
HANDLE pipe_handles[3];
int num_pipe_handles = 1;
num_pipe_handles += 2;
}
- extcap_wait_for_pipe(pipe_handles, num_pipe_handles, pid);
+ ws_pipe_wait_for_pipe(pipe_handles, num_pipe_handles, pid);
}
#endif
- interface_opts->extcap_userdata = (gpointer) userdata;
+ interface_opts->extcap_pipedata = (gpointer) pipedata;
}
return TRUE;
}
-gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix, gboolean byte_mode _U_)
-{
#ifdef _WIN32
+gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix)
+{
gchar timestr[ 14 + 1 ];
time_t current_time;
gchar *pipename = NULL;
pipe_h = CreateNamedPipe(
utf_8to16(pipename),
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
- byte_mode ? PIPE_TYPE_BYTE : PIPE_TYPE_MESSAGE | byte_mode ? PIPE_READMODE_BYTE : PIPE_READMODE_MESSAGE | PIPE_WAIT,
+ PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
1, 65536, 65536,
300,
&security);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "\nWireshark Created pipe =>(%s)", pipename);
*fifo = g_strdup(pipename);
}
+
+ return TRUE;
+}
#else
+gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix)
+{
gchar *temp_name = NULL;
int fd = 0;
{
*fifo = g_strdup(temp_name);
}
-#endif
return TRUE;
}
+#endif
/************* EXTCAP LOAD INTERFACE LIST ***************
*
{
extcap_info * element = 0;
+ if ( prefs.capture_no_extcap )
+ return NULL;
+
if ( ! toolname )
return element;
/* Load interfaces from utility */
interfaces = extcap_parse_interfaces(cb_info.output, &control_items);
- if (control_items)
- {
- toolbar_entry = g_new0(iface_toolbar, 1);
- toolbar_entry->controls = control_items;
- }
-
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Loading interface list for %s ", cb_info.extcap);
/* Seems, that there where no interfaces to be loaded */
return FALSE;
}
+ if (control_items)
+ {
+ toolbar_entry = g_new0(iface_toolbar, 1);
+ toolbar_entry->controls = control_items;
+ }
+
walker = interfaces;
gchar* help = NULL;
while (walker != NULL)
static void
extcap_load_interface_list(void)
{
- gchar *argv;
- gchar *error;
+ gchar *error = NULL;
+
+ if (prefs.capture_no_extcap)
+ return;
if (_toolbars)
{
if (_loaded_interfaces == NULL)
{
+ GList * arguments = NULL;
+ GList * fallback = NULL;
+ int major = 0;
+ int minor = 0;
+
_loaded_interfaces = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, extcap_free_interface_info);
/* Cleanup lookup table */
if ( _tool_for_ifname )
_tool_for_ifname = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
}
- argv = g_strdup(EXTCAP_ARGUMENT_LIST_INTERFACES);
+ arguments = g_list_append(arguments, g_strdup(EXTCAP_ARGUMENT_LIST_INTERFACES));
+ fallback = g_list_append(fallback, g_strdup(EXTCAP_ARGUMENT_LIST_INTERFACES));
+
+ get_ws_version_number(&major, &minor, NULL);
+ arguments = g_list_append(arguments, g_strdup_printf("%s=%d.%d", EXTCAP_ARGUMENT_VERSION, major, minor));
extcap_callback_info_t cb_info;
cb_info.data = NULL;
cb_info.ifname = NULL;
cb_info.err_str = &error;
- extcap_foreach(1, &argv, cb_load_interfaces, cb_info);
+ extcap_foreach(arguments, cb_load_interfaces, cb_info, fallback);
- g_free(argv);
+ g_list_free_full(fallback, g_free);
+ g_list_free_full(arguments, g_free);
}
}