diff options
author | Uli Heilmeier <uh@heilmeier.eu> | 2015-02-22 12:00:58 +0100 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2015-09-13 02:53:19 +0000 |
commit | 156515732a6d8b01e9926bff000021729f3b1ced (patch) | |
tree | ee91a91ceb3fb74d2787edfd66e6f99b90c59366 /epan | |
parent | 33570f81b55b3ac846e2b16836b5a0b3083de1b3 (diff) |
Bootp/DHCP: Add option 242 (Avaya IP Telephone)
This commit adds handling for option 242 to bootp.
The value of the Avaya option 242 is a string containing a list of
several suboptions seperated by a ",".
However some suboptions may have multiple values also seperated by
a comma. The values may be enclosed in quotes.
A real-life string e.g. looks like:
MCIPADD=10.1.1.2,10.1.1.3,TLSSRVR=10.1.1.5,VLANTEST=60,L2Q=1,L2QVLAN=77
Documentation can be found here:
https://downloads.avaya.com/elmodocs2/one-X_Deskphone_Edition/R1.5/output/16_300698_4/admn054.html and
http://downloads.avaya.com/css/P8/documents/100068659
A set of crafted packets is attached to the bug.
Bug: 11021
Change-Id: I99b557a952fd34c0fcab6d0a5311440969316973
Reviewed-on: https://code.wireshark.org/review/7443
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-bootp.c | 315 |
1 files changed, 314 insertions, 1 deletions
diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 4d5609af98..396f9a3a93 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -468,6 +468,25 @@ static int hf_bootp_option_6RD_ipv4_mask_len = -1; /* 212 */ static int hf_bootp_option_6RD_prefix_len = -1; /* 212 */ static int hf_bootp_option_6RD_prefix = -1; /* 212 */ static int hf_bootp_option_6RD_border_relay_ip = -1; /* 212 */ +static int hf_bootp_option242_avaya = -1; /* 242 */ +static int hf_bootp_option242_avaya_tlssrvr = -1; /* 242 */ +static int hf_bootp_option242_avaya_httpsrvr = -1; /* 242 */ +static int hf_bootp_option242_avaya_httpdir = -1; /* 242 */ +static int hf_bootp_option242_avaya_static = -1; /* 242 */ +static int hf_bootp_option242_avaya_mcipadd = -1; /* 242 */ +static int hf_bootp_option242_avaya_dot1x = -1; /* 242 */ +static int hf_bootp_option242_avaya_icmpdu = -1; /* 242 */ +static int hf_bootp_option242_avaya_icmpred = -1; /* 242 */ +static int hf_bootp_option242_avaya_l2q = -1; /* 242 */ +static int hf_bootp_option242_avaya_l2qvlan = -1; /* 242 */ +static int hf_bootp_option242_avaya_loglocal = -1; /* 242 */ +static int hf_bootp_option242_avaya_phy1stat = -1; /* 242 */ +static int hf_bootp_option242_avaya_phy2stat = -1; /* 242 */ +static int hf_bootp_option242_avaya_procpswd = -1; /* 242 */ +static int hf_bootp_option242_avaya_procstat = -1; /* 242 */ +static int hf_bootp_option242_avaya_snmpadd = -1; /* 242 */ +static int hf_bootp_option242_avaya_snmpstring = -1; /* 242 */ +static int hf_bootp_option242_avaya_vlantest = -1; /* 242 */ static int hf_bootp_option_private_proxy_autodiscovery = -1; /* 252 */ static int hf_bootp_option_end = -1; /* 255 */ static int hf_bootp_option_end_overload = -1; /* 255 (with overload)*/ @@ -494,6 +513,7 @@ static gint ett_bootp_option82_suboption9 = -1; static gint ett_bootp_option125_suboption = -1; static gint ett_bootp_option125_tr111_suboption = -1; static gint ett_bootp_option125_cl_suboption = -1; +static gint ett_bootp_option242_suboption = -1; static gint ett_bootp_fqdn = -1; static gint ett_bootp_fqdn_flags = -1; static gint ett_bootp_filename_option = -1; @@ -959,6 +979,72 @@ static const value_string sip_server_enc_vals[] = { {1, "IPv4 Address" }, {0, NULL } }; + +static const string_string option242_avaya_phystat_vals[] = { + { "0", "Disabled" }, + { "1", "Auto" }, + { "2", "10Mbps half" }, + { "3", "10Mbps full" }, + { "4", "100Mbps half" }, + { "5", "100Mbps full" }, + { "6", "1000Mbps full" }, + { 0, NULL } +}; + +static const string_string option242_avaya_l2q_vals[] = { + { "0", "Auto" }, + { "1", "Enabled" }, + { "2", "Disabled" }, + { 0, NULL } +}; + +static const string_string option242_avaya_dot1x_vals[] = { + { "0", "With PAE pass-through" }, + { "1", "With PAE pass-through and proxy Logoff" }, + { "2", "Without PAE pass-through or proxy Logoff" }, + { 0, NULL } +}; + +static const string_string option242_avaya_icmpdu_vals[] = { + { "0", "No ICMP Destination Unreachable messages" }, + { "1", "Send limited Port Unreachable messages" }, + { "2", "Send Protocol and Port Unreachable messages" }, + { 0, NULL } +}; + +static const string_string option242_avaya_icmpred_vals[] = { + { "0", "Ignore ICMP Redirect messages" }, + { "1", "Process ICMP Redirect messages" }, + { 0, NULL } +}; + +static const string_string option242_avaya_loglocal_vals[] = { + { "0", "Disabled" }, + { "1", "Emergencie" }, + { "2", "Alerts" }, + { "3", "Critical" }, + { "4", "Errors" }, + { "5", "Warnings" }, + { "6", "Notices" }, + { "7", "Information" }, + { "8", "Debug" }, + { 0, NULL } +}; + +static const string_string option242_avaya_procstat_vals[] = { + { "0", "All administrative options" }, + { "1", "Only view administrative options" }, + { 0, NULL } +}; + +static const string_string option242_avaya_static_vals[] = { + { "0", "Static programming never overrides call server (DHCP) or call server administered data" }, + { "1", "Static programming overrides only file server administered data" }, + { "2", "Static programming overrides only call server administered data" }, + { "3", "Static programming overrides both file server- and call server-administered data" }, + { 0, NULL } +}; + /* bootp options administration */ #define BOOTP_OPT_NUM 256 @@ -1208,7 +1294,7 @@ static struct opt_info default_bootp_opt[BOOTP_OPT_NUM] = { /* 239 */ { "Private", opaque, NULL }, /* 240 */ { "Private", opaque, NULL }, /* 241 */ { "Private", opaque, NULL }, -/* 242 */ { "Private", opaque, NULL }, +/* 242 */ { "Private/Avaya IP Telephone", special, NULL }, /* 243 */ { "Private", opaque, NULL }, /* 244 */ { "Private", opaque, NULL }, /* 245 */ { "Private", opaque, NULL }, @@ -2681,6 +2767,137 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, proto_item break; } + case 242: { /* Avaya IP Telephone */ + int fieldlen; + proto_tree *o242avaya_v_tree; + proto_item *avaya_ti; + gchar *avaya_option = NULL; + gchar *field = NULL; + gchar *value = NULL; + gchar *avaya_temp_string = NULL; + gchar *avaya_parameter_string = NULL; + wmem_list_t *avaya_parameter_list = NULL; + wmem_list_frame_t *cur = NULL; + + optend = optoff + optlen; + /* minimum length is 5 bytes */ + if (optlen < 5) { + expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "Avaya IP Telephone option length isn't >= 5"); + optoff += optlen; + break; + } + avaya_option = (gchar*)tvb_get_string_enc(wmem_packet_scope(), tvb, optoff, optlen, ENC_ASCII); + avaya_ti = proto_tree_add_string(v_tree, hf_bootp_option242_avaya, tvb, optoff, optlen, avaya_option); + o242avaya_v_tree = proto_item_add_subtree(avaya_ti, ett_bootp_option242_suboption); + avaya_parameter_list = wmem_list_new(wmem_packet_scope()); + for ( field = strtok(avaya_option, ","); field; field = strtok(NULL, ",") ) { + if ( !(value = strchr(field, '=')) && (wmem_list_count(avaya_parameter_list) == 0 )) { + expert_add_info_format(pinfo, vti, &hf_bootp_subopt_unknown_type, "ERROR, Unknown parameter %s", field); + fieldlen = (int)strlen(field); + optoff += fieldlen; + break; + } + else { + if ( !(value = strchr(field, '=')) ) { + cur = wmem_list_tail(avaya_parameter_list); + avaya_temp_string = wmem_strdup_printf(wmem_packet_scope(), "%s,%s", (gchar*)wmem_list_frame_data(cur), field); + wmem_list_remove_frame(avaya_parameter_list, cur); + wmem_list_append(avaya_parameter_list, avaya_temp_string); + } + else { + avaya_parameter_string = wmem_strdup(wmem_packet_scope(), field); + wmem_list_append(avaya_parameter_list, avaya_parameter_string); + } + } + } + if ( wmem_list_count(avaya_parameter_list) > 0 ) { + cur = wmem_list_head(avaya_parameter_list); + while ( cur ) { + field = (gchar*)wmem_list_frame_data(cur); + fieldlen = (int)strlen(field); + if((strncmp(field, "TLSSRVR=", 8) == 0) && ( fieldlen > 8 )) { + proto_tree_add_string(o242avaya_v_tree, hf_bootp_option242_avaya_tlssrvr, tvb, optoff, fieldlen, field + 8); + optoff += fieldlen; + } + else if((strncmp(field, "HTTPSRVR=", 9) == 0) && ( fieldlen > 9)) { + proto_tree_add_string(o242avaya_v_tree, hf_bootp_option242_avaya_httpsrvr, tvb, optoff, fieldlen, field + 9); + optoff += fieldlen; + } + else if((strncmp(field, "HTTPDIR=", 8) == 0) && ( fieldlen > 8)) { + proto_tree_add_string(o242avaya_v_tree, hf_bootp_option242_avaya_httpdir, tvb, optoff, fieldlen, field + 8); + optoff += fieldlen; + } + else if((strncmp(field, "STATIC=", 7) == 0) && ( fieldlen > 7)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_static, tvb, optoff, fieldlen, field + 7, "%s (%s)", field + 7, str_to_str(field + 7, option242_avaya_static_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "MCIPADD=", 8) == 0) && ( fieldlen > 8)) { + proto_tree_add_string(o242avaya_v_tree, hf_bootp_option242_avaya_mcipadd, tvb, optoff, fieldlen, field + 8); + optoff += fieldlen; + } + else if((strncmp(field, "DOT1X=", 6) == 0) && ( fieldlen > 6)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_dot1x, tvb, optoff, fieldlen, field + 6, "%s (%s)", field + 6, str_to_str(field + 6, option242_avaya_dot1x_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "ICMPDU=", 7) == 0) && ( fieldlen > 7)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_icmpdu, tvb, optoff, fieldlen, field + 7, "%s (%s)", field + 7, str_to_str(field + 7, option242_avaya_icmpdu_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "ICMPRED=", 8) == 0) && ( fieldlen > 8)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_icmpred, tvb, optoff, fieldlen, field + 8, "%s (%s)", field + 8, str_to_str(field + 8, option242_avaya_icmpred_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "L2Q=", 4) == 0) && ( fieldlen > 4)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_l2q, tvb, optoff, fieldlen, field + 4, "%s (%s)", field + 4, str_to_str(field + 4, option242_avaya_l2q_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "L2QVLAN=", 8) == 0) && ( fieldlen > 8)) { + proto_tree_add_int(o242avaya_v_tree, hf_bootp_option242_avaya_l2qvlan, tvb, optoff, fieldlen, atoi(field +8)); + optoff += fieldlen; + } + else if((strncmp(field, "LOGLOCAL=", 9) == 0) && ( fieldlen > 9)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_loglocal, tvb, optoff, fieldlen, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_loglocal_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "PHY1STAT=", 9) == 0) && ( fieldlen > 9)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_phy1stat, tvb, optoff, fieldlen, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_phystat_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "PHY2STAT=", 9) == 0) && ( fieldlen > 9)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_phy2stat, tvb, optoff, fieldlen, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_phystat_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "PROCPSWD=", 9) == 0) && ( fieldlen > 9)) { + proto_tree_add_string(o242avaya_v_tree, hf_bootp_option242_avaya_procpswd, tvb, optoff, fieldlen, field + 9); + optoff += fieldlen; + } + else if((strncmp(field, "PROCSTAT=", 9) == 0) && ( fieldlen > 9)) { + proto_tree_add_string_format_value(o242avaya_v_tree, hf_bootp_option242_avaya_procstat, tvb, optoff, fieldlen, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_procstat_vals, "Unknown (%s)")); + optoff += fieldlen; + } + else if((strncmp(field, "SNMPADD=", 8) == 0) && ( fieldlen > 8)) { + proto_tree_add_string(o242avaya_v_tree, hf_bootp_option242_avaya_snmpadd, tvb, optoff, fieldlen, field + 8); + optoff += fieldlen; + } + else if((strncmp(field, "SNMPSTRING=", 11) == 0) && ( fieldlen > 11)) { + proto_tree_add_string(o242avaya_v_tree, hf_bootp_option242_avaya_snmpstring, tvb, optoff, fieldlen, field + 11); + optoff += fieldlen; + } + else if((strncmp(field, "VLANTEST=", 9) == 0) && ( fieldlen > 9)) { + proto_tree_add_int(o242avaya_v_tree, hf_bootp_option242_avaya_vlantest, tvb, optoff, fieldlen, atoi(field +9)); + optoff += fieldlen; + } + else { + expert_add_info_format(pinfo, vti, &hf_bootp_subopt_unknown_type, "ERROR, Unknown Avaya IP Telephone parameter %s", field); + optoff += fieldlen; + } + cur = wmem_list_frame_next(cur); + if ( cur ) optoff += 1; + } + } + break; + } + default: /* not special */ /* The PacketCable CCC option number can vary. If this is a CCC option, handle it as a special. @@ -7473,6 +7690,101 @@ proto_register_bootp(void) { "Invalidate All PacketCable Call Management Servers", "bootp.ccc.ietf.sec_tkt.all_pc_call_management", FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x02, NULL, HFILL }}, + + { &hf_bootp_option242_avaya, + { "Private/Avaya IP Telephone", "bootp.option.vendor.avaya", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: Private/Avaya IP Telephone", HFILL }}, + + { &hf_bootp_option242_avaya_tlssrvr, + { "TLSSRVR", "bootp.option.vendor.avaya.tlssrvr", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: TLSSRVR (HTTPS server(s) to download configuration)", HFILL }}, + + { &hf_bootp_option242_avaya_httpsrvr, + { "HTTPSRVR", "bootp.option.vendor.avaya.httpsrvr", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: HTTPSRVR (HTTP server(s) to download configuration)", HFILL }}, + + { &hf_bootp_option242_avaya_httpdir, + { "HTTPDIR", "bootp.option.vendor.avaya.httpdir", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: HTTPDIR (Path to configuration files)", HFILL }}, + + { &hf_bootp_option242_avaya_static, + { "STATIC", "bootp.option.vendor.avaya.static", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: STATIC (Static programming override flag)", HFILL }}, + + { &hf_bootp_option242_avaya_mcipadd, + { "MCIPADD", "bootp.option.vendor.avaya.mcipadd", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: MCIPADD (List of CM server(s))", HFILL }}, + + { &hf_bootp_option242_avaya_dot1x, + { "DOT1X", "bootp.option.vendor.avaya.dot1x", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: DOT1X (802.1X Supplicant operation mode)", HFILL }}, + + { &hf_bootp_option242_avaya_icmpdu, + { "ICMPDU", "bootp.option.vendor.avaya.icmpdu", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: ICMPDU (ICMP Destination Unreachable processing)", HFILL }}, + + { &hf_bootp_option242_avaya_icmpred, + { "ICMPRED", "bootp.option.vendor.avaya.icmpred", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: ICMPRED (ICMP Redirect handling)", HFILL }}, + + { &hf_bootp_option242_avaya_l2q, + { "L2Q", "bootp.option.vendor.avaya.l2q", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: L2Q (Controls 802.1Q tagging)", HFILL }}, + + { &hf_bootp_option242_avaya_l2qvlan, + { "L2QVLAN", "bootp.option.vendor.avaya.l2qvlan", + FT_INT32, BASE_DEC, NULL, 0x0, + "Option 242: L2QVLAN (VLAN ID)", HFILL }}, + + { &hf_bootp_option242_avaya_loglocal, + { "LOGLOCAL", "bootp.option.vendor.avaya.loglocal", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: LOGLOCAL (Log level)", HFILL }}, + + { &hf_bootp_option242_avaya_phy1stat, + { "PHY1STAT", "bootp.option.vendor.avaya.phy1stat", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: PHY1STAT (Interface configuration)", HFILL }}, + + { &hf_bootp_option242_avaya_phy2stat, + { "PHY2STAT", "bootp.option.vendor.avaya.phy2stat", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: PHY2STAT (Interface configuration)", HFILL }}, + + { &hf_bootp_option242_avaya_procpswd, + { "PROCPSWD", "bootp.option.vendor.avaya.procpswd", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: PROCPSWD (Security string used to access local procedures)", HFILL }}, + + { &hf_bootp_option242_avaya_procstat, + { "PROCSTAT", "bootp.option.vendor.avaya.procstat", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: PROCSTAT (Local (dialpad) Administrative access)", HFILL }}, + + { &hf_bootp_option242_avaya_snmpadd, + { "SNMPADD", "bootp.option.vendor.avaya.snmpadd", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: SNMPADD (Allowable source IP Address(es) for SNMP queries)", HFILL }}, + + { &hf_bootp_option242_avaya_snmpstring, + { "SNMPSTRING", "bootp.option.vendor.avaya.snmpstring", + FT_STRINGZ, BASE_NONE, NULL, 0x0, + "Option 242: SNMPSTRING (SNMP community string)", HFILL }}, + + { &hf_bootp_option242_avaya_vlantest, + { "VLANTEST", "bootp.option.vendor.avaya.vlantest", + FT_INT32, BASE_DEC, NULL, 0x0, + "Option 242: VLANTEST (Timeout in seconds)", HFILL }}, }; static uat_field_t bootp_uat_flds[] = { @@ -7494,6 +7806,7 @@ proto_register_bootp(void) &ett_bootp_option125_suboption, &ett_bootp_option125_tr111_suboption, &ett_bootp_option125_cl_suboption, + &ett_bootp_option242_suboption, &ett_bootp_fqdn, &ett_bootp_filename_option, &ett_bootp_server_hostname, |