IPMI: Disable bus command dissection.
authorGerald Combs <gerald@wireshark.org>
Thu, 22 Feb 2018 20:42:28 +0000 (12:42 -0800)
committerAnders Broman <a.broman58@gmail.com>
Thu, 22 Feb 2018 22:27:39 +0000 (22:27 +0000)
This dissector has had multiple, severe issues over the years. Disable
bus command dissection by default. Add a warning about re-enabling it.

Change-Id: I9f71fafe2961f349825e6eda1f351025e00be182
Reviewed-on: https://code.wireshark.org/review/26008
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-ipmi.c

index 3403db3325c22e8198efb1b48b027dc06b1377a3..084eb06d53cf873f2abf3817d6d6b87c8ea5519b 100644 (file)
@@ -123,12 +123,16 @@ static gint proto_ipmb = -1;
 static gint proto_kcs = -1;
 static gint proto_tmode = -1;
 
+/* WARNING: Setting this to true might result in the entire dissector being
+   disabled by default or removed completely. */
+static gboolean dissect_bus_commands = FALSE;
 static gboolean fru_langcode_is_english = TRUE;
 static guint response_after_req = 5000;
 static guint response_before_req = 0;
 static guint message_format = MSGFMT_GUESS;
 static guint selected_oem = IPMI_OEM_NONE;
 
+static gint hf_ipmi_command_data = -1;
 static gint hf_ipmi_session_handle = -1;
 static gint hf_ipmi_header_trg = -1;
 static gint hf_ipmi_header_trg_lun = -1;
@@ -442,6 +446,13 @@ dissect_ipmi_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
        guint offset, siglen, is_resp;
        const char * cc_str, * netfn_str;
 
+       if (!dissect_bus_commands) {
+               ti = proto_tree_add_item(tree, hf_parent_item, tvb, 0, -1, ENC_NA);
+               cmd_tree = proto_item_add_subtree(ti, ett_tree);
+               proto_tree_add_item(cmd_tree, hf_ipmi_command_data, tvb, 0, -1, ENC_NA);
+               return 0;
+       }
+
        /* get packet data */
        data = get_packet_data(pinfo);
        if (!data) {
@@ -1712,6 +1723,7 @@ void
 proto_register_ipmi(void)
 {
        static hf_register_info hf[] = {
+               { &hf_ipmi_command_data, { "Bus command data", "ipmi.bus_command_data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
                { &hf_ipmi_session_handle, { "Session handle", "ipmi.session_handle", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
                { &hf_ipmi_header_trg, { "Target Address", "ipmi.header.target", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
                { &hf_ipmi_header_trg_lun, { "Target LUN", "ipmi.header.trg_lun", FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL }},
@@ -1754,7 +1766,7 @@ proto_register_ipmi(void)
                { &ei_impi_parser_not_implemented, { "ipmi.parser_not_implemented", PI_UNDECODED, PI_WARN, "[PARSER NOT IMPLEMENTED]", EXPFILL }},
        };
 
-       module_t *m;
+       module_t *module;
        expert_module_t* expert_ipmi;
        guint32 i;
 
@@ -1796,20 +1808,23 @@ proto_register_ipmi(void)
        register_dissector("kcs", dissect_kcs, proto_kcs);
        register_dissector("tmode", dissect_tmode, proto_tmode);
 
-       m = prefs_register_protocol(proto_ipmi, NULL);
-       prefs_register_bool_preference(m, "fru_langcode_is_english", "FRU Language Code is English",
+       module = prefs_register_protocol(proto_ipmi, NULL);
+       prefs_register_bool_preference(module, "dissect_bus_commands", "Dissect bus commands",
+                       "Dissect IPMB commands",
+                       &dissect_bus_commands);
+       prefs_register_bool_preference(module, "fru_langcode_is_english", "FRU Language Code is English",
                        "FRU Language Code is English; strings are ASCII+LATIN1 (vs. Unicode)",
                        &fru_langcode_is_english);
-       prefs_register_uint_preference(m, "response_after_req", "Maximum delay of response message",
+       prefs_register_uint_preference(module, "response_after_req", "Maximum delay of response message",
                        "Do not search for responses coming after this timeout (milliseconds)",
                        10, &response_after_req);
-       prefs_register_uint_preference(m, "response_before_req", "Response ahead of request",
+       prefs_register_uint_preference(module, "response_before_req", "Response ahead of request",
                        "Allow for responses before requests (milliseconds)",
                        10, &response_before_req);
-       prefs_register_enum_preference(m, "msgfmt", "Format of embedded messages",
+       prefs_register_enum_preference(module, "msgfmt", "Format of embedded messages",
                        "Format of messages embedded into Send/Get/Forward Message",
                        &message_format, msgfmt_vals, FALSE);
-       prefs_register_enum_preference(m, "selected_oem", "OEM commands parsed as",
+       prefs_register_enum_preference(module, "selected_oem", "OEM commands parsed as",
                        "Selects which OEM format is used for commands that IPMI does not define",
                        &selected_oem, oemsel_vals, FALSE);
 }