Update interface list when interface get lost and come back.

svn path=/trunk/; revision=48880
This commit is contained in:
Irene Rüngeler 2013-04-16 15:12:38 +00:00
parent 80350136f0
commit 65043453b9
3 changed files with 17 additions and 7 deletions

View File

@ -3768,7 +3768,8 @@ capture_dlg_refresh_if (void)
{
GtkTreeView *view;
fill_local_list();
if (interface_management_w)
fill_local_list();
view = (GtkTreeView *) g_object_get_data(G_OBJECT(cap_open_w), E_CAP_IFACE_KEY);
create_and_fill_model(GTK_TREE_VIEW(view));
@ -6014,8 +6015,7 @@ void
refresh_local_interface_lists(void)
{
/* Reload the local interface list. */
if (global_capture_opts.session_started == FALSE)
scan_local_interfaces();
scan_local_interfaces();
/* If there's an interfaces dialog up, refresh it. */
if (interfaces_dialog_window_present())

View File

@ -45,13 +45,23 @@ static void
gtk_iface_mon_event_cb(const char *iface, int up)
{
int present = 0;
guint ifs;
guint ifs, j;
interface_t device;
interface_options interface_opts;
for (ifs = 0; ifs < global_capture_opts.all_ifaces->len; ifs++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, ifs);
if (!strcmp(device.name, iface))
if (!strcmp(device.name, iface)) {
present = 1;
if (!up) {
for (j = 0; j < global_capture_opts.ifaces->len; j++) {
interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j);
if (strcmp(interface_opts.name, device.name) == 0) {
g_array_remove_index(global_capture_opts.ifaces, j);
}
}
}
}
}
if (present == up)

View File

@ -88,7 +88,7 @@ scan_local_interfaces(void)
if (global_capture_opts.all_ifaces->len > 0) {
for (i = (int)global_capture_opts.all_ifaces->len-1; i >= 0; i--) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (device.local) {
if (device.local && device.type != IF_PIPE && device.type != IF_STDIN) {
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
}
}
@ -306,7 +306,7 @@ scan_local_interfaces(void)
}
if (!found) { /* new interface, maybe a pipe */
device.name = g_strdup(interface_opts.name);
device.display_name = g_strdup_printf("%s", device.name);
device.display_name = g_strdup_printf("%s: %s", interface_opts.descr);
device.hidden = FALSE;
device.selected = TRUE;
device.type = IF_PIPE;