Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 32006: /trunk/ /trunk/epan/: oids.c:
Bill Meier wrote:
Log:
Prevent potential crash in libsmi.
From: Vincent Bernat <bernat@xxxxxxxxxx>
Since SVN #32006 was committed, the following messages appear when
tshark and Wireshark are started.
For Wireshark the messages appear as popup Windows which must be
dismissed !!
----------
tshark: Stopped processing module SNMP-COMMUNITY-MIB due to error(s) to
prevent potential crash in libsmi.
Module's conformance level: 0.
See details at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560325
tshark: Stopped processing module SNMP-MPD-MIB due to error(s) to
prevent potential crash in libsmi.
Module's conformance level: 0.
See details at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560325
tshark: Stopped processing module SNMP-PROXY-MIB due to error(s) to
prevent potential crash in libsmi.
Module's conformance level: 0.
See details at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560325
----------
Needing to dismiss popup windows each time Wireshark is started is
obviously a non-starter. :)
So; What should be done ?? (I know zilch about SNMP MIBS).
Bill
I wanted to commit the attached patch, but I realized, that preferences
are read _after_ loading the SMI modules. :-(
Could we read prefs earlier, maybe twice?
Cheers,
Balint
Index: epan/prefs.c
===================================================================
--- epan/prefs.c (revision 32015)
+++ epan/prefs.c (working copy)
@@ -1206,6 +1206,7 @@
/* set the default values for the name resolution dialog box */
prefs.name_resolve = RESOLV_ALL ^ RESOLV_NETWORK;
prefs.name_resolve_concurrency = 500;
+ prefs.suppress_smi_errors = FALSE;
/* set the default values for the tap/statistics dialog box */
prefs.tap_update_interval = TAP_UPDATE_DEFAULT_INTERVAL;
@@ -1673,6 +1674,7 @@
*/
#define PRS_NAME_RESOLVE "name_resolve"
#define PRS_NAME_RESOLVE_CONCURRENCY "name_resolve_concurrency"
+#define PRS_NAME_RESOLVE_SUPPRESS_SMI_ERRORS "name_resolve_suppress_smi_erors"
#define PRS_CAP_NAME_RESOLVE "capture.name_resolve"
/* values for the capture dialog box */
@@ -2177,6 +2179,8 @@
}
} else if (strcmp(pref_name, PRS_NAME_RESOLVE_CONCURRENCY) == 0) {
prefs.name_resolve_concurrency = strtol(value, NULL, 10);
+ } else if (strcmp(pref_name, PRS_NAME_RESOLVE_SUPPRESS_SMI_ERRORS) == 0) {
+ prefs.suppress_smi_errors = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
} else if ((strcmp(pref_name, PRS_RTP_PLAYER_MAX_VISIBLE) == 0) ||
(strcmp(pref_name, "rtp_player.max_visible") == 0)) {
/* ... also accepting old name for this preference */
@@ -3054,6 +3058,11 @@
fprintf(pf, PRS_NAME_RESOLVE_CONCURRENCY ": %d\n",
prefs.name_resolve_concurrency);
+ fprintf(pf, "\n# Suppress smi errors?\n");
+ fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(pf, PRS_NAME_RESOLVE_SUPPRESS_SMI_ERRORS ": %s\n",
+ prefs.suppress_smi_errors == TRUE ? "TRUE" : "FALSE");
+
fprintf(pf, "\n####### Taps/Statistics ########\n");
fprintf(pf, "\n# Tap update interval in ms.\n");
Index: epan/prefs.h
===================================================================
--- epan/prefs.h (revision 32015)
+++ epan/prefs.h (working copy)
@@ -147,6 +147,7 @@
gint console_log_level;
guint32 name_resolve;
gint name_resolve_concurrency;
+ gboolean suppress_smi_errors;
gchar *capture_device;
gchar *capture_devices_linktypes;
gchar *capture_devices_descr;
Index: gtk/prefs_nameres.c
===================================================================
--- gtk/prefs_nameres.c (revision 32015)
+++ gtk/prefs_nameres.c (working copy)
@@ -60,6 +60,7 @@
#endif
#ifdef HAVE_LIBSMI
+# define SUPPRESS_SMI_ERRORS_KEY "suppress_smi_errors"
# define SMI_TABLE_ROWS 2
#else
# define SMI_TABLE_ROWS 0
@@ -91,6 +92,7 @@
char concur_str[10+1];
#endif /* HAVE_C_ARES || HAVE_GNU_ADNS */
#ifdef HAVE_LIBSMI
+ GtkWidget *suppress_smi_errors_cb;
uat_t *smi_paths_uat;
uat_t *smi_modules_uat;
#endif
@@ -162,6 +164,13 @@
"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++;
+ 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) {
@@ -225,6 +234,9 @@
#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 *suppress_smi_errors_cb;
+#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 +257,10 @@
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
+ 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;
+#endif
}
void
Index: epan/oids.c
===================================================================
--- epan/oids.c (revision 32015)
+++ epan/oids.c (working copy)
@@ -570,11 +570,13 @@
}
if (smi_errors->len) {
- report_failure("The following errors were found while loading the MIBS:\n%s\n\n"
+ if (!prefs.suppress_smi_errors) {
+ report_failure("The following errors were found while loading the MIBS:\n%s\n\n"
"The Current Path is: %s\n\nYou can avoid this error message "
"by removing the missing MIB modules at Edit -> Preferences"
" -> Name Resolution -> SMI (MIB and PIB) modules or by "
"installing them.\n" , smi_errors->str , path_str);
+ }
D(1,("Errors while loading:\n%s\n",smi_errors->str));
}
@@ -592,11 +594,13 @@
* Currently there is no such version. :-(
*/
if (smiModule->conformance <= 1)
- report_failure("Stopped processing module %s due to "
- "error(s) to prevent potential crash in libsmi.\n"
- "Module's conformance level: %d.\n"
- "See details at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560325\n",
- smiModule->name, smiModule->conformance);
+ if (!prefs.suppress_smi_errors) {
+ report_failure("Stopped processing module %s due to "
+ "error(s) to prevent potential crash in libsmi.\n"
+ "Module's conformance level: %d.\n"
+ "See details at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560325\n",
+ smiModule->name, smiModule->conformance);
+ }
continue;
for (smiNode = smiGetFirstNode(smiModule, SMI_NODEKIND_ANY);