Ethereal-dev: Re: [Ethereal-dev][patch] SNMP MIB module list

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Wed, 10 Aug 2005 23:39:01 +0200 (CEST)
On Mon, 8 Aug 2005, Thomas Anders wrote:

> Jaap Keuter wrote:
> > Shouldn't the SNMP dissector substitute the colon by a semicolon on the
> > Win32 platform so that the translations work and a save fixes the
> > preferences file?
>
> There's a related comment in epan/dissectors/packet-snmp.c saying
>
> /* Default MIB modules to load */
> /*
>   * XXX - Should we try to be clever and replace colons for semicolons under
>   * Windows and the converse on non-Windows systems?
>   */
>
> It looks like just noone has found the time/motivation to implement this
> yet. Patches appreciated. :-)

Ok, had some time to look into it. This is what I found:

Index: packet-snmp.c
===================================================================
--- packet-snmp.c	(revision 15287)
+++ packet-snmp.c	(working copy)
@@ -122,10 +122,6 @@
 static int proto_snmp = -1;

 /* Default MIB modules to load */
-/*
- * XXX - Should we try to be clever and replace colons for semicolons under
- * Windows and the converse on non-Windows systems?
- */
 #ifdef _WIN32
 # define DEF_MIB_MODULES "IP-MIB;IF-MIB;TCP-MIB;UDP-MIB;SNMPv2-MIB;RFC1213-MIB;UCD-SNMP-MIB"
 #else
@@ -2588,6 +2584,12 @@
 		tmp_mib_modules = g_strconcat("MIBS=", mib_modules, NULL);

 #ifdef _WIN32
+		/*
+		 * If an old preferences file or, at the first run, an incorrect
+		 * environment variable was read "mib_modules" can contain
+		 * colon seperated entries.
+		 */
+		g_strdelimit(tmp_mib_modules, ":", ';');
 		_putenv(tmp_mib_modules);
 #else
 		putenv(tmp_mib_modules);

===================================================================

Well now, that wasn't too difficult was it :-)) If anyone would care to
test this in a Windows build, that would be much appreciated. I'm
currently without a Win32 development platform alltogether.

The test would be to load a capture with SNMP packets in it. See if
the OIDs are interpreted. Then go to Edit|Preferences|Protocols|SNMP and
edit the "MIB modules to load". Replace the semicolons by colons and
click Apply. The SNMP packets should still have their OIDs interpreted.

We can leave the tooltip in to encourage proper form.

Thanx,
Jaap