Ethereal-dev: Re: [Ethereal-dev] [Patch] to packet-diameter.c
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Martin Mathieson <martin.mathieson@xxxxxxxxxxxx>
Date: Tue, 14 Mar 2006 17:50:21 +0000
Not relying upon an external xml lib would be good!I had libxml2 installed, but somehow had to install libxml2-devel before g_module_open could find libxml2.so...
My preference would be for my patch (slightly fixed version attached - removed \n from preference help text) to be applied now if a version without the dependency can't be ready before the next release. I am unlikely to be able to spend time on integrating the new parser in the near future.
Martin LEGO wrote:
A while ago (before my old disk was broken) I have written a parser for diameter dictionary files that does not require xmllib, some work is needed to finish the integration. As I'm home (I got my backup there) I'll post to the list the parser, maybe someone else would want to integrate it, I do not have neitrher the time right now nor enough samples to test changes to diameter. Luis. On 3/14/06, Joerg Mayer <jmayer@xxxxxxxxx> wrote:On Tue, Mar 14, 2006 at 02:03:03PM +0000, Martin Mathieson wrote:This patch: - makes it possible to turn off use of the XML AVP dictionary (which relies upon the XML lib being installed). A failed load results in 3 annoying dialogs popping up the first time a diameter packet is read. Default is previous behaviour.Maybe you can add a fix so that only one requester pop up in the default case? thanks Joerg -- Joerg Mayer <jmayer@xxxxxxxxx> We are stuck with technology when what we really want is just stuff that works. Some say that should read Microsoft instead of technology. _______________________________________________ Ethereal-dev mailing list Ethereal-dev@xxxxxxxxxxxx http://www.ethereal.com/mailman/listinfo/ethereal-dev-- This information is top security. When you have read it, destroy yourself. -- Marshall McLuhan _______________________________________________ Ethereal-dev mailing list Ethereal-dev@xxxxxxxxxxxx http://www.ethereal.com/mailman/listinfo/ethereal-dev
Index: epan/dissectors/packet-diameter.c =================================================================== --- epan/dissectors/packet-diameter.c (revision 17626) +++ epan/dissectors/packet-diameter.c (working copy) @@ -246,6 +246,7 @@ /* Suppress console output at unknown AVP:s,Flags etc */ static gboolean suppress_console_output = TRUE; +static gboolean gbl_use_xml_dictionary = TRUE; #define DICT_FN "diameter/dictionary.xml" static const gchar *gbl_diameterDictionary; @@ -665,7 +666,7 @@ ApplicationId *entry; if (!name || (id == 0 && !allow_zero_as_app_id)) { - report_failure( "Diameter Error: Invalid application (name=%p, id=%d)", + report_failure( "Diameter Error: Invalid application (name=%s, id=%d)", name, id); return (-1); } /* Sanity Checks */ @@ -836,10 +837,12 @@ XmlStub.xmlSubstituteEntitiesDefault(1); /* Substitute entities automagically */ doc = xmlParseFilePush(gbl_diameterDictionary, 1); /* Parse the XML (do validity checks)*/ - /* Check for invalid xml */ + /* Check for invalid xml. + Note that xmlParseFilePush reports details of problems found, + and it should be obvious from the default filename that the error relates + to Diameter. + */ if (doc == NULL) { - report_failure("Diameter: Unable to parse xmldictionary %s", - gbl_diameterDictionary); return -1; } @@ -918,9 +921,9 @@ } /* initializeDictionaryDefaults */ /* - * This routine will attempt to load the XML dictionary, and on - * failure, will call initializeDictionaryDefaults to load in - * our static dictionary. + * This routine will attempt to load the XML dictionary if configured to. + * Otherwise, or if load fails, it will call initializeDictionaryDefaults + * to load in our static dictionary instead. */ static void initializeDictionary(void) @@ -930,12 +933,17 @@ * loadXMLDictionary will be called. This is one of the few times when * I think this is prettier than the nested if alternative. */ - if (loadLibXML() || - (loadXMLDictionary() != 0)) { - /* Something failed. Use the static dictionary */ - report_failure("Diameter: Using static dictionary! (Unable to use XML)"); - initializeDictionaryDefaults(); - } + if (gbl_use_xml_dictionary) { + if (loadLibXML() || (loadXMLDictionary() != 0)) { + /* Something failed. Use the static dictionary */ + report_failure("Diameter: Using static dictionary! (Unable to use XML)"); + initializeDictionaryDefaults(); + } + } + else { + initializeDictionaryDefaults(); + } + } /* initializeDictionary */ @@ -1207,6 +1215,8 @@ /* * Only parse in dictionary if there are diameter packets to * dissect. + * TODO: should keep track of preference settings and free/reinitialize the + * dictionary when appropriate. */ if (!initialized) { /* Read in our dictionary, if it exists. */ @@ -2224,7 +2234,7 @@ diameter_module = prefs_register_protocol(proto_diameter, proto_reg_handoff_diameter); /* Register a configuration option for Diameter version */ - prefs_register_enum_preference(diameter_module, "version", "Diameter version", "Standard version used for decoding", (gint *)&gbl_version, options, FALSE); + prefs_register_enum_preference(diameter_module, "version", "Diameter version", "Standard version used for decoding", (gint *)&gbl_version, options, FALSE); prefs_register_uint_preference(diameter_module, "tcp.port", "Diameter TCP Port", @@ -2258,6 +2268,16 @@ */ g_free(default_diameterDictionary); + /* + * Make use of the dictionary optional. Avoids error popups if xml library + * or dictionary file aren't available. + */ + prefs_register_bool_preference(diameter_module, "dictionary.use", + "Attempt to load/use Diameter XML Dictionary", + "Only attempt to load and use the Diameter XML " + "Dictionary when this option is selected", + &gbl_use_xml_dictionary); + /* Desegmentation */ prefs_register_bool_preference(diameter_module, "desegment", "Reassemble Diameter messages\nspanning multiple TCP segments",
- Follow-Ups:
- Re: [Ethereal-dev] [Patch] to packet-diameter.c
- From: LEGO
- SV: [Ethereal-dev] [Patch] to packet-diameter.c
- From: Anders Broman
- Re: [Ethereal-dev] [Patch] to packet-diameter.c
- References:
- [Ethereal-dev] [Patch] to packet-diameter.c
- From: Martin Mathieson
- Re: [Ethereal-dev] [Patch] to packet-diameter.c
- From: Joerg Mayer
- Re: [Ethereal-dev] [Patch] to packet-diameter.c
- From: LEGO
- [Ethereal-dev] [Patch] to packet-diameter.c
- Prev by Date: [Ethereal-dev] Re: [Ethereal-users] cflow v9 template records
- Next by Date: [Ethereal-dev] [Patch] to packet-pop.c
- Previous by thread: Re: [Ethereal-dev] [Patch] to packet-diameter.c
- Next by thread: Re: [Ethereal-dev] [Patch] to packet-diameter.c
- Index(es):