From 7dccea9b20c60935a47b4898175e94610db0c80a Mon Sep 17 00:00:00 2001 From: Luis Ontanon Date: Tue, 22 Feb 2005 19:17:28 +0000 Subject: Do not call the tap's initialization as soon as the -z option is read, postpone it after the preferences callback has being called. That way mate's fields, which are registered by the preferences callback can be used as part of the tap's filter. svn path=/trunk/; revision=13469 --- tethereal.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tethereal.c b/tethereal.c index e7a8a43fda..83f0b7046c 100644 --- a/tethereal.c +++ b/tethereal.c @@ -857,8 +857,9 @@ main(int argc, char *argv[]) dfilter_t *rfcode = NULL; e_prefs *prefs; char badopt; - ethereal_tap_list *tli; - + ethereal_tap_list *tli = NULL; + gboolean got_tap = FALSE; + #ifdef HAVE_LIBPCAP /* XXX - better use capture_opts_init instead */ capture_opts.cfilter = g_strdup(""); @@ -1280,7 +1281,11 @@ main(int argc, char *argv[]) case 'z': for(tli=tap_list;tli;tli=tli->next){ if(!strncmp(tli->cmd,optarg,strlen(tli->cmd))){ - (*tli->func)(optarg); + /* we won't call the init function for the tap this soon + as it would disallow mate's fields (which are registered + by the preferences set callback) from being used as + part of a tap filter */ + got_tap = TRUE; break; } } @@ -1467,6 +1472,12 @@ main(int argc, char *argv[]) line that their preferences have changed. */ prefs_apply_all(); + /* At this point mate will have registered its field array so we can + have a filter with one of mate's late registered fields as part + of the tap's filter */ + if (got_tap) + (*tli->func)(optarg); + /* disabled protocols as per configuration file */ if (gdp_path == NULL && dp_path == NULL) { set_disabled_protos_list(); -- cgit v1.2.1