diff options
author | rbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-03-03 17:19:30 +0000 |
---|---|---|
committer | rbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-03-03 17:19:30 +0000 |
commit | b381a8d348ace0382b283a9a51156f42698025b1 (patch) | |
tree | f14716c4cb399258dd58ff596e4913e43a7f6b9a /gtk | |
parent | af9ff2690195463ffdc8af890716e80bebd03356 (diff) |
Disable OID resolution and loading SMI modules by default.
Add an option to enable OID resolution.
Add an option to suppress errors reported by libsmi.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32096 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/prefs_nameres.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gtk/prefs_nameres.c b/gtk/prefs_nameres.c index ed00bc8588..3a42e958a8 100644 --- a/gtk/prefs_nameres.c +++ b/gtk/prefs_nameres.c @@ -31,6 +31,7 @@ #include <epan/addr_resolv.h> #include <epan/prefs.h> #include <epan/uat.h> +#include <epan/oids.h> #include "../globals.h" @@ -60,6 +61,8 @@ #endif #ifdef HAVE_LIBSMI +# define SUPPRESS_SMI_ERRORS_KEY "suppress_smi_errors" +# define LOAD_SMI_MODULES_KEY "load_smi_modules" # define SMI_TABLE_ROWS 2 #else # define SMI_TABLE_ROWS 0 @@ -91,6 +94,7 @@ nameres_prefs_show(void) char concur_str[10+1]; #endif /* HAVE_C_ARES || HAVE_GNU_ADNS */ #ifdef HAVE_LIBSMI + GtkWidget *load_smi_modules_cb, *suppress_smi_errors_cb; uat_t *smi_paths_uat; uat_t *smi_modules_uat; #endif @@ -162,6 +166,20 @@ nameres_prefs_show(void) "Support for this feature was not compiled into this version of Wireshark"); #endif /* HAVE_C_ARES || HAVE_GNU_ADNS */ #ifdef HAVE_LIBSMI + /* Suppress smi errors */ + table_row++; + load_smi_modules_cb = create_preference_check_button(main_tb, table_row, + "Enable OID resolution:", "You must restart Wireshark for this change to" + " take effect.", prefs.load_smi_modules); + g_object_set_data(G_OBJECT(main_vb), LOAD_SMI_MODULES_KEY, load_smi_modules_cb); + + /* Suppress smi errors */ + table_row++; + suppress_smi_errors_cb = create_preference_check_button(main_tb, table_row, + "Suppress SMI errors:", "Some errors can be ignored. If unsure, set to false.", + prefs.suppress_smi_errors); + g_object_set_data(G_OBJECT(main_vb), SUPPRESS_SMI_ERRORS_KEY, suppress_smi_errors_cb); + /* SMI paths UAT */ smi_paths_uat = uat_get_table_by_name("SMI Paths"); if (smi_paths_uat) { @@ -188,6 +206,14 @@ nameres_prefs_show(void) create_preference_static_text(main_tb, table_row, "SMI (MIB and PIB) modules and paths: N/A", "Support for this feature was not compiled into this version of Wireshark"); + table_row++; + create_preference_static_text(main_tb, table_row, + "Enable OID resolution: N/A", + "Support for this feature was not compiled into this version of Wireshark"); + table_row++; + create_preference_static_text(main_tb, table_row, + "Suppress SMI errors: N/A", + "Support for this feature was not compiled into this version of Wireshark"); #endif /* HAVE_LIBSMI */ #ifdef HAVE_GEOIP @@ -225,6 +251,10 @@ nameres_prefs_fetch(GtkWidget *w) #if defined(HAVE_C_ARES) || defined(HAVE_GNU_ADNS) GtkWidget *c_resolv_cb, *resolv_concurrency_te; #endif /* HAVE_C_ARES || HAVE_GNU_ADNS */ +#ifdef HAVE_LIBSMI + GtkWidget *load_smi_modules_cb, *suppress_smi_errors_cb; + gboolean load_smi_modules_orig; +#endif m_resolv_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), M_RESOLVE_KEY); n_resolv_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), N_RESOLVE_KEY); @@ -245,6 +275,22 @@ nameres_prefs_fetch(GtkWidget *w) prefs.name_resolve_concurrency = strtol (gtk_entry_get_text( GTK_ENTRY(resolv_concurrency_te)), NULL, 10); #endif /* HAVE_C_ARES || HAVE_GNU_ADNS */ +#ifdef HAVE_LIBSMI + load_smi_modules_orig = prefs.load_smi_modules; + load_smi_modules_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), LOAD_SMI_MODULES_KEY); + prefs.load_smi_modules = GTK_TOGGLE_BUTTON (load_smi_modules_cb)->active; + suppress_smi_errors_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), SUPPRESS_SMI_ERRORS_KEY); + prefs.suppress_smi_errors = GTK_TOGGLE_BUTTON (suppress_smi_errors_cb)->active; + + /* Perform actions needed when enabling/disabling OID resolution */ + if (load_smi_modules_orig && !prefs.load_smi_modules) { + prefs.load_smi_modules = TRUE; /* hack to make oids_cleanup() actually do something */ + oids_cleanup(); + prefs.load_smi_modules = FALSE; /* end hack */ + } else if (!load_smi_modules_orig && prefs.load_smi_modules) { + oids_init(); + } +#endif } void |