aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-08-09 13:43:44 -0400
committerMichael Mann <mmann78@netscape.net>2014-08-10 21:39:20 +0000
commit3635d7bed70aaf14e8172654f2b40be318e7dbfe (patch)
tree4b0fce1dba327df9a24b4ddc267a83375c817683 /epan
parent18346c84778019fe6eee6906758daa120f84d5d0 (diff)
Eliminate proto_tree_add_text from some dissectors.
Other minor cleanup while in the neighborhood. Change-Id: Ib76f4a9f89b5933425760af0a980c6a549031b8f Reviewed-on: https://code.wireshark.org/review/3537 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-h221_nonstd.c25
-rw-r--r--epan/dissectors/packet-hdcp2.c9
-rw-r--r--epan/dissectors/packet-hdmi.c21
-rw-r--r--epan/dissectors/packet-hip.c408
-rw-r--r--epan/dissectors/packet-homeplug.c37
-rw-r--r--epan/dissectors/packet-hpext.c6
-rw-r--r--epan/dissectors/packet-hpfeeds.c6
-rw-r--r--epan/dissectors/packet-hpsw.c6
-rw-r--r--epan/dissectors/packet-iapp.c279
-rw-r--r--epan/dissectors/packet-iax2.c38
-rw-r--r--epan/dissectors/packet-icep.c28
-rw-r--r--epan/dissectors/packet-idrp.c20
-rw-r--r--epan/dissectors/packet-iec104.c7
-rw-r--r--epan/dissectors/packet-ieee1722.c16
-rw-r--r--epan/dissectors/packet-ieee802154.c46
-rw-r--r--epan/dissectors/packet-igmp.c7
-rw-r--r--epan/dissectors/packet-imf.c4
-rw-r--r--epan/dissectors/packet-ipmi-picmg.c65
-rw-r--r--epan/dissectors/packet-ipmi-se.c22
-rw-r--r--epan/dissectors/packet-ipmi-transport.c73
-rw-r--r--epan/dissectors/packet-ipmi-vita.c14
-rw-r--r--epan/dissectors/packet-ipmi.c37
-rw-r--r--epan/dissectors/packet-ipmi.h5
-rw-r--r--epan/dissectors/packet-ipsec-udp.c39
-rw-r--r--epan/dissectors/packet-ipxwan.c6
-rw-r--r--epan/dissectors/packet-isl.c19
-rw-r--r--epan/dissectors/packet-isns.c58
-rw-r--r--epan/proto.c17
-rw-r--r--epan/proto.h4
29 files changed, 779 insertions, 543 deletions
diff --git a/epan/dissectors/packet-h221_nonstd.c b/epan/dissectors/packet-h221_nonstd.c
index 3ac0ab30b6..a1172c3b8c 100644
--- a/epan/dissectors/packet-h221_nonstd.c
+++ b/epan/dissectors/packet-h221_nonstd.c
@@ -31,6 +31,9 @@ void proto_reg_handoff_nonstd(void);
/* Define the nonstd proto */
static int proto_nonstd = -1;
+static int hf_h221_nonstd_netmeeting_codec = -1;
+static int hf_h221_nonstd_netmeeting_non_standard = -1;
+
/*
* Define the trees for nonstd
* We need one for nonstd itself and one for the nonstd paramters
@@ -56,13 +59,13 @@ dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
proto_tree *tr;
guint32 offset=0;
gint tvb_len;
- guint16 codec_value, codec_extra;
+ guint16 codec_extra;
it=proto_tree_add_protocol_format(tree, proto_nonstd, tvb, 0, tvb_length(tvb), "Microsoft NonStd");
tr=proto_item_add_subtree(it, ett_nonstd);
- tvb_len = tvb_length(tvb);
+ tvb_len = tvb_reported_length(tvb);
/*
* XXX - why do this test? Are there any cases where throwing
@@ -79,20 +82,18 @@ dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
if(tvb_len >= 23)
{
- codec_value = tvb_get_ntohs(tvb,offset+20);
codec_extra = tvb_get_ntohs(tvb,offset+22);
if(codec_extra == 0x0100)
{
- proto_tree_add_text(tr, tvb, offset+20, 2, "Microsoft NetMeeting Codec=0x%04X %s",
- codec_value,val_to_str(codec_value, ms_codec_vals,"Unknown (%u)"));
+ proto_tree_add_item(tr, hf_h221_nonstd_netmeeting_codec, tvb, offset+20, 2, ENC_BIG_ENDIAN);
}
else
{
- proto_tree_add_text(tr, tvb, offset, -1, "Microsoft NetMeeting Non Standard");
+ proto_tree_add_item(tr, hf_h221_nonstd_netmeeting_non_standard, tvb, offset, -1, ENC_NA);
}
}
@@ -103,6 +104,17 @@ dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
void
proto_register_nonstd(void)
{
+ static hf_register_info hf[] = {
+ { &hf_h221_nonstd_netmeeting_codec,
+ { "Microsoft NetMeeting Codec", "h221nonstd.netmeeting.codec", FT_UINT32, BASE_HEX,
+ VALS(ms_codec_vals), 0, NULL, HFILL }
+ },
+ { &hf_h221_nonstd_netmeeting_non_standard,
+ { "Microsoft NetMeeting Non Standard", "netmeeting.non_standard", FT_BYTES, BASE_NONE,
+ NULL, 0, NULL, HFILL }
+ },
+ };
+
static gint *ett[] = {
&ett_nonstd,
};
@@ -110,6 +122,7 @@ proto_register_nonstd(void)
proto_nonstd = proto_register_protocol("H221NonStandard","h221nonstd", "h221nonstd");
proto_register_subtree_array(ett, array_length(ett));
+ proto_register_field_array(proto_nonstd, hf, array_length(hf));
}
/* The registration hand-off routine */
diff --git a/epan/dissectors/packet-hdcp2.c b/epan/dissectors/packet-hdcp2.c
index 82ddbb185d..a1ea2d6c1f 100644
--- a/epan/dissectors/packet-hdcp2.c
+++ b/epan/dissectors/packet-hdcp2.c
@@ -63,6 +63,7 @@ static int hf_hdcp2_r_n = -1;
static int hf_hdcp2_l_prime = -1;
static int hf_hdcp2_e_dkey_ks = -1;
static int hf_hdcp2_r_iv = -1;
+static int hf_hdcp2_reserved = -1;
static expert_field ei_hdcp2_reserved_0 = EI_INIT;
@@ -171,8 +172,8 @@ dissect_hdcp2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
ptvcursor_add(cursor, hf_hdcp2_cert_n, N_LEN, ENC_NA);
ptvcursor_add(cursor, hf_hdcp2_cert_e, E_LEN, ENC_BIG_ENDIAN);
reserved = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor));
- pi = proto_tree_add_text(cert_tree, tvb,
- ptvcursor_current_offset(cursor), 2, "reserved bytes");
+ pi = proto_tree_add_item(cert_tree, hf_hdcp2_reserved, tvb,
+ ptvcursor_current_offset(cursor), 2, ENC_BIG_ENDIAN);
if (reserved != 0) {
expert_add_info(pinfo, pi, &ei_hdcp2_reserved_0);
}
@@ -269,7 +270,11 @@ proto_register_hdcp2(void)
NULL, 0, NULL, HFILL } },
{ &hf_hdcp2_r_iv,
{ "r_iv", "hdcp2.r_iv", FT_UINT64, BASE_HEX,
+ NULL, 0, NULL, HFILL } },
+ { &hf_hdcp2_reserved,
+ { "Reserved", "hdcp2.reserved", FT_UINT16, BASE_HEX,
NULL, 0, NULL, HFILL } }
+
};
static gint *ett[] = {
diff --git a/epan/dissectors/packet-hdmi.c b/epan/dissectors/packet-hdmi.c
index d28782f0fa..b0ec2a2ff1 100644
--- a/epan/dissectors/packet-hdmi.c
+++ b/epan/dissectors/packet-hdmi.c
@@ -52,6 +52,7 @@ static int hf_hdmi_edid_manf_serial = -1;
static int hf_hdmi_edid_manf_week = -1;
static int hf_hdmi_edid_mod_year = -1;
static int hf_hdmi_edid_manf_year = -1;
+static int hf_hdmi_edid_version = -1;
/* also called Source and Sink in the HDMI spec */
@@ -107,8 +108,6 @@ dissect_hdmi_edid(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tr
gchar manf_id_str[4]; /* 3 letters + 0-termination */
guint8 week, year;
int year_hf;
- guint8 edid_ver, edid_rev;
-
edid_tree = proto_tree_add_subtree(tree, tvb,
offset, -1, ett_hdmi_edid, NULL,
@@ -155,12 +154,7 @@ dissect_hdmi_edid(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tr
proto_item_append_text(yi, " (year %d)", 1990+year);
offset += 1;
- edid_ver = tvb_get_guint8(tvb, offset);
- edid_rev = tvb_get_guint8(tvb, offset+1);
-
- /* XXX make this filterable */
- proto_tree_add_text(edid_tree, tvb, offset, 2,
- "EDID Version %d.%d", edid_ver, edid_rev);
+ proto_tree_add_item(edid_tree, hf_hdmi_edid_version, tvb, offset, 2, ENC_NA);
/* XXX dissect the parts following the EDID header */
@@ -226,6 +220,11 @@ dissect_hdmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return dissect_hdmi_edid(tvb, offset, pinfo, hdmi_tree);
}
+static void
+hdmi_fmt_edid_version( gchar *result, guint32 revision )
+{
+ g_snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", (guint8)(( revision & 0xFF00 ) >> 8), (guint8)(revision & 0xFF) );
+}
void
proto_register_hdmi(void)
@@ -257,7 +256,11 @@ proto_register_hdmi(void)
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
{ &hf_hdmi_edid_manf_year,
{ "Year of manufacture", "hdmi.edid.manf_year",
- FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }
+ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
+ { &hf_hdmi_edid_version,
+ { "EDID Version", "hdmi.edid.version",
+ FT_UINT16, BASE_CUSTOM, hdmi_fmt_edid_version, 0, NULL, HFILL } }
+
};
static gint *ett[] = {
diff --git a/epan/dissectors/packet-hip.c b/epan/dissectors/packet-hip.c
index 6dd263fd11..71d67178c3 100644
--- a/epan/dissectors/packet-hip.c
+++ b/epan/dissectors/packet-hip.c
@@ -35,6 +35,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/addr_resolv.h>
#include <epan/ipproto.h>
@@ -296,7 +297,7 @@ static const value_string hit_suite_vals[] = {
};
/* functions */
-static int dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len);
+static int dissect_hip_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_item *ti, int type, int tlv_len);
static int proto_hip = -1;
static int hf_hip_proto = -1;
@@ -399,6 +400,9 @@ static int hf_hip_tlv_reg_from_port = -1;
static int hf_hip_tlv_reg_from_protocol = -1;
static int hf_hip_tlv_reg_from_reserved = -1;
static int hf_hip_tlv_reg_from_address = -1;
+static int hf_hip_encrypted_parameter_data = -1;
+static int hf_hip_fqdn = -1;
+static int hf_hip_nai = -1;
static gint ett_hip = -1;
static gint ett_hip_controls = -1;
@@ -407,171 +411,172 @@ static gint ett_hip_tlv_data = -1;
static gint ett_hip_tlv_host_id_hdr = -1;
static gint ett_hip_locator_data = -1;
+static expert_field ei_hip_tlv_host_id_len = EI_INIT;
+static expert_field ei_hip_tlv_host_id_e_len = EI_INIT;
+static expert_field ei_hip_tlv_host_id_hdr_alg = EI_INIT;
+
/* Dissect the HIP packet */
static void
dissect_hip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean udp)
{
- proto_tree *hip_tree, *hip_tlv_tree=NULL;
- proto_item *ti, *ti_tlv;
- int length, offset = 0, newoffset = 0;
- guint16 control_h, checksum_h, computed_checksum;
- guint16 tlv_type_h, tlv_length_h; /* For storing in host order */
- guint len;
- guint reported_len;
- vec_t cksum_vec[4];
- guint32 phdr[2];
-
- /* Payload format RFC 5201 section 5.1 */
- /* hiph_proto; */ /* payload protocol */
- guint8 hiph_hdr_len; /* header length */
- guint8 hiph_shim6_fixed_bit_s; /* This is always 0 */
- guint8 hiph_packet_type; /* packet type */
- guint8 hiph_res_ver, hiph_version, hiph_reserved;
- /* byte for reserved and version */
- guint8 hiph_shim6_fixed_bit_p; /* This is always 1 */
- /* checksum_h */ /* checksum */
- /* control_h */ /* control */
- /* HIP parameters ... */
-
- /* load the top pane info. This should be overwritten by
- the next protocol in the stack */
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "HIP");
- col_clear(pinfo->cinfo, COL_INFO);
-
- newoffset = offset;
- /* hiph Proto */
- newoffset++;
- hiph_hdr_len = tvb_get_guint8(tvb, newoffset);
- newoffset++;
- hiph_packet_type = tvb_get_guint8(tvb, newoffset);
- /* draft-ietf-shim6-proto-12 see section 5.3 */
- hiph_shim6_fixed_bit_p = (hiph_packet_type & HIP_SHIM6_FIXED_BIT_P_MASK) >> 7;
- hiph_packet_type = hiph_packet_type & HIP_PACKET_TYPE_MASK;
- newoffset++;
- hiph_res_ver = tvb_get_guint8(tvb, newoffset);
- /* divide to reserved and version and shim6_fixed_bit_s
- draft-ietf-shim6-proto-12 see section 5.3 */
- hiph_version = (hiph_res_ver & HIP_VERSION_MASK) >> 4;
- hiph_reserved = hiph_res_ver & HIP_RESERVED_MASK;
- hiph_shim6_fixed_bit_s = hiph_res_ver & HIP_SHIM6_FIXED_BIT_S_MASK;
- newoffset++;
- checksum_h = tvb_get_ntohs(tvb, newoffset);
- newoffset += 2;
- control_h = tvb_get_ntohs(tvb, newoffset);
-
- col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(hiph_packet_type, pinfo_vals, "Unknown"));
-
- /* populate a tree in the second pane with the status of the link layer (i.e. none) */
- if(tree) {
- ti = proto_tree_add_item(tree, proto_hip, tvb, 0, -1, ENC_NA);
-
- hip_tree = proto_item_add_subtree(ti, ett_hip);
- proto_tree_add_item(hip_tree, hf_hip_proto, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(hip_tree, hf_hip_hdr_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
- proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_p, tvb, offset+2, 1,
- hiph_shim6_fixed_bit_p,
- "Fixed P-bit: %u (Always zero)",
- hiph_shim6_fixed_bit_p);
- proto_tree_add_uint(hip_tree, hf_hip_packet_type, tvb, offset+2, 1,
- hiph_packet_type);
- proto_tree_add_uint_format_value(hip_tree, hf_hip_version, tvb, offset+3, 1,
- hiph_version, "%u, Reserved: %u",
- hiph_version, hiph_reserved);
- proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_s, tvb, offset+3, 1,
- hiph_shim6_fixed_bit_s,
- "Fixed S-bit: %u (%s)",
- hiph_shim6_fixed_bit_s,
- ((hiph_shim6_fixed_bit_s) ? "HIP" : "SHIM6"));
-
- /* Checksum - this is the same algorithm from UDP, ICMPv6 */
- reported_len = tvb_reported_length(tvb);
- len = tvb_captured_length(tvb);
- if (!pinfo->fragmented && len >= reported_len) {
- /* IPv4 or IPv6 addresses */
- SET_CKSUM_VEC_PTR(cksum_vec[0], (const guint8 *)pinfo->src.data, pinfo->src.len);
- SET_CKSUM_VEC_PTR(cksum_vec[1], (const guint8 *)pinfo->dst.data, pinfo->dst.len);
-
- /* the rest of the pseudo-header */
- if (pinfo->src.type == AT_IPv6) {
- phdr[0] = reported_len;
- phdr[0] = g_htonl(phdr[0]); /* Note: g_htonl() macro may eval arg multiple times */
- phdr[1] = g_htonl(IP_PROTO_HIP);
- SET_CKSUM_VEC_PTR(cksum_vec[2], (const guint8 *)&phdr, 8);
- } else {
- phdr[0] = (IP_PROTO_HIP<<16)+reported_len;
- phdr[0] = g_htonl(phdr[0]); /* Note: g_htonl() macro may eval arg multiple times */
- SET_CKSUM_VEC_PTR(cksum_vec[2], (const guint8 *)&phdr, 4);
- }
- /* pointer to the HIP header (packet data) */
- SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, reported_len);
- computed_checksum = in_cksum(cksum_vec, 4);
- if (computed_checksum == 0) {
- proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
- offset+4, 2, checksum_h,
- "0x%04x (correct)",
- checksum_h);
- } else {
- if (checksum_h == 0 && udp) {
- proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
- offset+4, 2, checksum_h,
- "0x%04x (correct)",
- checksum_h);
- } else {
- proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
- offset+4, 2, checksum_h,
- "0x%04x (incorrect, should be 0x%04x)",
- checksum_h,
- in_cksum_shouldbe(checksum_h,
- computed_checksum));
- }
- }
- } else {
- proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
- offset+4, 2, checksum_h,
- "0x%04x (unverified)",
- checksum_h);
- }
-
- ti = proto_tree_add_item(hip_tree, hf_hip_controls, tvb, offset+6, 2, ENC_BIG_ENDIAN);
- if (ti) {
- /* HIP Controls subtree */
- ti = proto_item_add_subtree(ti, ett_hip_controls);
- proto_tree_add_boolean(ti, hf_hip_controls_anon, tvb,
- offset+7,1, control_h);
- }
-
- offset += 8;
- proto_tree_add_item(hip_tree, hf_hip_hit_sndr, tvb, offset,
- 16, ENC_NA);
- offset += 16;
- proto_tree_add_item(hip_tree, hf_hip_hit_rcvr, tvb, offset,
- 16, ENC_NA);
- offset += 16;
-
- length = (hiph_hdr_len + 1) * 8;
- /* Begin TLV parsing */
- if (offset < length) {
- hip_tlv_tree = proto_tree_add_subtree(hip_tree, tvb, offset,
- -1, ett_hip_tlv, NULL, "HIP Parameters");
- }
- /* Parse type and length in TLV */
- while (offset < length)
- {
- tlv_type_h = tvb_get_ntohs(tvb, offset);
- tlv_length_h = tvb_get_ntohs(tvb, offset + 2);
- ti_tlv = proto_tree_add_uint_format(hip_tlv_tree, hf_hip_type, tvb,
- offset, 4 + tlv_length_h, tlv_type_h,
- "%s (type=%u, length=%u)",
- val_to_str_const(tlv_type_h, hip_param_vals, "Unknown"),
- tlv_type_h, tlv_length_h);
-
- /* Parse value */
- dissect_hip_tlv(tvb, offset, ti_tlv, tlv_type_h, tlv_length_h);
-
- offset += 11 + tlv_length_h - (tlv_length_h + 3) % 8;
- }
-
- }
+ proto_tree *hip_tree, *hip_tlv_tree=NULL;
+ proto_item *ti, *ti_tlv;
+ int length, offset = 0, newoffset = 0;
+ guint16 control_h, checksum_h, computed_checksum;
+ guint16 tlv_type_h, tlv_length_h; /* For storing in host order */
+ guint len;
+ guint reported_len;
+ vec_t cksum_vec[4];
+ guint32 phdr[2];
+
+ /* Payload format RFC 5201 section 5.1 */
+ /* hiph_proto; */ /* payload protocol */
+ guint8 hiph_hdr_len; /* header length */
+ guint8 hiph_shim6_fixed_bit_s; /* This is always 0 */
+ guint8 hiph_packet_type; /* packet type */
+ guint8 hiph_res_ver, hiph_version, hiph_reserved;
+ /* byte for reserved and version */
+ guint8 hiph_shim6_fixed_bit_p; /* This is always 1 */
+ /* checksum_h */ /* checksum */
+ /* control_h */ /* control */
+ /* HIP parameters ... */
+
+ /* load the top pane info. This should be overwritten by
+ the next protocol in the stack */
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "HIP");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ newoffset = offset;
+ /* hiph Proto */
+ newoffset++;
+ hiph_hdr_len = tvb_get_guint8(tvb, newoffset);
+ newoffset++;
+ hiph_packet_type = tvb_get_guint8(tvb, newoffset);
+ /* draft-ietf-shim6-proto-12 see section 5.3 */
+ hiph_shim6_fixed_bit_p = (hiph_packet_type & HIP_SHIM6_FIXED_BIT_P_MASK) >> 7;
+ hiph_packet_type = hiph_packet_type & HIP_PACKET_TYPE_MASK;
+ newoffset++;
+ hiph_res_ver = tvb_get_guint8(tvb, newoffset);
+ /* divide to reserved and version and shim6_fixed_bit_s
+ draft-ietf-shim6-proto-12 see section 5.3 */
+ hiph_version = (hiph_res_ver & HIP_VERSION_MASK) >> 4;
+ hiph_reserved = hiph_res_ver & HIP_RESERVED_MASK;
+ hiph_shim6_fixed_bit_s = hiph_res_ver & HIP_SHIM6_FIXED_BIT_S_MASK;
+ newoffset++;
+ checksum_h = tvb_get_ntohs(tvb, newoffset);
+ newoffset += 2;
+ control_h = tvb_get_ntohs(tvb, newoffset);
+
+ col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(hiph_packet_type, pinfo_vals, "Unknown"));
+
+ /* populate a tree in the second pane with the status of the link layer (i.e. none) */
+ ti = proto_tree_add_item(tree, proto_hip, tvb, 0, -1, ENC_NA);
+
+ hip_tree = proto_item_add_subtree(ti, ett_hip);
+ proto_tree_add_item(hip_tree, hf_hip_proto, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(hip_tree, hf_hip_hdr_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_p, tvb, offset+2, 1,
+ hiph_shim6_fixed_bit_p,
+ "Fixed P-bit: %u (Always zero)",
+ hiph_shim6_fixed_bit_p);
+ proto_tree_add_uint(hip_tree, hf_hip_packet_type, tvb, offset+2, 1,
+ hiph_packet_type);
+ proto_tree_add_uint_format_value(hip_tree, hf_hip_version, tvb, offset+3, 1,
+ hiph_version, "%u, Reserved: %u",
+ hiph_version, hiph_reserved);
+ proto_tree_add_uint_format(hip_tree, hf_hip_shim6_fixed_bit_s, tvb, offset+3, 1,
+ hiph_shim6_fixed_bit_s,
+ "Fixed S-bit: %u (%s)",
+ hiph_shim6_fixed_bit_s,
+ ((hiph_shim6_fixed_bit_s) ? "HIP" : "SHIM6"));
+
+ /* Checksum - this is the same algorithm from UDP, ICMPv6 */
+ reported_len = tvb_reported_length(tvb);
+ len = tvb_captured_length(tvb);
+ if (!pinfo->fragmented && len >= reported_len) {
+ /* IPv4 or IPv6 addresses */
+ SET_CKSUM_VEC_PTR(cksum_vec[0], (const guint8 *)pinfo->src.data, pinfo->src.len);
+ SET_CKSUM_VEC_PTR(cksum_vec[1], (const guint8 *)pinfo->dst.data, pinfo->dst.len);
+
+ /* the rest of the pseudo-header */
+ if (pinfo->src.type == AT_IPv6) {
+ phdr[0] = reported_len;
+ phdr[0] = g_htonl(phdr[0]); /* Note: g_htonl() macro may eval arg multiple times */
+ phdr[1] = g_htonl(IP_PROTO_HIP);
+ SET_CKSUM_VEC_PTR(cksum_vec[2], (const guint8 *)&phdr, 8);
+ } else {
+ phdr[0] = (IP_PROTO_HIP<<16)+reported_len;
+ phdr[0] = g_htonl(phdr[0]); /* Note: g_htonl() macro may eval arg multiple times */
+ SET_CKSUM_VEC_PTR(cksum_vec[2], (const guint8 *)&phdr, 4);
+ }
+ /* pointer to the HIP header (packet data) */
+ SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, reported_len);
+ computed_checksum = in_cksum(cksum_vec, 4);
+ if (computed_checksum == 0) {
+ proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
+ offset+4, 2, checksum_h,
+ "0x%04x (correct)",
+ checksum_h);
+ } else {
+ if (checksum_h == 0 && udp) {
+ proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
+ offset+4, 2, checksum_h,
+ "0x%04x (correct)",
+ checksum_h);
+ } else {
+ proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
+ offset+4, 2, checksum_h,
+ "0x%04x (incorrect, should be 0x%04x)",
+ checksum_h,
+ in_cksum_shouldbe(checksum_h,
+ computed_checksum));
+ }
+ }
+ } else {
+ proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
+ offset+4, 2, checksum_h,
+ "0x%04x (unverified)",
+ checksum_h);
+ }
+
+ ti = proto_tree_add_item(hip_tree, hf_hip_controls, tvb, offset+6, 2, ENC_BIG_ENDIAN);
+ if (ti) {
+ /* HIP Controls subtree */
+ ti = proto_item_add_subtree(ti, ett_hip_controls);
+ proto_tree_add_boolean(ti, hf_hip_controls_anon, tvb,
+ offset+7,1, control_h);
+ }
+
+ offset += 8;
+ proto_tree_add_item(hip_tree, hf_hip_hit_sndr, tvb, offset,
+ 16, ENC_NA);
+ offset += 16;
+ proto_tree_add_item(hip_tree, hf_hip_hit_rcvr, tvb, offset,
+ 16, ENC_NA);
+ offset += 16;
+
+ length = (hiph_hdr_len + 1) * 8;
+ /* Begin TLV parsing */
+ if (offset < length) {
+ hip_tlv_tree = proto_tree_add_subtree(hip_tree, tvb, offset,
+ -1, ett_hip_tlv, NULL, "HIP Parameters");
+ }
+ /* Parse type and length in TLV */
+ while (offset < length)
+ {
+ tlv_type_h = tvb_get_ntohs(tvb, offset);
+ tlv_length_h = tvb_get_ntohs(tvb, offset + 2);
+ ti_tlv = proto_tree_add_uint_format(hip_tlv_tree, hf_hip_type, tvb,
+ offset, 4 + tlv_length_h, tlv_type_h,
+ "%s (type=%u, length=%u)",
+ val_to_str_const(tlv_type_h, hip_param_vals, "Unknown"),
+ tlv_type_h, tlv_length_h);
+
+ /* Parse value */
+ dissect_hip_tlv(tvb, pinfo, offset, ti_tlv, tlv_type_h, tlv_length_h);
+
+ offset += 11 + tlv_length_h - (tlv_length_h + 3) % 8;
+ }
}
static void
@@ -594,10 +599,10 @@ dissect_hip_in_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static int
-dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len)
+dissect_hip_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_item *ti, int type, int tlv_len)
{
proto_tree *t=NULL;
- proto_item *ti_tlv, *ti_loc;
+ proto_item *ti_tlv, *ti_loc, *hi_len_item, *e_len_item, *arg_item;
guint8 n, algorithm, reg_type;
guint16 trans, hi_len, di_len, di_type, e_len, pv_len;
guint32 reserved, hi_hdr;
@@ -871,8 +876,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
* and
* encrypted data after that.
*/
- proto_tree_add_text(t, tvb, newoffset, tlv_len - 4,
- "Encrypted Parameter Data (%u bytes)", tlv_len - 4);
+ proto_tree_add_item(t, hf_hip_encrypted_parameter_data, tvb, newoffset, tlv_len - 4, ENC_NA);
break;
case PARAM_HIP_CIPHER:
while (tlv_len > 0) {
@@ -896,7 +900,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
break;
case PARAM_HOST_ID:
hi_len = tvb_get_ntohs(tvb, newoffset);
- proto_tree_add_item(t, hf_hip_tlv_host_id_len, tvb, newoffset, 2, ENC_BIG_ENDIAN);
+ hi_len_item = proto_tree_add_item(t, hf_hip_tlv_host_id_len, tvb, newoffset, 2, ENC_BIG_ENDIAN);
newoffset += 2;
di_len = tvb_get_ntohs(tvb, newoffset);
di_type = (di_len >> 12) & 0x000F; /* get 4 bits for DI type */
@@ -915,21 +919,21 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
hi_hdr = tvb_get_ntohl(tvb, newoffset);
ti_tlv = proto_tree_add_item(t, hf_hip_tlv_host_id_hdr,
tvb, newoffset, 4, ENC_BIG_ENDIAN);
- if (ti_tlv) {
- ti_tlv = proto_item_add_subtree(ti_tlv, ett_hip_tlv_host_id_hdr);
- /* HDR Flags*/
- proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_flags, tvb,
- newoffset, 2, hi_hdr);
- newoffset += 2;
- /* HDR Protocol */
- proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_proto, tvb,
- newoffset, 1, hi_hdr);
- newoffset += 1;
- /* HDR Algorithm */
- proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_alg, tvb,
- newoffset, 1, hi_hdr);
- }
+
+ ti_tlv = proto_item_add_subtree(ti_tlv, ett_hip_tlv_host_id_hdr);
+ /* HDR Flags*/
+ proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_flags, tvb,
+ newoffset, 2, hi_hdr);
+ newoffset += 2;
+ /* HDR Protocol */
+ proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_proto, tvb,
+ newoffset, 1, hi_hdr);
+ newoffset += 1;
+ /* HDR Algorithm */
algorithm = tvb_get_guint8(tvb, newoffset);
+ arg_item = proto_tree_add_uint(ti_tlv, hf_hip_tlv_host_id_hdr_alg, tvb,
+ newoffset, 1, hi_hdr);
+
switch (algorithm) {
case HI_ALG_DSA:
/* DSA KEY RR RFC 2536
@@ -972,7 +976,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
newoffset++; /* 12 + offset */
/* E len */
e_len = tvb_get_guint8(tvb, newoffset);
- proto_tree_add_item(t, hf_hip_tlv_host_id_e_len, tvb, newoffset,
+ e_len_item = proto_tree_add_item(t, hf_hip_tlv_host_id_e_len, tvb, newoffset,
(e_len > 255) ? 3 : 1, ENC_BIG_ENDIAN);
newoffset++;
hi_len -= 5; /* subtract RDATA + e_len */
@@ -982,8 +986,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
hi_len -= 2;
}
if (e_len > 512) { /* per, RFC 3110 < 4096 bits */
- proto_tree_add_text(t, tvb, newoffset, 2,
- "<< e_len too large >>");
+ expert_add_info(pinfo, e_len_item, &ei_hip_tlv_host_id_len);
break;
}
/* e */
@@ -993,8 +996,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
hi_len -= e_len;
if (hi_len > 512) {
- proto_tree_add_text(t, tvb, newoffset, 1,
- "<< Invalid HI length >>");
+ expert_add_info(pinfo, hi_len_item, &ei_hip_tlv_host_id_len);
break;
}
@@ -1003,8 +1005,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
hi_len, ENC_NA);
break;
default:
- proto_tree_add_text(t, tvb, newoffset, 1,
- "Unknown algorithm type (%d).\n", algorithm);
+ expert_add_info(pinfo, arg_item, &ei_hip_tlv_host_id_hdr_alg);
break;
}
@@ -1013,12 +1014,10 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
break;
if (di_type == 1) {
/* RFC 1035 */
- proto_tree_add_text(t, tvb, offset+16+hi_len, di_len,
- "FQDN: %s", tvb_get_string_enc(wmem_packet_scope(), tvb, offset+16+hi_len, di_len, ENC_ASCII));
+ proto_tree_add_item(t, hf_hip_fqdn, tvb, offset+16+hi_len, di_len, ENC_ASCII|ENC_NA);
} else if (di_type == 2) {
/* RFC 4282 */
- proto_tree_add_text(t, tvb, offset+16+hi_len, di_len,
- "NAI: %s", tvb_get_string_enc(wmem_packet_scope(), tvb, offset+16+hi_len, di_len, ENC_ASCII));
+ proto_tree_add_item(t, hf_hip_nai, tvb, offset+16+hi_len, di_len, ENC_ASCII|ENC_NA);
}
break;
case PARAM_CERT: /* CERT */
@@ -1559,6 +1558,18 @@ proto_register_hip(void)
{ "Address" , "hip.tlv_reg_from_address",
FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ { &hf_hip_encrypted_parameter_data,
+ { "Encrypted Parameter Data" , "hip.encrypted_parameter_data",
+ FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+
+ { &hf_hip_fqdn,
+ { "FQDN" , "hip.fqdn",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+
+ { &hf_hip_nai,
+ { "NAI" , "hip.nai",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+
};
static gint *ett[] = {
@@ -1570,11 +1581,20 @@ proto_register_hip(void)
&ett_hip_locator_data,
};
- proto_hip = proto_register_protocol("Host Identity Protocol",
- "HIP", "hip");
+ static ei_register_info ei[] = {
+ { &ei_hip_tlv_host_id_len, { "hip.tlv.host_id_length.invalid", PI_PROTOCOL, PI_WARN, "Invalid HI length", EXPFILL }},
+ { &ei_hip_tlv_host_id_e_len, { "hip.tlv.host_id_e_length.invalid", PI_PROTOCOL, PI_WARN, "e_len too large", EXPFILL }},
+ { &ei_hip_tlv_host_id_hdr_alg, { "hip.tlv.host_id_header_algo.invalid", PI_PROTOCOL, PI_WARN, "Unknown algorithm type", EXPFILL }},
+ };
+
+ expert_module_t* expert_hip;
+
+ proto_hip = proto_register_protocol("Host Identity Protocol", "HIP", "hip");
proto_register_field_array(proto_hip, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_hip = expert_register_protocol(proto_hip);
+ expert_register_field_array(expert_hip, ei, array_length(ei));
}
void
diff --git a/epan/dissectors/packet-homeplug.c b/epan/dissectors/packet-homeplug.c
index 9cad7a3b59..2ef8840eb8 100644
--- a/epan/dissectors/packet-homeplug.c
+++ b/epan/dissectors/packet-homeplug.c
@@ -28,6 +28,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/etypes.h>
@@ -159,6 +160,7 @@ static int hf_homeplug_ns_extended = -1;
static int hf_homeplug_ns_netw_ctrl_ac = -1;
static int hf_homeplug_ns_netw_ctrl_icid = -1;
static int hf_homeplug_ns_bytes40_robo = -1;
+static int hf_homeplug_ns_mhz = -1;
static int hf_homeplug_ns_fails_robo = -1;
static int hf_homeplug_ns_drops_robo = -1;
static int hf_homeplug_ns_netw_da = -1;
@@ -228,6 +230,7 @@ static gint ett_homeplug_bcn = -1;
static gint ett_homeplug_bcl = -1;
static gint ett_homeplug_stc = -1;
+static expert_field ei_homeplug_tone_map_not_exist = EI_INIT;
static guint8 homeplug_ne = 0;
static guint8 homeplug_melen = 0;
@@ -1016,7 +1019,6 @@ static void dissect_homeplug_ns(ptvcursor_t * cursor, packet_info * pinfo)
guint8 iTone = 0;
guint8 i_buffer = 0;
- guint16 ns_bytes40 = 0;
guint64 newt_da = 0;
gboolean extended = (homeplug_melen >= HOMEPLUG_NS_EXT_LEN);
proto_item * ti;
@@ -1038,11 +1040,7 @@ static void dissect_homeplug_ns(ptvcursor_t * cursor, packet_info * pinfo)
ptvcursor_add(cursor, hf_homeplug_ns_netw_ctrl_icid, 1, ENC_BIG_ENDIAN);
ptvcursor_add_no_advance(cursor, hf_homeplug_ns_bytes40_robo, 2, ENC_LITTLE_ENDIAN);
- ns_bytes40 = tvb_get_letohs(ptvcursor_tvbuff(cursor),
- ptvcursor_current_offset(cursor));
- proto_tree_add_text(ptvcursor_tree(cursor), ptvcursor_tvbuff(cursor),
- ptvcursor_current_offset(cursor), 2, "MHz : %.3f", (float)(ns_bytes40)/42);
- ptvcursor_advance(cursor, 2);
+ ptvcursor_add(cursor, hf_homeplug_ns_mhz, 2, ENC_BIG_ENDIAN);
ptvcursor_add(cursor, hf_homeplug_ns_fails_robo, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_homeplug_ns_drops_robo, 2, ENC_LITTLE_ENDIAN);
@@ -1060,18 +1058,14 @@ static void dissect_homeplug_ns(ptvcursor_t * cursor, packet_info * pinfo)
ptvcursor_add(cursor, hf_homeplug_ns_netw_da, 6, ENC_NA);
ptvcursor_add_no_advance(cursor, hf_homeplug_ns_bytes40, 2, ENC_LITTLE_ENDIAN);
- ns_bytes40 = tvb_get_letohs(ptvcursor_tvbuff(cursor),
- ptvcursor_current_offset(cursor));
- proto_tree_add_text(ptvcursor_tree(cursor), ptvcursor_tvbuff(cursor),
- ptvcursor_current_offset(cursor), 2, "MHz : %.3f", (float)(ns_bytes40)/42);
- ptvcursor_advance(cursor, 2);
+ ptvcursor_add(cursor, hf_homeplug_ns_mhz, 2, ENC_BIG_ENDIAN);
ptvcursor_add(cursor, hf_homeplug_ns_fails, 2, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_homeplug_ns_drops, 2, ENC_LITTLE_ENDIAN);
}
ptvcursor_pop_subtree(cursor);
} else {
- proto_tree_add_text(ptvcursor_tree(cursor), ptvcursor_tvbuff(cursor),
+ proto_tree_add_expert_format(ptvcursor_tree(cursor), pinfo, &ei_homeplug_tone_map_not_exist, ptvcursor_tvbuff(cursor),
ptvcursor_current_offset(cursor), 12, "Tone Map #%d does not exist", iTone+1);
}
@@ -1353,6 +1347,11 @@ dissect_homeplug(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
ptvcursor_free(cursor);
}
+static void
+homeplug_fmt_mhz( gchar *result, guint32 ns_bytes40 )
+{
+ g_snprintf( result, ITEM_LABEL_LENGTH, "%.3f", (float)(ns_bytes40)/42);
+}
void
proto_reg_handoff_homeplug(void)
@@ -1915,6 +1914,11 @@ proto_register_homeplug(void)
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
+ { &hf_homeplug_ns_mhz,
+ { "Mhz", "homeplug.ns.mhz",
+ FT_UINT16, BASE_CUSTOM, homeplug_fmt_mhz, 0x0, NULL, HFILL }
+ },
+
{ &hf_homeplug_ns_fails_robo,
{ "Fails Received in ROBO", "homeplug.ns.fails_robo",
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
@@ -2174,9 +2178,16 @@ proto_register_homeplug(void)
&ett_homeplug_stc
};
+ static ei_register_info ei[] = {
+ { &ei_homeplug_tone_map_not_exist, { "homeplug.tone_map_not_exist", PI_PROTOCOL, PI_WARN, "Tone Map does not exist", EXPFILL }},
+ };
+
+ expert_module_t* expert_homeplug;
+
proto_homeplug = proto_register_protocol("HomePlug protocol", "HomePlug", "homeplug");
proto_register_field_array(proto_homeplug, hf, array_length(hf));
-
proto_register_subtree_array(ett, array_length(ett));
+ expert_homeplug = expert_register_protocol(proto_homeplug);
+ expert_register_field_array(expert_homeplug, ei, array_length(ei));
}
diff --git a/epan/dissectors/packet-hpext.c b/epan/dissectors/packet-hpext.c
index ef5b15cb61..2b9b1099f0 100644
--- a/epan/dissectors/packet-hpext.c
+++ b/epan/dissectors/packet-hpext.c
@@ -60,6 +60,10 @@ static header_field_info hfi_hpext_sxsap HPEXT_HFI_INIT =
{ "SXSAP", "hpext.sxsap", FT_UINT16, BASE_HEX,
VALS(xsap_vals), 0x0, NULL, HFILL };
+static header_field_info hfi_hpext_reserved HPEXT_HFI_INIT =
+ { "Reserved", "hpext.reserved", FT_UINT24, BASE_HEX,
+ NULL, 0x0, NULL, HFILL };
+
static gint ett_hpext = -1;
@@ -81,7 +85,7 @@ dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
ti = proto_tree_add_item(tree, hfi_hpext, tvb, 0, 7, ENC_NA);
hpext_tree = proto_item_add_subtree(ti, ett_hpext);
- proto_tree_add_text(hpext_tree, tvb, 0, 3, "Reserved");
+ proto_tree_add_item(hpext_tree, &hfi_hpext_reserved, tvb, 0, 3, ENC_NA);
proto_tree_add_uint(hpext_tree, &hfi_hpext_dxsap, tvb, 3,
2, dxsap);
proto_tree_add_uint(hpext_tree, &hfi_hpext_sxsap, tvb, 5,
diff --git a/epan/dissectors/packet-hpfeeds.c b/epan/dissectors/packet-hpfeeds.c
index 151b590396..33cb45f18d 100644
--- a/epan/dissectors/packet-hpfeeds.c
+++ b/epan/dissectors/packet-hpfeeds.c
@@ -127,15 +127,13 @@ static void
dissect_hpfeeds_info_pdu(tvbuff_t *tvb, proto_tree *tree, guint offset)
{
guint8 len = 0;
- proto_item *ti = NULL;
- proto_tree *data_subtree = NULL;
+ proto_tree *data_subtree;
guint8 *strptr = NULL;
len = tvb_get_guint8(tvb, offset);
/* don't move the offset yet as we need to get data after this operation */
strptr = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, len, ENC_ASCII);
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Broker: %s", strptr);
- data_subtree = proto_item_add_subtree(ti, ett_hpfeeds);
+ data_subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_hpfeeds, NULL, "Broker: %s", strptr);
proto_tree_add_item(data_subtree, hf_hpfeeds_server_len, tvb, offset, 1,
ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-hpsw.c b/epan/dissectors/packet-hpsw.c
index c1a08fbc66..4d01765abb 100644
--- a/epan/dissectors/packet-hpsw.c
+++ b/epan/dissectors/packet-hpsw.c
@@ -54,6 +54,7 @@ static int hf_hpsw_config_name = -1;
static int hf_hpsw_root_mac_addr = -1;
static int hf_hpsw_device_id = -1;
static int hf_hpsw_device_id_data = -1;
+static int hf_hpsw_data = -1;
static gint ett_hpsw = -1;
@@ -220,7 +221,7 @@ dissect_hpsw_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length,
break;
default:
- proto_tree_add_text(tree, tvb, offset, length, "Data");
+ proto_tree_add_item(tree, hf_hpsw_data, tvb, offset, length, ENC_NA);
break;
}
}
@@ -337,6 +338,9 @@ proto_register_hpsw(void)
{ &hf_hpsw_device_id_data,
{ "Data", "hpsw.device_id_data", FT_BYTES, BASE_NONE,
NULL, 0x0, NULL, HFILL }},
+ { &hf_hpsw_data,
+ { "Data", "hpsw.data", FT_BYTES, BASE_NONE,
+ NULL, 0x0, NULL, HFILL }},
};
static gint *ett[] = {
diff --git a/epan/dissectors/packet-iapp.c b/epan/dissectors/packet-iapp.c
index ac95ba5c21..3608e6580a 100644
--- a/epan/dissectors/packet-iapp.c
+++ b/epan/dissectors/packet-iapp.c
@@ -24,6 +24,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/to_str.h>
#include <epan/oui.h>
@@ -34,12 +35,29 @@ void proto_reg_handoff_iapp(void);
static int proto_iapp = -1;
static int hf_iapp_version = -1;
static int hf_iapp_type = -1;
+static int hf_iapp_cap_forwarding = -1;
+static int hf_iapp_cap_wep = -1;
+static int hf_iapp_auth_status = -1;
+static int hf_iapp_auth_string = -1;
+static int hf_iapp_auth_uint = -1;
+static int hf_iapp_auth_ipaddr = -1;
+static int hf_iapp_auth_trailer = -1;
+static int hf_iapp_pdu_ssid = -1;
+static int hf_iapp_pdu_bytes = -1;
+static int hf_iapp_pdu_uint = -1;
+static int hf_iapp_pdu_phytype = -1;
+static int hf_iapp_pdu_regdomain = -1;
+static int hf_iapp_pdu_oui_ident = -1;
/* Initialize the subtree pointers */
static gint ett_iapp = -1;
static gint ett_iapp_pdu = -1;
+static gint ett_iapp_subpdu = -1;
static gint ett_iapp_cap = -1;
static gint ett_iapp_auth = -1;
+static gint ett_iapp_authinfo = -1;
+
+static expert_field ei_iapp_no_pdus = EI_INIT;
#define UDP_PORT_IAPP 2313
@@ -95,18 +113,6 @@ static gint ett_iapp_auth = -1;
#define IAPP_AUTH_IPADDR 0x0e
#define IAPP_AUTH_TRAILER 0xff
-
-typedef struct _e_iapphdr {
- guint8 ia_version;
- guint8 ia_type;
-} e_iapphdr;
-
-typedef struct _e_pduhdr {
- guint8 pdu_type;
- guint8 pdu_len_h;
- guint8 pdu_len_l;
-} e_pduhdr;
-
static const value_string iapp_vals[] = {
{IAPP_ANNOUNCE_REQUEST, "Announce Request"},
{IAPP_ANNOUNCE_RESPONSE, "Announce Response"},
@@ -180,45 +186,29 @@ static const value_string iapp_auth_type_vals[] = {
/* dissect a capability bit field */
-static void dissect_caps(proto_item *pitem, tvbuff_t *tvb, int offset)
+static void dissect_caps(proto_tree *tree, tvbuff_t *tvb, int offset)
{
proto_tree *captree;
- int bit, val, thisbit;
- const gchar *strval;
- gchar bitval[4+1+4+1]; /* "xxxx xxxx\0" */
- captree = proto_item_add_subtree(pitem, ett_iapp_cap);
- val = tvb_get_guint8(tvb, offset + 3);
-
- for (bit = 7; bit >= 0; bit--)
- {
- thisbit = 1 << bit;
- strval = try_val_to_str(thisbit, iapp_cap_vals);
- if (strval)
- {
- other_decode_bitfield_value(bitval, val, thisbit, 8);
- proto_tree_add_text(captree, tvb, offset + 3, 1, "%s %s: %s",
- bitval, strval, val & thisbit ? "Yes" : "No");
- }
- }
+ captree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_iapp_cap, NULL, "Capabilities");
+ proto_tree_add_item(captree, hf_iapp_cap_forwarding, tvb, offset, 1, ENC_NA);
+ proto_tree_add_item(captree, hf_iapp_cap_wep, tvb, offset, 1, ENC_NA);
}
static void
-append_authval_str(proto_item *ti, int type, int len, tvbuff_t *tvb, int offset)
+add_authval_str(proto_tree *tree, int type, int len, tvbuff_t *tvb, int offset)
{
- int z, val;
-
- proto_item_append_text(ti, " Value: ");
+ int val;
switch (type)
{
case IAPP_AUTH_STATUS:
- proto_item_append_text(ti, "%s", tvb_get_guint8(tvb, offset + 3) ? "Authenticated" : "Not authenticated");
+ val = tvb_get_guint8(tvb, offset);
+ proto_tree_add_uint_format_value(tree, hf_iapp_auth_status, tvb, offset, 1, val, "%s", val ? "Authenticated" : "Not authenticated");
break;
case IAPP_AUTH_USERNAME:
case IAPP_AUTH_PROVNAME:
- proto_item_append_text(ti, "\"%s\"",
- tvb_format_text(tvb, offset + 3, len));
+ proto_tree_add_item(tree, hf_iapp_auth_string, tvb, offset, 1, ENC_ASCII|ENC_NA);
break;
case IAPP_AUTH_RXPKTS:
case IAPP_AUTH_TXPKTS:
@@ -227,22 +217,19 @@ append_authval_str(proto_item *ti, int type, int len, tvbuff_t *tvb, int offset)
case IAPP_AUTH_RXGWORDS:
case IAPP_AUTH_TXGWORDS:
case IAPP_AUTH_VOLLIMIT:
- val = tvb_get_ntohl(tvb, offset + 3);
- proto_item_append_text(ti, "%d", val);
+ proto_tree_add_item(tree, hf_iapp_auth_uint, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
case IAPP_AUTH_LOGINTIME:
case IAPP_AUTH_TIMELIMIT:
case IAPP_AUTH_ACCCYCLE:
- val = tvb_get_ntohl(tvb, offset + 3);
- proto_item_append_text(ti, "%d seconds", val);
+ val = tvb_get_ntohl(tvb, offset);
+ proto_tree_add_uint_format_value(tree, hf_iapp_auth_uint, tvb, offset, 4, val, "%d seconds", val);
break;
case IAPP_AUTH_IPADDR:
- proto_item_append_text(ti, "%s", tvb_ip_to_str(tvb, offset + 3));
+ proto_tree_add_item(tree, hf_iapp_auth_ipaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
case IAPP_AUTH_TRAILER:
- for (z = 0; z < len; z++)
- proto_item_append_text(ti, "%s%02x", z ? " " : "",
- tvb_get_guint8(tvb, offset + 3 + z));
+ proto_tree_add_item(tree, hf_iapp_auth_trailer, tvb, offset, len, ENC_NA);
break;
}
}
@@ -251,23 +238,22 @@ append_authval_str(proto_item *ti, int type, int len, tvbuff_t *tvb, int offset)
static void dissect_authinfo(proto_item *pitem, tvbuff_t *tvb, int offset, int sumlen)
{
- proto_tree *authtree;
- proto_item *ti;
- e_pduhdr pduhdr;
- int len;
+ proto_tree *authtree, *value_tree;
+ guint8 pdu_type;
+ guint16 len;
authtree = proto_item_add_subtree(pitem, ett_iapp_auth);
while (sumlen > 0)
{
- tvb_memcpy(tvb, (guint8 *)&pduhdr, offset, sizeof(e_pduhdr));
- len = (((int)pduhdr.pdu_len_h) << 8) + pduhdr.pdu_len_l;
+ pdu_type = tvb_get_guint8(tvb, offset);
+ len = tvb_get_ntohs(tvb, offset+1);
- ti = proto_tree_add_text(authtree, tvb, offset, len + 3,
- "%s(%d)",
- val_to_str_const(pduhdr.pdu_type, iapp_auth_type_vals, "Unknown PDU Type"),
- pduhdr.pdu_type);
- append_authval_str(ti, pduhdr.pdu_type, len, tvb, offset);
+ value_tree = proto_tree_add_subtree_format(authtree, tvb, offset, len + 3,
+ ett_iapp_authinfo, NULL, "%s (%d)",
+ val_to_str_const(pdu_type, iapp_auth_type_vals, "Unknown PDU Type"),
+ pdu_type);
+ add_authval_str(value_tree, pdu_type, len, tvb, offset+3);
sumlen -= (len + 3);
offset += (len + 3);
@@ -277,85 +263,55 @@ static void dissect_authinfo(proto_item *pitem, tvbuff_t *tvb, int offset, int s
/* get displayable values of PDU contents */
static gboolean
-append_pduval_str(proto_item *ti, int type, int len, tvbuff_t *tvb, int offset,
+append_pduval_str(proto_tree *tree, int type, int len, tvbuff_t *tvb, int offset,
gboolean is_fhss)
{
- int z, val;
- const gchar *strval;
-
- proto_item_append_text(ti, " Value: ");
+ int val;
switch (type)
{
case IAPP_PDU_SSID:
- proto_item_append_text(ti, "\"%s\"",
- tvb_format_text(tvb, offset + 3, len));
+ proto_tree_add_item(tree, hf_iapp_pdu_ssid, tvb, offset, len, ENC_ASCII|ENC_NA);
break;
case IAPP_PDU_BSSID:
case IAPP_PDU_OLDBSSID:
case IAPP_PDU_MSADDR:
- for (z = 0; z < len; z++)
- proto_item_append_text(ti, "%s%02x", z ? ":" : "",
- tvb_get_guint8(tvb, offset + 3 + z));
+ proto_tree_add_item(tree, hf_iapp_pdu_bytes, tvb, offset, len, ENC_NA);
break;
case IAPP_PDU_CAPABILITY:
- {
- int mask, first = 1;
-
- val = tvb_get_guint8(tvb, offset + 3);
- proto_item_append_text(ti, "%02x (", val);
- for (mask = 0x80; mask; mask >>= 1)
- if (val & mask)
- {
- strval = try_val_to_str(mask, iapp_cap_vals);
- if (strval)
- {
- if (!first)
- proto_item_append_text(ti, " ");
- proto_item_append_text(ti, "%s", strval);
- first=0;
- }
- }
- proto_item_append_text(ti, ")");
+ dissect_caps(tree, tvb, offset);
break;
- }
case IAPP_PDU_ANNOUNCEINT:
- val = tvb_get_ntohs(tvb, offset + 3);
- proto_item_append_text(ti, "%d seconds", val);
+ val = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_uint_format_value(tree, hf_iapp_pdu_uint, tvb, offset, 2, val, "%d seconds", val);
break;
case IAPP_PDU_HOTIMEOUT:
case IAPP_PDU_BEACONINT:
- val = tvb_get_ntohs(tvb, offset + 3);
- proto_item_append_text(ti, "%d Kus", val);
+ val = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_uint_format_value(tree, hf_iapp_pdu_uint, tvb, offset, 2, val, "%d Kus", val);
break;
case IAPP_PDU_MESSAGEID:
- val = tvb_get_ntohs(tvb, offset + 3);
- proto_item_append_text(ti, "%d", val);
+ proto_tree_add_item(tree, hf_iapp_pdu_uint, tvb, offset, 2, ENC_BIG_ENDIAN);
break;
case IAPP_PDU_PHYTYPE:
- val = tvb_get_guint8(tvb, offset + 3);
- strval = val_to_str_const(val, iapp_phy_vals, "Unknown");
- proto_item_append_text(ti, "%s", strval);
- is_fhss = (val == IAPP_PHY_FHSS);
+ proto_tree_add_item(tree, hf_iapp_pdu_phytype, tvb, offset, 1, ENC_BIG_ENDIAN);
+ is_fhss = (tvb_get_guint8(tvb, offset) == IAPP_PHY_FHSS);
break;
case IAPP_PDU_REGDOMAIN:
- val = tvb_get_guint8(tvb, offset + 3);
- strval = val_to_str_const(val, iapp_dom_vals, "Unknown");
- proto_item_append_text(ti, "%s", strval);
+ proto_tree_add_item(tree, hf_iapp_pdu_regdomain, tvb, offset, 1, ENC_BIG_ENDIAN);
break;
case IAPP_PDU_CHANNEL:
- val = tvb_get_guint8(tvb, offset + 3);
if (is_fhss)
- proto_item_append_text(ti, "Pattern set %d, sequence %d",
- ((val >> 6) & 3) + 1, (val & 31) + 1);
+ {
+ val = tvb_get_guint8(tvb, offset);
+ proto_tree_add_uint_format(tree, hf_iapp_pdu_uint, tvb, offset, 1, val,
+ "Pattern set %d, sequence %d", ((val >> 6) & 3) + 1, (val & 31) + 1);
+ }
else
- proto_item_append_text(ti, "%d", val);
+ proto_tree_add_item(tree, hf_iapp_pdu_uint, tvb, offset, 1, ENC_NA);
break;
case IAPP_PDU_OUIIDENT:
- for (val = z = 0; z < 3; z++)
- val = (val << 8) | tvb_get_guint8(tvb, offset + 3 + z);
- strval = val_to_str_const(val, oui_vals, "Unknown");
- proto_item_append_text(ti, "%s", strval);
+ proto_tree_add_item(tree, hf_iapp_pdu_oui_ident, tvb, offset, 3, ENC_BIG_ENDIAN);
break;
}
return is_fhss;
@@ -364,36 +320,34 @@ append_pduval_str(proto_item *ti, int type, int len, tvbuff_t *tvb, int offset,
/* code to dissect a list of PDUs */
static void
-dissect_pdus(tvbuff_t *tvb, int offset, proto_tree *pdutree, int pdulen)
+dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pdutree, proto_item *pduitem, int pdulen)
{
- e_pduhdr pduhdr;
- int len;
+ guint8 pdu_type;
+ guint16 len;
proto_item *ti;
gboolean is_fhss;
+ proto_tree *subtree;
if (!pdulen)
{
- proto_tree_add_text(pdutree, tvb, offset, 0, "No PDUs found");
+ expert_add_info(pinfo, pduitem, &ei_iapp_no_pdus);
return;
}
is_fhss = FALSE;
while (pdulen > 0)
{
- tvb_memcpy(tvb, (guint8 *)&pduhdr, offset, sizeof(e_pduhdr));
- len = (((int)pduhdr.pdu_len_h) << 8) + pduhdr.pdu_len_l;
-
- ti = proto_tree_add_text(pdutree, tvb, offset, len + 3,
- "%s(%d)",
- val_to_str_const(pduhdr.pdu_type, iapp_pdu_type_vals, "Unknown PDU Type"),
- pduhdr.pdu_type);
- is_fhss = append_pduval_str(ti, pduhdr.pdu_type, len, tvb,
- offset, is_fhss);
+ pdu_type = tvb_get_guint8(tvb, offset);
+ len = tvb_get_ntohs(tvb, offset+1);
- if (pduhdr.pdu_type == IAPP_PDU_CAPABILITY)
- dissect_caps(ti, tvb, offset);
+ subtree = proto_tree_add_subtree_format(pdutree, tvb, offset, len + 3,
+ ett_iapp_subpdu, &ti, "%s (%d)",
+ val_to_str_const(pdu_type, iapp_pdu_type_vals, "Unknown PDU Type"),
+ pdu_type);
+ is_fhss = append_pduval_str(subtree, pdu_type, len, tvb,
+ offset+3, is_fhss);
- if (pduhdr.pdu_type == IAPP_PDU_AUTHINFO)
+ if (pdu_type == IAPP_PDU_AUTHINFO)
dissect_authinfo(ti, tvb, offset + 3, len);
pdulen -= (len + 3);
@@ -405,21 +359,19 @@ dissect_pdus(tvbuff_t *tvb, int offset, proto_tree *pdutree, int pdulen)
static void
dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_item *ti;
+ proto_item *ti, *pduitem;
proto_tree *iapp_tree, *pdutree;
- e_iapphdr ih;
- int ia_version;
- int ia_type;
+ guint8 ia_version;
+ guint8 ia_type;
const gchar *codestrval;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IAPP");
col_clear(pinfo->cinfo, COL_INFO);
- tvb_memcpy(tvb, (guint8 *)&ih, 0, sizeof(e_iapphdr));
+ ia_version = tvb_get_guint8(tvb, 0);
+ ia_type = tvb_get_guint8(tvb, 1);
- ia_version = (int)ih.ia_version;
- ia_type = (int)ih.ia_type;
codestrval = val_to_str_const(ia_type, iapp_vals, "Unknown Packet");
col_add_fstr(pinfo->cinfo, COL_INFO, "%s(%d) (version=%d)", codestrval, ia_type, ia_version);
@@ -430,19 +382,14 @@ dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* common header for all IAPP frames */
- proto_tree_add_uint(iapp_tree, hf_iapp_version, tvb, 0, 1,
- ih.ia_version);
- proto_tree_add_uint_format_value(iapp_tree, hf_iapp_type, tvb, 1, 1,
- ih.ia_type, "%s(%d)", codestrval, ia_type);
+ proto_tree_add_item(iapp_tree, hf_iapp_version, tvb, 0, 1, ENC_NA);
+ proto_tree_add_item(iapp_tree, hf_iapp_type, tvb, 1, 1, ENC_NA);
pdutree = proto_tree_add_subtree(iapp_tree, tvb, 2, -1,
- ett_iapp_pdu, NULL, "Protocol data units");
+ ett_iapp_pdu, &pduitem, "Protocol data units");
- if (pdutree)
- {
- dissect_pdus(tvb, 2, pdutree,
+ dissect_pdus(tvb, pinfo, 2, pdutree, pduitem,
tvb_length_remaining(tvb, 2));
- }
}
}
@@ -462,24 +409,72 @@ proto_register_iapp(void)
{ "Version", "iapp.version", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }
},
{ &hf_iapp_type,
- { "Type", "iapp.type", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }
+ { "Type", "iapp.type", FT_UINT8, BASE_DEC, VALS(iapp_vals), 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_cap_forwarding,
+ { "Forwarding", "iapp.cap.forwarding", FT_BOOLEAN, 8, TFS(&tfs_yes_no), IAPP_CAP_FORWARDING, NULL, HFILL }
+ },
+ { &hf_iapp_cap_wep,
+ { "WEP", "iapp.cap.wep", FT_BOOLEAN, 8, TFS(&tfs_yes_no), IAPP_CAP_WEP, NULL, HFILL }
+ },
+ { &hf_iapp_auth_status,
+ { "Status", "iapp.auth.status", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_auth_uint,
+ { "Value", "iapp.auth.uint", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_auth_string,
+ { "Value", "iapp.auth.string", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_auth_ipaddr,
+ { "IP Address", "iapp.auth.ipaddr", FT_IPv4, BASE_NONE, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_auth_trailer,
+ { "Trailer", "iapp.auth.trailer", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_pdu_ssid,
+ { "SSID", "iapp.pdu.ssid", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_pdu_bytes,
+ { "Value", "iapp.pdu.bytes", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_pdu_uint,
+ { "Value", "iapp.pdu.uint", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_pdu_phytype,
+ { "PHY Type", "iapp.pdu.phytype", FT_UINT8, BASE_DEC, VALS(iapp_phy_vals), 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_pdu_regdomain,
+ { "Reg domain", "iapp.pdu.regdomain", FT_UINT8, BASE_DEC, VALS(iapp_dom_vals), 0x00, NULL, HFILL }
+ },
+ { &hf_iapp_pdu_oui_ident,
+ { "OUI", "iapp.pdu.oui_ident", FT_UINT24, BASE_DEC, VALS(oui_vals), 0x00, NULL, HFILL }
},
};
static gint *ett[] = {
&ett_iapp,
&ett_iapp_pdu,
+ &ett_iapp_subpdu,
&ett_iapp_cap,
- &ett_iapp_auth
+ &ett_iapp_auth,
+ &ett_iapp_authinfo
+ };
+
+ static ei_register_info ei[] = {
+ { &ei_iapp_no_pdus, { "iapp.no_pdus", PI_PROTOCOL, PI_NOTE, "No PDUs found", EXPFILL }},
};
+ expert_module_t* expert_iapp;
+
/* Register the protocol name and description */
- proto_iapp = proto_register_protocol("Inter-Access-Point Protocol",
- "IAPP", "iapp");
+ proto_iapp = proto_register_protocol("Inter-Access-Point Protocol", "IAPP", "iapp");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_iapp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_iapp = expert_register_protocol(proto_iapp);
+ expert_register_field_array(expert_iapp, ei, array_length(ei));
}
diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c
index 843e5e2658..43050b7a0b 100644
--- a/epan/dissectors/packet-iax2.c
+++ b/epan/dissectors/packet-iax2.c
@@ -116,6 +116,8 @@ static int hf_iax2_trunk_call_scallno = -1;
static int hf_iax2_trunk_call_ts = -1;
static int hf_iax2_trunk_call_data = -1;
+static int hf_iax2_ie_id = -1;
+static int hf_iax2_length = -1;
static int hf_iax2_cap_g723_1 = -1;
static int hf_iax2_cap_gsm = -1;
static int hf_iax2_cap_ulaw = -1;
@@ -140,6 +142,8 @@ static int hf_iax2_cap_h263_plus = -1;
static int hf_iax2_cap_h264 = -1;
static int hf_iax2_cap_mpeg4 = -1;
+static int hf_iax2_fragment_unfinished = -1;
+static int hf_iax2_payload_data = -1;
static int hf_iax2_fragments = -1;
static int hf_iax2_fragment = -1;
static int hf_iax2_fragment_overlap = -1;
@@ -1323,11 +1327,8 @@ static guint32 dissect_ies(tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
ies_tree = proto_tree_add_subtree(iax_tree, tvb, offset, ies_len+2, ett_iax2_ie, &ti, " ");
- proto_tree_add_text(ies_tree, tvb, offset, 1, "IE id: %s (0x%02X)",
- val_to_str_ext_const(ies_type, &iax_ies_type_ext, "Unknown"),
- ies_type);
-
- proto_tree_add_text(ies_tree, tvb, offset + 1, 1, "Length: %u", ies_len);
+ proto_tree_add_uint(ies_tree, hf_iax2_ie_id, tvb, offset, 1, ies_type);
+ proto_tree_add_uint(ies_tree, hf_iax2_length, tvb, offset + 1, 1, ies_len);
/* hf_iax2_ies[] is an array, indexed by IE number, of header-fields, one
@@ -2362,8 +2363,7 @@ static void desegment_iax(tvbuff_t *tvb, packet_info *pinfo, proto_tree *iax2_tr
PROTO_ITEM_SET_GENERATED(iax_tree_item);
} else {
/* this fragment is never reassembled */
- proto_tree_add_text(tree, tvb, deseg_offset, -1,
- "IAX2 fragment, unfinished");
+ proto_tree_add_item(tree, hf_iax2_fragment_unfinished, tvb, deseg_offset, -1, ENC_NA);
}
if (pinfo->desegment_offset == 0) {
@@ -2413,9 +2413,7 @@ static void dissect_payload(tvbuff_t *tvb, guint32 offset,
}
nbytes = tvb_reported_length(sub_tvb);
- proto_tree_add_text(iax2_tree, sub_tvb, 0, -1,
- "IAX2 payload (%u byte%s)", nbytes,
- plurality(nbytes, "", "s"));
+ proto_tree_add_item(iax2_tree, hf_iax2_payload_data, sub_tvb, 0, -1, ENC_NA);
iax2_info->payload_len = nbytes;
iax2_info->payload_data = tvb_get_ptr(sub_tvb, 0, -1);
@@ -2978,6 +2976,16 @@ proto_register_iax2(void)
FT_STRING, BASE_NONE, NULL, 0x0,
"Raw data for unknown IEs", HFILL}},
+ {&hf_iax2_ie_id,
+ {"IE id", "iax2.ie_id",
+ FT_UINT8, BASE_DEC|BASE_EXT_STRING, &iax_ies_type_ext, 0x0,
+ NULL, HFILL}},
+
+ {&hf_iax2_length,
+ {"Length", "iax2.length",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
/* capabilities */
{&hf_iax2_cap_g723_1,
{"G.723.1 compression", "iax2.cap.g723_1",
@@ -3094,6 +3102,16 @@ proto_register_iax2(void)
FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), AST_FORMAT_MP4_VIDEO,
NULL, HFILL }},
+ {&hf_iax2_fragment_unfinished,
+ {"IAX2 fragment, unfinished", "iax2.fragment_unfinished",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_iax2_payload_data,
+ {"IAX2 payload", "iax2.payload_data",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
+
/* reassembly stuff */
{&hf_iax2_fragments,
{"IAX2 Fragments", "iax2.fragments",
diff --git a/epan/dissectors/packet-icep.c b/epan/dissectors/packet-icep.c
index b5fe07d7ae..1e195e0f4e 100644
--- a/epan/dissectors/packet-icep.c
+++ b/epan/dissectors/packet-icep.c
@@ -83,6 +83,7 @@ static int hf_icep_encoding_minor = -1;
static int hf_icep_message_type = -1;
static int hf_icep_compression_status = -1;
static int hf_icep_message_size = -1;
+static int hf_icep_magic_number = -1;
/* [Batch] Request Message Body */
static int hf_icep_request_id = -1;
@@ -106,6 +107,7 @@ static int hf_icep_reply_status = -1;
/* Initialize the subtree pointers */
static gint ett_icep = -1;
static gint ett_icep_msg = -1;
+static gint ett_icep_invocation_context = -1;
static expert_field ei_icep_params_size = EI_INIT;
static expert_field ei_icep_context_missing = EI_INIT;
@@ -119,6 +121,7 @@ static expert_field ei_icep_mode_missing = EI_INIT;
static expert_field ei_icep_params_encapsulated = EI_INIT;
static expert_field ei_icep_params_missing = EI_INIT;
static expert_field ei_icep_batch_requests = EI_INIT;
+static expert_field ei_icep_empty_batch = EI_INIT;
static expert_field ei_icep_facet_missing = EI_INIT;
static expert_field ei_icep_context_too_long = EI_INIT;
@@ -418,12 +421,13 @@ static void dissect_ice_context(packet_info *pinfo, proto_tree *tree, proto_item
/* value */
gint32 consumed_value = 0;
char *str_value = NULL;
- proto_item *ti = NULL;
+ proto_item *ti;
+ proto_tree *context_tree;
DBG1("looping through context dictionary, loop #%d\n", i);
- ti = proto_tree_add_text(tree, tvb, offset, -1, "Invocation Context");
+ context_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_icep_invocation_context, &ti, "Invocation Context");
- dissect_ice_string(pinfo, tree, ti, hf_icep_invocation_key, tvb, offset, &consumed_key, &str_key);
+ dissect_ice_string(pinfo, context_tree, ti, hf_icep_invocation_key, tvb, offset, &consumed_key, &str_key);
if ( consumed_key == -1 ) {
(*consumed) = -1;
@@ -433,7 +437,7 @@ static void dissect_ice_context(packet_info *pinfo, proto_tree *tree, proto_item
offset += consumed_key;
(*consumed) += consumed_key;
- dissect_ice_string(pinfo, tree, ti, hf_icep_invocation_value, tvb, offset, &consumed_value, &str_value);
+ dissect_ice_string(pinfo, context_tree, ti, hf_icep_invocation_value, tvb, offset, &consumed_value, &str_value);
if ( consumed_value == -1 ) {
(*consumed) = -1;
@@ -792,8 +796,7 @@ static void dissect_icep_batch_request(tvbuff_t *tvb, guint32 offset,
if ( num_reqs == 0 ) {
- proto_tree_add_text(icep_tree, tvb, offset, -1,
- "empty batch requests sequence");
+ proto_tree_add_expert(icep_tree, pinfo, &ei_icep_empty_batch, tvb, offset, -1);
col_append_str(pinfo->cinfo, COL_INFO, " (empty batch requests sequence)");
return;
@@ -959,8 +962,7 @@ static int dissect_icep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* message header */
- proto_tree_add_text(icep_tree, tvb, offset, 4,
- "Magic Number: 'I','c','e','P'");
+ proto_tree_add_item(icep_tree, hf_icep_magic_number, tvb, offset, 4, ENC_ASCII|ENC_NA);
offset += 4;
proto_tree_add_item(icep_tree, hf_icep_protocol_major,
@@ -1104,6 +1106,14 @@ void proto_register_icep(void)
}
},
+ { &hf_icep_magic_number,
+ {
+ "Magic Number", "icep.magic_number",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+
{ &hf_icep_compression_status,
{
"Compression Status", "icep.compression_status",
@@ -1255,6 +1265,7 @@ void proto_register_icep(void)
static gint *ett[] = {
&ett_icep,
&ett_icep_msg,
+ &ett_icep_invocation_context,
};
static ei_register_info ei[] = {
@@ -1270,6 +1281,7 @@ void proto_register_icep(void)
{ &ei_icep_length, { "icep.length_invalid", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }},
{ &ei_icep_mode_missing, { "icep.mode.missing", PI_MALFORMED, PI_ERROR, "mode field missing", EXPFILL }},
{ &ei_icep_batch_requests, { "icep.batch_requests.invalid", PI_PROTOCOL, PI_WARN, "too many batch requests", EXPFILL }},
+ { &ei_icep_empty_batch, { "icep.batch_requests.empty", PI_PROTOCOL, PI_WARN, "empty batch requests sequence", EXPFILL }},
{ &ei_icep_reply_data, { "icep.params.reply_data.missing", PI_MALFORMED, PI_ERROR, "Reply Data missing", EXPFILL }},
{ &ei_icep_message_type, { "icep.message_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown Message Type", EXPFILL }},
};
diff --git a/epan/dissectors/packet-idrp.c b/epan/dissectors/packet-idrp.c
index 755e2d333c..c9b80e57d0 100644
--- a/epan/dissectors/packet-idrp.c
+++ b/epan/dissectors/packet-idrp.c
@@ -32,6 +32,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/nlpid.h>
#include <math.h>
@@ -122,6 +123,8 @@ static int hf_idrp_rib_refresh_rib_attr_locally_defined_qos_metric = -1;
static int hf_idrp_rib_refresh_rib_attr_security_reg_id = -1;
static int hf_idrp_rib_refresh_rib_attr_security_info = -1;
+static expert_field ei_idrp_no_path_attributes = EI_INIT;
+
/* flags */
#define IDRP_UPDATE_PATH_FLAG_OPTIONAL 0x80
#define IDRP_UPDATE_PATH_FLAG_OPTIONAL_TRANSITIVE 0xc0
@@ -1003,9 +1006,10 @@ static int dissect_BISPDU_ERROR(tvbuff_t * tvb, int offset, proto_tree * tree)
return offset;
}
-static int dissect_BISPDU_RIB_REFRESH(tvbuff_t * tvb, int offset, proto_tree * tree)
+static int dissect_BISPDU_RIB_REFRESH(tvbuff_t * tvb, packet_info *pinfo, int offset, proto_tree * tree)
{
proto_tree *sub_tree;
+ proto_item *sub_item;
guint8 number_of_non_empty_rib_attributes;
guint8 number_of_distinguishing_attributes;
guint8 rib_attribute_type;
@@ -1019,14 +1023,14 @@ static int dissect_BISPDU_RIB_REFRESH(tvbuff_t * tvb, int offset, proto_tree * t
offset += 1;
/* Path Attributes subtree */
- sub_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_idrp_sub, NULL, "Path Attributes");
+ sub_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_idrp_sub, &sub_item, "Path Attributes");
/* Number of Non-empty RIB-Atts */
number_of_non_empty_rib_attributes = tvb_get_guint8(tvb, offset);
offset += 1;
if (!number_of_non_empty_rib_attributes)
- proto_tree_add_text(sub_tree, tvb, offset, 0, "none");
+ expert_add_info(pinfo, sub_item, &ei_idrp_no_path_attributes);
/* process Nth RIB-Atts */
for (i = number_of_non_empty_rib_attributes; i > 0; i--) {
@@ -1213,7 +1217,7 @@ dissect_idrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
offset += 30;
break;
case IDRP_TYPE_RIB_REFRESH:
- offset = dissect_BISPDU_RIB_REFRESH(tvb, offset, idrp_tree);
+ offset = dissect_BISPDU_RIB_REFRESH(tvb, pinfo, offset, idrp_tree);
break;
default:
break;
@@ -1582,9 +1586,17 @@ void proto_register_idrp(void)
&ett_idrp_sub
};
+ static ei_register_info ei[] = {
+ { &ei_idrp_no_path_attributes, { "idrp.no_path_attributes", PI_PROTOCOL, PI_NOTE, "No path attributes", EXPFILL }},
+ };
+
+ expert_module_t* expert_idrp;
+
proto_idrp = proto_register_protocol(IDRP_PROTO, "IDRP", "idrp");
proto_register_field_array(proto_idrp, hf_idrp, array_length(hf_idrp));
proto_register_subtree_array(ett, array_length(ett));
+ expert_idrp = expert_register_protocol(proto_idrp);
+ expert_register_field_array(expert_idrp, ei, array_length(ei));
new_register_dissector("idrp", dissect_idrp, proto_idrp);
}
diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c
index 0791547f5b..66366ac784 100644
--- a/epan/dissectors/packet-iec104.c
+++ b/epan/dissectors/packet-iec104.c
@@ -594,6 +594,7 @@ static int hf_bcr_sq = -1;
static int hf_bcr_cy = -1;
static int hf_bcr_ca = -1;
static int hf_bcr_iv = -1;
+static int hf_start = -1;
static int hf_asdu_bitstring = -1;
static int hf_asdu_float = -1;
@@ -1402,7 +1403,7 @@ static int dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_item_set_len(it104, Off + APCI_LEN);
- proto_tree_add_text(it104tree, tvb, Off, 1, "START");
+ proto_tree_add_uint_format(it104tree, hf_start, tvb, Off, 1, Start, "START");
ti = proto_tree_add_item(it104tree, hf_apdulen, tvb, Off + 1, 1, ENC_LITTLE_ENDIAN);
len = tvb_get_guint8(tvb, Off + 1);
@@ -1787,6 +1788,10 @@ proto_register_iec104asdu(void)
{ "IV", "104asdu.bcr.iv", FT_BOOLEAN, 8, TFS(&tfs_invalid_valid), 0x80,
"Counter Validity", HFILL }},
+ { &hf_start,
+ { "START", "104asdu.start", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_asdu_bitstring,
{ "Value", "104asdu.bitstring", FT_UINT32, BASE_HEX, NULL, 0x0,
"BSI value", HFILL }},
diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c
index 9f135267d9..46f6c977f1 100644
--- a/epan/dissectors/packet-ieee1722.c
+++ b/epan/dissectors/packet-ieee1722.c
@@ -32,6 +32,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/etypes.h>
void proto_register_1722(void);
@@ -117,6 +118,8 @@ static int ett_1722 = -1;
static int ett_1722_audio = -1;
static int ett_1722_sample = -1;
+static expert_field ei_1722_incorrect_dbs = EI_INIT;
+
static dissector_table_t avb_dissector_table;
static void
@@ -236,13 +239,12 @@ dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* If the DBS is ever 0 for whatever reason, then just add the rest of packet as unknown */
if(dbs == 0)
- proto_tree_add_text(ieee1722_tree, tvb, IEEE_1722_DATA_OFFSET, datalen, "Incorrect DBS");
+ expert_add_info(pinfo, ti, &ei_1722_incorrect_dbs);
else {
/* Loop through all samples and add them to the audio tree. */
for (j = 0; j < (datalen / (dbs*4)); j++) {
- ti = proto_tree_add_text(audio_tree, tvb, offset, 1, "Sample %d", j+1);
- sample_tree = proto_item_add_subtree(ti, ett_1722_sample);
+ sample_tree = proto_tree_add_subtree_format(audio_tree, tvb, offset, 1, ett_1722_sample, NULL, "Sample %d", j+1);
for (i = 0; i < dbs; i++) {
proto_tree_add_item(sample_tree, hf_1722_label, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
@@ -383,12 +385,20 @@ void proto_register_1722(void)
&ett_1722_sample
};
+ static ei_register_info ei[] = {
+ { &ei_1722_incorrect_dbs, { "ieee1722.incorrect_dbs", PI_PROTOCOL, PI_WARN, "Incorrect DBS", EXPFILL }},
+ };
+
+ expert_module_t* expert_1722;
+
/* Register the protocol name and description */
proto_1722 = proto_register_protocol("IEEE 1722 Protocol", "IEEE1722", "ieee1722");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_1722, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_1722 = expert_register_protocol(proto_1722);
+ expert_register_field_array(expert_1722, ei, array_length(ei));
/* Sub-dissector for 1772.1 */
avb_dissector_table = register_dissector_table("ieee1722.subtype",
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index d8fe813400..6051c84e97 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -204,6 +204,7 @@ static int proto_ieee802154_nonask_phy = -1;
static int hf_ieee802154_nonask_phy_preamble = -1;
static int hf_ieee802154_nonask_phy_sfd = -1;
static int hf_ieee802154_nonask_phy_length = -1;
+static int hf_ieee802154_nonask_phr = -1;
static int proto_ieee802154 = -1;
static int hf_ieee802154_frame_length = -1;
@@ -258,10 +259,12 @@ static int hf_ieee802154_assoc_permit = -1;
static int hf_ieee802154_gts_count = -1;
static int hf_ieee802154_gts_permit = -1;
static int hf_ieee802154_gts_direction = -1;
+static int hf_ieee802154_gts_address = -1;
static int hf_ieee802154_pending16 = -1;
static int hf_ieee802154_pending64 = -1;
/* Registered fields for Auxiliary Security Header */
+static int hf_ieee802154_security_control_field = -1;
static int hf_ieee802154_security_level = -1;
static int hf_ieee802154_key_id_mode = -1;
static int hf_ieee802154_aux_sec_reserved = -1;
@@ -489,19 +492,19 @@ dissect_ieee802154_nonask_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
phr=tvb_get_guint8(tvb,offset+4+1);
if(tree) {
- proto_tree *phr_tree;
- proto_item *pi;
guint loffset=offset;
+ static const int * phr_fields[] = {
+ &hf_ieee802154_nonask_phy_length,
+ NULL
+ };
proto_tree_add_item(ieee802154_tree, hf_ieee802154_nonask_phy_preamble, tvb, loffset, 4, ENC_LITTLE_ENDIAN);
loffset+=4;
proto_tree_add_item(ieee802154_tree, hf_ieee802154_nonask_phy_sfd, tvb, loffset, 1, ENC_LITTLE_ENDIAN);
loffset+=1;
- pi = proto_tree_add_text(ieee802154_tree, tvb, loffset, 1, "PHR: 0x%02x", phr);
- phr_tree = proto_item_add_subtree(pi, ett_ieee802154_nonask_phy_phr);
-
- proto_tree_add_uint(phr_tree, hf_ieee802154_nonask_phy_length, tvb, loffset, 1, phr);
+ proto_tree_add_bitmask(ieee802154_tree, tvb, loffset, hf_ieee802154_nonask_phr, ett_ieee802154_nonask_phy_phr,
+ phr_fields, ENC_NA);
}
offset+=4+2*1;
@@ -830,7 +833,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
ieee_hints->map_rec->start_fnum);
}
else {
- ti = proto_tree_add_text(ieee802154_tree, tvb, 0, 0, "Origin: Pre-configured");
+ ti = proto_tree_add_uint_format_value(ieee802154_tree, hf_ieee802154_src64_origin, tvb, 0, 0,
+ ieee_hints->map_rec->start_fnum, "Pre-configured");
}
PROTO_ITEM_SET_GENERATED(ti);
}
@@ -900,6 +904,12 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
proto_tree *header_tree, *field_tree;
guint8 security_control;
guint aux_length = 5; /* Minimum length of the auxiliary header. */
+ static const int * security_fields[] = {
+ &hf_ieee802154_security_level,
+ &hf_ieee802154_key_id_mode,
+ &hf_ieee802154_aux_sec_reserved,
+ NULL
+ };
/* Parse the security control field. */
security_control = tvb_get_guint8(tvb, offset);
@@ -914,11 +924,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
ett_ieee802154_auxiliary_security, NULL, "Auxiliary Security Header");
/* Security Control Field */
- ti = proto_tree_add_text(header_tree, tvb, offset, 1, "Security Control Field (0x%02x)", security_control);
- field_tree = proto_item_add_subtree(ti, ett_ieee802154_aux_sec_control);
- proto_tree_add_item(field_tree, hf_ieee802154_security_level, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_ieee802154_key_id_mode, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(field_tree, hf_ieee802154_aux_sec_reserved, tvb, offset, 1, ENC_NA);
+ proto_tree_add_bitmask(header_tree, tvb, offset, hf_ieee802154_security_control_field, ett_ieee802154_aux_sec_control, security_fields, ENC_NA);
offset++;
/* Frame Counter Field */
@@ -1297,9 +1303,9 @@ dissect_ieee802154_gtsinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
if (tree) {
/* Add address, slot, and time length fields. */
- ti = proto_tree_add_text(subtree, tvb, (*offset), 3, "{Address: 0x%04x", gts_addr);
+ ti = proto_tree_add_uint(subtree, hf_ieee802154_gts_address, tvb, (*offset), 3, gts_addr);
proto_item_append_text(ti, ", Slot: %i", gts_slot);
- proto_item_append_text(ti, ", Length: %i}", gts_length);
+ proto_item_append_text(ti, ", Length: %i", gts_length);
}
(*offset) += 3;
} /* for */
@@ -2430,6 +2436,10 @@ void proto_register_ieee802154(void)
{ &hf_ieee802154_nonask_phy_length,
{ "Frame Length", "wpan-nonask-phy.frame_length", FT_UINT8, BASE_HEX, NULL,
IEEE802154_PHY_LENGTH_MASK, NULL, HFILL }},
+
+ { &hf_ieee802154_nonask_phr,
+ { "PHR", "wpan-nonask-phy.phr", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
};
static hf_register_info hf[] = {
@@ -2635,6 +2645,10 @@ void proto_register_ieee802154(void)
{ "Direction", "wpan.gts.direction", FT_BOOLEAN, BASE_NONE, TFS(&ieee802154_gts_direction_tfs), 0x0,
"A flag defining the direction of the GTS Slot.", HFILL }},
+ { &hf_ieee802154_gts_address,
+ { "Address", "wpan.gts.address", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
{ &hf_ieee802154_pending16,
{ "Address", "wpan.pending16", FT_UINT16, BASE_HEX, NULL, 0x0,
"Device with pending data to receive.", HFILL }},
@@ -2649,6 +2663,10 @@ void proto_register_ieee802154(void)
{ "Security Level", "wpan.aux_sec.sec_level", FT_UINT8, BASE_HEX, VALS(ieee802154_sec_level_names),
IEEE802154_AUX_SEC_LEVEL_MASK, "The Security Level of the frame", HFILL }},
+ { &hf_ieee802154_security_control_field,
+ { "Security Control Field", "wpan.aux_sec.security_control_field", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_ieee802154_key_id_mode,
{ "Key Identifier Mode", "wpan.aux_sec.key_id_mode", FT_UINT8, BASE_HEX, VALS(ieee802154_key_id_mode_names),
IEEE802154_AUX_KEY_ID_MODE_MASK,
diff --git a/epan/dissectors/packet-igmp.c b/epan/dissectors/packet-igmp.c
index fbaff47c3e..2f701a3347 100644
--- a/epan/dissectors/packet-igmp.c
+++ b/epan/dissectors/packet-igmp.c
@@ -149,6 +149,7 @@ static int hf_record_type = -1;
static int hf_aux_data_len = -1;
static int hf_maddr = -1;
static int hf_aux_data = -1;
+static int hf_data = -1;
static int hf_mtrace_max_hops = -1;
static int hf_mtrace_saddr = -1;
static int hf_mtrace_raddr = -1;
@@ -383,7 +384,7 @@ dissect_igmp_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int ty
/* Just call the rest of it "data" */
len = tvb_length_remaining(tvb, offset);
- proto_tree_add_text(tree, tvb, offset, len, "Data");
+ proto_tree_add_item(tree, hf_data, tvb, offset, -1, ENC_NA);
offset += len;
return offset;
@@ -1086,6 +1087,10 @@ proto_register_igmp(void)
{ "Aux Data", "igmp.aux_data", FT_BYTES, BASE_NONE,
NULL, 0, "IGMP V3 Auxiliary Data", HFILL }},
+ { &hf_data,
+ { "Data", "igmp.data", FT_BYTES, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+
{ &hf_max_resp_exp,
{ "Exponent", "igmp.max_resp.exp", FT_UINT8, BASE_HEX,
NULL, IGMP_MAX_RESP_EXP, "Maximum Response Time, Exponent", HFILL }},
diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c
index eaf29eeae7..e4a2d6fd4b 100644
--- a/epan/dissectors/packet-imf.c
+++ b/epan/dissectors/packet-imf.c
@@ -835,9 +835,7 @@ dissect_imf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Put this line.
*/
- proto_tree_add_text(text_tree, tvb, start_offset, end_offset - start_offset,
- "%s",
- tvb_format_text_wsp(tvb, start_offset, end_offset - start_offset));
+ proto_tree_add_format_wsp_text(text_tree, tvb, start_offset, end_offset - start_offset);
col_append_sep_str(pinfo->cinfo, COL_INFO, ", ",
tvb_format_text_wsp(tvb, start_offset, end_offset - start_offset));
diff --git a/epan/dissectors/packet-ipmi-picmg.c b/epan/dissectors/packet-ipmi-picmg.c
index 9e53675091..239bcb47d4 100644
--- a/epan/dissectors/packet-ipmi-picmg.c
+++ b/epan/dissectors/packet-ipmi-picmg.c
@@ -120,6 +120,14 @@ static gint hf_ipmi_picmg_01_rs_fruid = -1;
static gint hf_ipmi_picmg_01_rs_site_num = -1;
static gint hf_ipmi_picmg_01_rs_site_type = -1;
+static gint hf_ipmi_picmg_02_shelf_address = -1;
+static gint hf_ipmi_picmg_02_shelf_type = -1;
+static gint hf_ipmi_picmg_02_shelf_length = -1;
+
+static gint hf_ipmi_picmg_03_shelf_address = -1;
+static gint hf_ipmi_picmg_03_shelf_type = -1;
+static gint hf_ipmi_picmg_03_shelf_length = -1;
+
static gint hf_ipmi_picmg_04_fruid = -1;
static gint hf_ipmi_picmg_04_cmd = -1;
@@ -152,7 +160,11 @@ static gint hf_ipmi_picmg_08_state_local = -1;
static gint hf_ipmi_picmg_08_lamptest_duration = -1;
static gint hf_ipmi_picmg_09_ipmba = -1;
+static gint hf_ipmi_picmg_09_ipmba_link = -1;
+static gint hf_ipmi_picmg_09_ipmba_state = -1;
static gint hf_ipmi_picmg_09_ipmbb = -1;
+static gint hf_ipmi_picmg_09_ipmbb_link = -1;
+static gint hf_ipmi_picmg_09_ipmbb_state = -1;
static gint hf_ipmi_picmg_0a_fruid = -1;
static gint hf_ipmi_picmg_0a_msk_d_locked = -1;
@@ -733,7 +745,7 @@ rs01(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
static void
rs02(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
- ipmi_add_typelen(tree, "Shelf Address", tvb, 0, TRUE);
+ ipmi_add_typelen(tree, hf_ipmi_picmg_02_shelf_address, hf_ipmi_picmg_02_shelf_type, hf_ipmi_picmg_02_shelf_length, tvb, 0, TRUE);
}
/* Set Shelf Address Info
@@ -741,7 +753,7 @@ rs02(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
static void
rq03(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
- ipmi_add_typelen(tree, "Shelf Address", tvb, 0, TRUE);
+ ipmi_add_typelen(tree, hf_ipmi_picmg_03_shelf_address, hf_ipmi_picmg_03_shelf_type, hf_ipmi_picmg_03_shelf_length, tvb, 0, TRUE);
}
/* FRU Control.
@@ -866,8 +878,10 @@ rs08(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
/* Set IPMB State
*/
+static const true_false_string tfs_local_control_override = { "Local Control State", "Override State (Isolate)" };
+
static void
-parse_ipmb_state(proto_tree *tree, tvbuff_t *tvb, guint offs, int hf, int ett)
+parse_ipmb_state(proto_tree *tree, tvbuff_t *tvb, guint offs, int hf, int hf_link, int hf_state, int ett)
{
char buf[32];
const char *desc;
@@ -892,18 +906,17 @@ parse_ipmb_state(proto_tree *tree, tvbuff_t *tvb, guint offs, int hf, int ett)
ti = proto_tree_add_uint_format_value(tree, hf, tvb, 0, 1,
v, "%s, %s", desc, (v & 1) ? "Local Control" : "Override");
s_tree = proto_item_add_subtree(ti, ett);
- proto_tree_add_text(s_tree, tvb, 0, 1, "%sLink: %s (0x%02x)",
- ipmi_dcd8(v, 0xfe), desc, num);
- proto_tree_add_text(s_tree, tvb, 0, 1, "%sState: %s",
- ipmi_dcd8(v, 0x01), (v & 1) ? "Local Control State" : "Override State (Isolate)");
+ proto_tree_add_uint_format_value(s_tree, hf_link, tvb, 0, 1, v, "%s (0x%02x)",
+ desc, num);
+ proto_tree_add_item(s_tree, hf_state, tvb, 0, 1, ENC_NA);
}
}
static void
rq09(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
- parse_ipmb_state(tree, tvb, 0, hf_ipmi_picmg_09_ipmba, ett_ipmi_picmg_09_ipmba);
- parse_ipmb_state(tree, tvb, 1, hf_ipmi_picmg_09_ipmbb, ett_ipmi_picmg_09_ipmbb);
+ parse_ipmb_state(tree, tvb, 0, hf_ipmi_picmg_09_ipmba, hf_ipmi_picmg_09_ipmba_link, hf_ipmi_picmg_09_ipmba_state, ett_ipmi_picmg_09_ipmba);
+ parse_ipmb_state(tree, tvb, 1, hf_ipmi_picmg_09_ipmbb, hf_ipmi_picmg_09_ipmbb_link, hf_ipmi_picmg_09_ipmbb_state, ett_ipmi_picmg_09_ipmbb);
}
/* Set FRU Activation Policy
@@ -2016,7 +2029,7 @@ rs2f(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
desc = "Reserved";
}
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Property selector: %s (0x%02x)", desc, pno);
+ ti = proto_tree_add_uint_format_value(tree, hf_ipmi_picmg_2f_comp_prop, tvb, 0, 0, pno, "%s (0x%02x)", desc, pno);
PROTO_ITEM_SET_GENERATED(ti);
if (pno < array_length(compprops)) {
compprops[pno].intrp(tvb, tree);
@@ -2814,6 +2827,26 @@ proto_register_ipmi_picmg(void)
{ "Site Type",
"ipmi.picmg01.rs_site_type", FT_UINT8, BASE_HEX, VALS(site_type_vals), 0, NULL, HFILL }},
+ { &hf_ipmi_picmg_02_shelf_address,
+ { "Shelf Address",
+ "ipmi.picmg02.shelf_address", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ { &hf_ipmi_picmg_02_shelf_type,
+ { "Type",
+ "ipmi.picmg02.shelf_type", FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }},
+ { &hf_ipmi_picmg_02_shelf_length,
+ { "Length",
+ "ipmi.picmg02.shelf_length", FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }},
+
+ { &hf_ipmi_picmg_03_shelf_address,
+ { "Shelf Address",
+ "ipmi.picmg03.shelf_address", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ { &hf_ipmi_picmg_03_shelf_type,
+ { "Type",
+ "ipmi.picmg03.shelf_type", FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }},
+ { &hf_ipmi_picmg_03_shelf_length,
+ { "Length",
+ "ipmi.picmg03.shelf_length", FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }},
+
{ &hf_ipmi_picmg_04_fruid,
{ "FRU ID",
"ipmi.picmg04.fruid", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
@@ -2900,9 +2933,21 @@ proto_register_ipmi_picmg(void)
{ &hf_ipmi_picmg_09_ipmba,
{ "IPMB-A State",
"ipmi.picmg09.ipmba", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
+ { &hf_ipmi_picmg_09_ipmba_link,
+ { "Link",
+ "ipmi.picmg09.ipmba_link", FT_UINT8, BASE_HEX, NULL, 0xFE, NULL, HFILL }},
+ { &hf_ipmi_picmg_09_ipmba_state,
+ { "State",
+ "ipmi.picmg09.ipmba_state", FT_BOOLEAN, 8, TFS(&tfs_local_control_override), 0x01, NULL, HFILL }},
{ &hf_ipmi_picmg_09_ipmbb,
{ "IPMB-B State",
"ipmi.picmg09.ipmbb", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
+ { &hf_ipmi_picmg_09_ipmbb_link,
+ { "Link",
+ "ipmi.picmg09.ipmbb_link", FT_UINT8, BASE_HEX, NULL, 0xFE, NULL, HFILL }},
+ { &hf_ipmi_picmg_09_ipmbb_state,
+ { "State",
+ "ipmi.picmg09.ipmbb_state", FT_BOOLEAN, 8, TFS(&tfs_local_control_override), 0x01, NULL, HFILL }},
{ &hf_ipmi_picmg_0a_fruid,
{ "FRU ID",
diff --git a/epan/dissectors/packet-ipmi-se.c b/epan/dissectors/packet-ipmi-se.c
index bbe4ee9e50..06c79aa6ed 100644
--- a/epan/dissectors/packet-ipmi-se.c
+++ b/epan/dissectors/packet-ipmi-se.c
@@ -97,6 +97,9 @@ static gint ett_ipmi_se_2d_byte2 = -1;
static gint ett_ipmi_se_2d_b1 = -1;
static gint ett_ipmi_se_2d_b2 = -1;
+static expert_field ei_ipmi_se_13_request_param_rev = EI_INIT;
+static expert_field ei_ipmi_se_13_request_param_data = EI_INIT;
+
static gint hf_ipmi_se_evt_rev = -1;
static gint hf_ipmi_se_evt_sensor_type = -1;
static gint hf_ipmi_se_evt_sensor_num = -1;
@@ -2290,7 +2293,7 @@ rq13(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
s_tree = proto_item_add_subtree(ti, ett_ipmi_se_13_byte1);
proto_tree_add_item(s_tree, hf_ipmi_se_13_getrev, tvb, 0, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_uint_format_value(s_tree, hf_ipmi_se_13_param, tvb, 0, 1,
- pno, "Parameter selector: %s (0x%02x)", desc, pno);
+ pno, "%s (0x%02x)", desc, pno);
proto_tree_add_item(tree, hf_ipmi_se_13_set, tvb, 1, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(tree, hf_ipmi_se_13_block, tvb, 2, 1, ENC_LITTLE_ENDIAN);
@@ -2305,7 +2308,7 @@ rs13(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 pno;
const char *desc;
- proto_tree_add_bitmask_text(tree, tvb, 0, 1, "Parameter revision", NULL,
+ ti = proto_tree_add_bitmask_text(tree, tvb, 0, 1, "Parameter revision", NULL,
ett_ipmi_se_13_rev, byte1, ENC_LITTLE_ENDIAN, 0);
if (!ipmi_get_data(pinfo, 0, &pno)) {
@@ -2317,11 +2320,9 @@ rs13(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if ((pno & 0x80) && tvb_captured_length(tvb) > 1) {
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Requested parameter revision; parameter data returned");
- PROTO_ITEM_SET_GENERATED(ti);
+ expert_add_info(pinfo, ti, &ei_ipmi_se_13_request_param_rev);
} else if (!(pno & 0x80) && tvb_captured_length(tvb) == 1) {
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Requested parameter data; only parameter version returned");
- PROTO_ITEM_SET_GENERATED(ti);
+ expert_add_info(pinfo, ti, &ei_ipmi_se_13_request_param_data);
}
pno &= 0x7f;
@@ -3651,8 +3652,17 @@ proto_register_ipmi_se(void)
&ett_ipmi_se_2d_b2,
};
+ static ei_register_info ei[] = {
+ { &ei_ipmi_se_13_request_param_rev, { "ipmi.se13.request_param_rev", PI_PROTOCOL, PI_NOTE, "Requested parameter revision; parameter data returned", EXPFILL }},
+ { &ei_ipmi_se_13_request_param_data, { "ipmi.se13.mrequest_param_data", PI_PROTOCOL, PI_NOTE, "Requested parameter data; only parameter version returned", EXPFILL }},
+ };
+
+ expert_module_t* expert_ipmi_se;
+
proto_register_field_array(proto_ipmi, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_ipmi_se = expert_register_protocol(proto_ipmi);
+ expert_register_field_array(expert_ipmi_se, ei, array_length(ei));
ipmi_register_netfn_cmdtab(IPMI_SE_REQ, IPMI_OEM_NONE, NULL, 0, NULL,
cmd_se, array_length(cmd_se));
diff --git a/epan/dissectors/packet-ipmi-transport.c b/epan/dissectors/packet-ipmi-transport.c
index 9249a6cca6..b7967ea431 100644
--- a/epan/dissectors/packet-ipmi-transport.c
+++ b/epan/dissectors/packet-ipmi-transport.c
@@ -131,6 +131,7 @@ static gint ett_ipmi_trn_1a_byte1 = -1;
static gint ett_ipmi_trn_1a_byte2 = -1;
static gint ett_ipmi_trn_1b_byte1 = -1;
static gint ett_ipmi_trn_1b_byte2 = -1;
+static gint ett_ipmi_trn_parameter = -1;
static gint hf_ipmi_trn_lan00_sip = -1;
@@ -196,7 +197,8 @@ static gint hf_ipmi_trn_lan22_num_cs_entries = -1;
static gint hf_ipmi_trn_lan23_cs_entry = -1;
-static gint hf_ipmi_trn_lan24_priv = -1;
+static gint hf_ipmi_trn_lan24_priv1 = -1;
+static gint hf_ipmi_trn_lan24_priv2 = -1;
static gint hf_ipmi_trn_lan25_dst_selector = -1;
static gint hf_ipmi_trn_lan25_addr_format = -1;
@@ -476,6 +478,11 @@ static gint hf_ipmi_trn_1a_chan = -1;
static gint hf_ipmi_trn_1b_user = -1;
static gint hf_ipmi_trn_1b_chan = -1;
+static expert_field ei_ipmi_trn_02_request_param_rev = EI_INIT;
+static expert_field ei_ipmi_trn_02_request_param_data = EI_INIT;
+static expert_field ei_ipmi_trn_11_request_param_rev = EI_INIT;
+static expert_field ei_ipmi_trn_11_request_param_data = EI_INIT;
+
static const value_string lan00_sip_vals[] = {
{ 0x00, "Set complete" },
{ 0x01, "Set in progress" },
@@ -926,12 +933,10 @@ lan_24(tvbuff_t *tvb, proto_tree *tree)
*ett[i], NULL, "Cipher Suite #%d: %s (0x%02x), Cipher Suite #%d: %s (0x%02x)",
i * 2 + 1, val_to_str_const(v1, lan24_priv_vals, "Reserved"), v1,
i * 2 + 2, val_to_str_const(v2, lan24_priv_vals, "Reserved"), v2);
- proto_tree_add_uint_format(s_tree, hf_ipmi_trn_lan24_priv, tvb, i + 1, 1,
- v2 << 4, "%sMaximum Privilege Level for Cipher Suite #%d: %s (0x%02x)",
- ipmi_dcd8(v, 0xf0), i * 2 + 2, val_to_str_const(v2, lan24_priv_vals, "Reserved"), v2);
- proto_tree_add_uint_format(s_tree, hf_ipmi_trn_lan24_priv, tvb, i + 1, 1,
- v1, "%sMaximum Privilege Level for Cipher Suite #%d: %s (0x%02x)",
- ipmi_dcd8(v, 0x0f), i * 2 + 1, val_to_str_const(v1, lan24_priv_vals, "Reserved"), v1);
+ proto_tree_add_uint_format_value(s_tree, hf_ipmi_trn_lan24_priv1, tvb, i + 1, 1,
+ v2 << 4, " #%d: %s (0x%02x)", i * 2 + 2, val_to_str_const(v2, lan24_priv_vals, "Reserved"), v2);
+ proto_tree_add_uint_format_value(s_tree, hf_ipmi_trn_lan24_priv2, tvb, i + 1, 1,
+ v1, " #%d: %s (0x%02x)", i * 2 + 1, val_to_str_const(v1, lan24_priv_vals, "Reserved"), v1);
}
}
@@ -1069,11 +1074,12 @@ rs02(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
static const int *byte1[] = { &hf_ipmi_trn_02_rev_present, &hf_ipmi_trn_02_rev_compat, NULL };
proto_item *ti;
+ proto_tree *subtree;
tvbuff_t *next;
const char *desc;
guint32 pno, req;
- proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
+ ti = proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
ett_ipmi_trn_02_rev, byte1, ENC_LITTLE_ENDIAN, 0);
if (!ipmi_get_data(pinfo, 0, &pno) || !ipmi_get_data(pinfo, 1, &req)) {
@@ -1085,11 +1091,9 @@ rs02(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
}
if ((req & 0x80) && tvb_captured_length(tvb) > 1) {
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Requested parameter revision; parameter data returned");
- PROTO_ITEM_SET_GENERATED(ti);
+ expert_add_info(pinfo, ti, &ei_ipmi_trn_02_request_param_rev);
} else if (!(req & 0x80) && tvb_captured_length(tvb) == 1) {
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Requested parameter data; only parameter version returned");
- PROTO_ITEM_SET_GENERATED(ti);
+ expert_add_info(pinfo, ti, &ei_ipmi_trn_02_request_param_data);
}
if (pno < array_length(lan_options)) {
@@ -1100,15 +1104,14 @@ rs02(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
desc = "Reserved";
}
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Parameter: %s", desc);
- PROTO_ITEM_SET_GENERATED(ti);
+ subtree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_ipmi_trn_parameter, NULL, "Parameter: %s", desc);
if (tvb_captured_length(tvb) > 1) {
if (pno < array_length(lan_options)) {
next = tvb_new_subset_remaining(tvb, 1);
- lan_options[pno].intrp(next, tree);
+ lan_options[pno].intrp(next, subtree);
} else {
- proto_tree_add_item(tree, hf_ipmi_trn_02_param_data, tvb, 1, -1, ENC_NA);
+ proto_tree_add_item(subtree, hf_ipmi_trn_02_param_data, tvb, 1, -1, ENC_NA);
}
}
}
@@ -1835,11 +1838,12 @@ rs11(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
static const int *byte1[] = { &hf_ipmi_trn_11_rev_present, &hf_ipmi_trn_11_rev_compat, NULL };
proto_item *ti;
+ proto_tree *subtree;
tvbuff_t *next;
const char *desc;
guint32 pno, req;
- proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
+ ti = proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
ett_ipmi_trn_11_rev, byte1, ENC_LITTLE_ENDIAN, 0);
if (!ipmi_get_data(pinfo, 0, &pno) || !ipmi_get_data(pinfo, 1, &req)) {
@@ -1859,22 +1863,19 @@ rs11(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
}
if ((req & 0x80) && tvb_captured_length(tvb) > 1) {
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Requested parameter revision; parameter data returned");
- PROTO_ITEM_SET_GENERATED(ti);
+ expert_add_info(pinfo, ti, &ei_ipmi_trn_11_request_param_rev);
} else if (!(req & 0x80) && tvb_captured_length(tvb) == 1) {
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Requested parameter data; only parameter version returned");
- PROTO_ITEM_SET_GENERATED(ti);
+ expert_add_info(pinfo, ti, &ei_ipmi_trn_11_request_param_data);
}
- ti = proto_tree_add_text(tree, tvb, 0, 0, "Parameter: %s", desc);
- PROTO_ITEM_SET_GENERATED(ti);
+ subtree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_ipmi_trn_parameter, NULL, "Parameter: %s", desc);
if (tvb_captured_length(tvb) > 1) {
if (pno < array_length(serial_options)) {
next = tvb_new_subset_remaining(tvb, 1);
- serial_options[pno].intrp(next, tree);
+ serial_options[pno].intrp(next, subtree);
} else {
- proto_tree_add_item(tree, hf_ipmi_trn_11_param_data, tvb, 1, -1, ENC_NA);
+ proto_tree_add_item(subtree, hf_ipmi_trn_11_param_data, tvb, 1, -1, ENC_NA);
}
}
}
@@ -2317,9 +2318,13 @@ proto_register_ipmi_transport(void)
{ "Cipher Suite ID",
"ipmi.lan23.cs_entry", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_ipmi_trn_lan24_priv,
- { "Maximum Privilege Level",
- "ipmi.lan24.priv", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
+ { &hf_ipmi_trn_lan24_priv1,
+ { "Maximum Privilege Level for Cipher Suite",
+ "ipmi.lan24.priv", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL }},
+
+ { &hf_ipmi_trn_lan24_priv2,
+ { "Maximum Privilege Level for Cipher Suite",
+ "ipmi.lan24.priv", FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL }},
{ &hf_ipmi_trn_lan25_dst_selector,
{ "Destination Selector",
@@ -3174,10 +3179,22 @@ proto_register_ipmi_transport(void)
&ett_ipmi_trn_1a_byte2,
&ett_ipmi_trn_1b_byte1,
&ett_ipmi_trn_1b_byte2,
+ &ett_ipmi_trn_parameter
+ };
+
+ static ei_register_info ei[] = {
+ { &ei_ipmi_trn_02_request_param_rev, { "ipmi.tr02.request_param_rev", PI_PROTOCOL, PI_NOTE, "Requested parameter revision; parameter data returned", EXPFILL }},
+ { &ei_ipmi_trn_02_request_param_data, { "ipmi.tr02.mrequest_param_data", PI_PROTOCOL, PI_NOTE, "Requested parameter data; only parameter version returned", EXPFILL }},
+ { &ei_ipmi_trn_11_request_param_rev, { "ipmi.tr11.request_param_rev", PI_PROTOCOL, PI_NOTE, "Requested parameter revision; parameter data returned", EXPFILL }},
+ { &ei_ipmi_trn_11_request_param_data, { "ipmi.tr11.mrequest_param_data", PI_PROTOCOL, PI_NOTE, "Requested parameter data; only parameter version returned", EXPFILL }},
};
+ expert_module_t* expert_ipmi_trn;
+
proto_register_field_array(proto_ipmi, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_ipmi_trn = expert_register_protocol(proto_ipmi);
+ expert_register_field_array(expert_ipmi_trn, ei, array_length(ei));
ipmi_register_netfn_cmdtab(IPMI_TRANSPORT_REQ, IPMI_OEM_NONE, NULL, 0, NULL,
cmd_transport, array_length(cmd_transport));
}
diff --git a/epan/dissectors/packet-ipmi-vita.c b/epan/dissectors/packet-ipmi-vita.c
index d0b5d0ba13..fa9c1316c3 100644
--- a/epan/dissectors/packet-ipmi-vita.c
+++ b/epan/dissectors/packet-ipmi-vita.c
@@ -57,6 +57,9 @@ static gint hf_vita_site_type = -1;
static gint hf_vita_site_num = -1;
static gint hf_vita_ipmbl_addr = -1;
+static gint hf_vita_chassis_identifier = -1;
+static gint hf_vita_chassis_identifier_type = -1;
+static gint hf_vita_chassis_identifier_length = -1;
static gint hf_vita_ipmc = -1;
static gint hf_vita_tier = -1;
static gint hf_vita_layer = -1;
@@ -481,6 +484,15 @@ static hf_register_info hf_ipmi_vita[] = {
{ &hf_vita_ipmbl_addr,
{ "Address on IPMI Channel 7", "ipmi.vita.ipmbl.addr",
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
+ { &hf_vita_chassis_identifier,
+ { "Chassis Identifier",
+ "ipmi.vita.chassis_identifier", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ { &hf_vita_chassis_identifier_type,
+ { "Type",
+ "ipmi.vita.chassis_identifier_type", FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }},
+ { &hf_vita_chassis_identifier_length,
+ { "Length",
+ "ipmi.vita.chassis_identifier_length", FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }},
{ &hf_vita_reserved,
{ "Reserved", "ipmi.vita.reserved",
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
@@ -840,7 +852,7 @@ cmd01_rs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
static void
cmd02_rs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
- ipmi_add_typelen(tree, "Chassis Identifier", tvb, 0, TRUE);
+ ipmi_add_typelen(tree, hf_vita_chassis_identifier, hf_vita_chassis_identifier_type, hf_vita_chassis_identifier_length, tvb, 0, TRUE);
}
/* FRU Control (request)
diff --git a/epan/dissectors/packet-ipmi.c b/epan/dissectors/packet-ipmi.c
index 4354488fb5..5534940c67 100644
--- a/epan/dissectors/packet-ipmi.c
+++ b/epan/dissectors/packet-ipmi.c
@@ -544,6 +544,7 @@ dissect_ipmi_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* add parent node */
if (!data->curr_level) {
ti = proto_tree_add_item(tree, hf_parent_item, tvb, 0, -1, ENC_NA);
+ cmd_tree = proto_item_add_subtree(ti, ett_tree);
} else {
char str[ITEM_LABEL_LENGTH];
@@ -553,15 +554,14 @@ dissect_ipmi_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
} else {
g_snprintf(str, ITEM_LABEL_LENGTH, "Req, %s", cmd->desc);
}
- if (proto_registrar_get_ftype(hf_parent_item) == FT_STRING)
+ if (proto_registrar_get_ftype(hf_parent_item) == FT_STRING) {
ti = proto_tree_add_string(tree, hf_parent_item, tvb, 0, -1, str);
+ cmd_tree = proto_item_add_subtree(ti, ett_tree);
+ }
else
- ti = proto_tree_add_text(tree, tvb, 0, -1, "%s", str);
+ cmd_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett_tree, NULL, str);
}
- /* add message sub-tree */
- cmd_tree = proto_item_add_subtree(ti, ett_tree);
-
if (data->curr_level < MAX_NEST_LEVEL) {
/* check if response */
if (ctx->hdr.netfn & 1) {
@@ -1007,7 +1007,7 @@ static struct ipmi_parse_typelen ptl_unicode = {
};
void
-ipmi_add_typelen(proto_tree *tree, const char *desc, tvbuff_t *tvb,
+ipmi_add_typelen(proto_tree *tree, int hf_string, int hf_type, int hf_length, tvbuff_t *tvb,
guint offs, gboolean is_fru)
{
static struct ipmi_parse_typelen *fru_eng[4] = {
@@ -1046,14 +1046,14 @@ ipmi_add_typelen(proto_tree *tree, const char *desc, tvbuff_t *tvb,
str[clen] = '\0';
s_tree = proto_tree_add_subtree_format(tree, tvb, offs, 1, ett_typelen, NULL,
- "%s Type/Length byte: %s, %d %s", desc, ptr->desc, len, unit);
- proto_tree_add_text(s_tree, tvb, offs, 1, "%sType: %s (0x%02x)",
- ipmi_dcd8(typelen, 0xc0), ptr->desc, type);
- proto_tree_add_text(s_tree, tvb, offs, 1, "%sLength: %d %s",
- ipmi_dcd8(typelen, msk), len, unit);
-
- proto_tree_add_text(tree, tvb, offs + 1, blen, "%s: [%s] '%s'",
- desc, ptr->desc, str);
+ "%s Type/Length byte: %s, %d %s", (proto_registrar_get_nth(hf_string))->name, ptr->desc, len, unit);
+ proto_tree_add_uint_format_value(s_tree, hf_type, tvb, offs, 1, type, "%s (0x%02x)",
+ ptr->desc, type);
+ proto_tree_add_uint_format_value(s_tree, hf_length, tvb, offs, 1, len, "%d %s",
+ len, unit);
+
+ proto_tree_add_string_format_value(tree, hf_string, tvb, offs + 1, blen, str,
+ "[%s] '%s'", ptr->desc, str);
}
/* ----------------------------------------------------------------
@@ -1215,15 +1215,6 @@ ipmi_notimpl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
proto_tree_add_expert(tree, pinfo, &ei_impi_parser_not_implemented, tvb, 0, -1);
}
-char *
-ipmi_dcd8(guint32 val, guint32 mask)
-{
- static char buf[64];
-
- decode_bitfield_value(buf, val, mask, 8);
- return buf;
-}
-
void
ipmi_fmt_10ms_1based(gchar *s, guint32 v)
{
diff --git a/epan/dissectors/packet-ipmi.h b/epan/dissectors/packet-ipmi.h
index a0f9233a05..bf0f886681 100644
--- a/epan/dissectors/packet-ipmi.h
+++ b/epan/dissectors/packet-ipmi.h
@@ -123,16 +123,13 @@ typedef struct ipmi_netfn_handler {
guint32 cmdtablen;
} ipmi_netfn_t;
-/* Handy wrapper around decode_bitfield_value() */
-char *ipmi_dcd8(guint32 val, guint32 mask);
-
/* Stub parser. Use this to substitute for not-yet-written subparsers;
NULL in command table means 'no custom data in this request/response' */
void ipmi_notimpl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
#define IPMI_TBD ipmi_notimpl, ipmi_notimpl
/* Add a Type/Length field to tree */
-void ipmi_add_typelen(proto_tree *tree, const char *desc, tvbuff_t *tvb,
+void ipmi_add_typelen(proto_tree *tree, int hf_string, int hf_type, int hf_length, tvbuff_t *tvb,
guint offs, gboolean is_fru);
/* Add Timestamp in IPMI format */
diff --git a/epan/dissectors/packet-ipsec-udp.c b/epan/dissectors/packet-ipsec-udp.c
index d2e8717638..78eb0275e2 100644
--- a/epan/dissectors/packet-ipsec-udp.c
+++ b/epan/dissectors/packet-ipsec-udp.c
@@ -31,6 +31,10 @@ void proto_register_udpencap(void);
void proto_reg_handoff_udpencap(void);
static int proto_udpencap = -1;
+
+static int hf_nat_keepalive = -1;
+static int hf_non_esp_marker = -1;
+
static gint ett_udpencap = -1;
static dissector_handle_t esp_handle;
@@ -44,39 +48,32 @@ static void
dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
tvbuff_t *next_tvb;
- proto_tree *udpencap_tree = NULL;
- proto_item *ti = NULL;
+ proto_tree *udpencap_tree;
+ proto_item *ti;
guint32 spi;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "UDPENCAP");
col_clear(pinfo->cinfo, COL_INFO);
- if (tree) {
- ti = proto_tree_add_item(tree, proto_udpencap, tvb, 0, -1, ENC_NA);
- udpencap_tree = proto_item_add_subtree(ti, ett_udpencap);
- }
+ ti = proto_tree_add_item(tree, proto_udpencap, tvb, 0, -1, ENC_NA);
+ udpencap_tree = proto_item_add_subtree(ti, ett_udpencap);
/* 1 byte of 0xFF indicates NAT-keepalive */
if ((tvb_length(tvb) == 1) && (tvb_get_guint8(tvb, 0) == 0xff)) {
col_set_str(pinfo->cinfo, COL_INFO, "NAT-keepalive");
- if (tree)
- proto_tree_add_text(udpencap_tree, tvb, 0, 1, "NAT-keepalive packet");
+ proto_tree_add_item(udpencap_tree, hf_nat_keepalive, tvb, 0, 1, ENC_NA);
} else {
/* SPI of zero indicates IKE traffic, otherwise it's ESP */
- tvb_memcpy(tvb, (guint8 *)&spi, 0, sizeof(spi));
+ spi = tvb_get_ntohl(tvb, 0);
if (spi == 0) {
col_set_str(pinfo->cinfo, COL_INFO, "ISAKMP");
- if (tree) {
- proto_tree_add_text(udpencap_tree, tvb, 0, sizeof(spi),
- "Non-ESP Marker");
- proto_item_set_len(ti, sizeof(spi));
- }
- next_tvb = tvb_new_subset_remaining(tvb, sizeof(spi));
+ proto_tree_add_item(udpencap_tree, hf_non_esp_marker, tvb, 0, 4, ENC_NA);
+ proto_item_set_len(ti, 4);
+ next_tvb = tvb_new_subset_remaining(tvb, 4);
call_dissector(isakmp_handle, next_tvb, pinfo, tree);
} else {
col_set_str(pinfo->cinfo, COL_INFO, "ESP");
- if (tree)
- proto_item_set_len(ti, 0);
+ proto_item_set_len(ti, 0);
call_dissector(esp_handle, tvb, pinfo, tree);
}
}
@@ -85,12 +82,20 @@ dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
void
proto_register_udpencap(void)
{
+ static hf_register_info hf[] = {
+ { &hf_nat_keepalive, { "NAT-keepalive packet", "udpencap.nat_keepalive",
+ FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
+ { &hf_non_esp_marker, { "Non-ESP Marker", "udpencap.non_esp_marker",
+ FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
+ };
+
static gint *ett[] = {
&ett_udpencap,
};
proto_udpencap = proto_register_protocol(
"UDP Encapsulation of IPsec Packets", "UDPENCAP", "udpencap");
+ proto_register_field_array(proto_udpencap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
diff --git a/epan/dissectors/packet-ipxwan.c b/epan/dissectors/packet-ipxwan.c
index f760a14a09..34e9daa4d7 100644
--- a/epan/dissectors/packet-ipxwan.c
+++ b/epan/dissectors/packet-ipxwan.c
@@ -176,12 +176,10 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
while (num_options != 0) {
option_number = tvb_get_guint8(tvb, offset);
- ti = proto_tree_add_text(ipxwan_tree, tvb, offset, -1,
- "Option: %s",
+ option_tree = proto_tree_add_subtree_format(ipxwan_tree, tvb, offset, -1,
+ ett_ipxwan_option, &ti, "Option: %s",
val_to_str(option_number, ipxwan_option_num_vals,
"Unknown (%u)"));
- option_tree = proto_item_add_subtree(ti,
- ett_ipxwan_option);
proto_tree_add_uint(option_tree, hf_ipxwan_option_num,
tvb, offset, 1, option_number);
diff --git a/epan/dissectors/packet-isl.c b/epan/dissectors/packet-isl.c
index e580cd4a5a..d93b2d81ce 100644
--- a/epan/dissectors/packet-isl.c
+++ b/epan/dissectors/packet-isl.c
@@ -56,6 +56,9 @@ static int hf_isl_src = -1;
static int hf_isl_addr = -1;
static int hf_isl_len = -1;
static int hf_isl_hsa = -1;
+static int hf_isl_dsap = -1;
+static int hf_isl_ssap = -1;
+static int hf_isl_control = -1;
static int hf_isl_vlan_id = -1;
static int hf_isl_bpdu = -1;
static int hf_isl_index = -1;
@@ -229,11 +232,10 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int fcs_len)
}
if (tree) {
- tvb_ensure_bytes_exist(payload_tvb, 0, 6);
/* This part looks sort of like a SNAP-encapsulated LLC header... */
- proto_tree_add_text(fh_tree, payload_tvb, 0, 1, "DSAP: 0x%X", tvb_get_guint8(tvb, 14));
- proto_tree_add_text(fh_tree, payload_tvb, 1, 1, "SSAP: 0x%X", tvb_get_guint8(tvb, 15));
- proto_tree_add_text(fh_tree, payload_tvb, 2, 1, "Control: 0x%X", tvb_get_guint8(tvb, 16));
+ proto_tree_add_item(fh_tree, hf_isl_dsap, payload_tvb, 0, 1, ENC_NA);
+ proto_tree_add_item(fh_tree, hf_isl_ssap, payload_tvb, 1, 1, ENC_NA);
+ proto_tree_add_item(fh_tree, hf_isl_control, payload_tvb, 2, 1, ENC_NA);
/* ...but this is the manufacturer's ID portion of the source address
field (which is, admittedly, an OUI). */
@@ -353,6 +355,15 @@ proto_register_isl(void)
{ &hf_isl_hsa,
{ "HSA", "isl.hsa", FT_UINT24, BASE_HEX, NULL, 0x0,
"High bits of source address", HFILL }},
+ { &hf_isl_dsap,
+ { "DSAP", "isl.dsap", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+ { &hf_isl_ssap,
+ { "SSAP", "isl.ssap", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+ { &hf_isl_control,
+ { "Control", "isl.control", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_isl_vlan_id,
{ "VLAN ID", "isl.vlan_id", FT_UINT16, BASE_DEC, NULL,
0xFFFE, "Virtual LAN ID (Color)", HFILL }},
diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c
index d59b8e087b..de55315889 100644
--- a/epan/dissectors/packet-isns.c
+++ b/epan/dissectors/packet-isns.c
@@ -32,6 +32,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/exceptions.h>
#include <epan/conversation.h>
#include <epan/prefs.h>
@@ -178,7 +179,8 @@ static int hf_isns_pg_portal_port = -1;
static int hf_isns_pg_index = -1;
static int hf_isns_pg_next_index = -1;
-
+static expert_field ei_isns_portal_ip_addr = EI_INIT;
+static expert_field ei_isns_not_first_pdu = EI_INIT;
/* Desegment iSNS over TCP messages */
static gboolean isns_desegment = TRUE;
@@ -555,9 +557,17 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
proto_item *ti;
proto_tree *isns_tree;
guint16 flags;
- proto_tree *tt;
- proto_item *tflags;
+ proto_tree *tt = NULL;
proto_item *tpayload;
+ static const int * isns_flags[] = {
+ &hf_isns_client,
+ &hf_isns_server,
+ &hf_isns_auth,
+ &hf_isns_replace,
+ &hf_isns_last_pdu,
+ &hf_isns_first_pdu,
+ NULL
+ };
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "iSNS");
@@ -571,9 +581,6 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
val_to_str_ext(function_id, &isns_function_ids_ext,
"Unknown function ID 0x%04x"));
- if (tree == NULL)
- return tvb_length(tvb);
-
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_isns, tvb, 0, -1, ENC_NA);
isns_tree = proto_item_add_subtree(ti, ett_isns);
@@ -583,20 +590,9 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
proto_tree_add_item(isns_tree, hf_isns_function_id, tvb, offset+2, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(isns_tree, hf_isns_pdu_length, tvb, offset+4, 2, ENC_BIG_ENDIAN);
- /*FLAGS*/
flags = tvb_get_ntohs(tvb, offset + 6);
- tflags = proto_tree_add_item(isns_tree, hf_isns_flags, tvb, offset+6, 2, ENC_BIG_ENDIAN);
- tt = proto_item_add_subtree(tflags, ett_isns_flags);
-
- proto_tree_add_boolean(tt, hf_isns_client, tvb, offset+6, 2, flags);
- proto_tree_add_boolean(tt, hf_isns_server, tvb, offset+6, 2, flags);
- proto_tree_add_boolean(tt, hf_isns_auth, tvb, offset+6, 2, flags);
- proto_tree_add_boolean(tt, hf_isns_replace, tvb, offset+6, 2, flags);
- proto_tree_add_boolean(tt, hf_isns_last_pdu, tvb, offset+6, 2, flags);
- proto_tree_add_boolean(tt, hf_isns_first_pdu, tvb, offset+6, 2, flags);
-
+ proto_tree_add_bitmask(isns_tree, tvb, offset+6, hf_isns_flags, ett_isns_flags, isns_flags, ENC_BIG_ENDIAN);
proto_tree_add_item(isns_tree, hf_isns_transaction_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
-
proto_tree_add_item(isns_tree, hf_isns_sequence_id, tvb, offset+10, 2, ENC_BIG_ENDIAN);
tpayload = proto_tree_add_item(isns_tree, hf_isns_payload, tvb, offset+12, -1, ENC_NA);
@@ -674,7 +670,7 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
default:
/* we can only look at the attributes for the first PDU */
if(!(flags&ISNS_FLAGS_FIRST_PDU)){
- proto_tree_add_text(tt, tvb, offset, -1, "This is not the first PDU. The attributes are not decoded");
+ proto_tree_add_expert(tt, pinfo, &ei_isns_not_first_pdu, tvb, offset, -1);
return tvb_length(tvb);
}
@@ -819,8 +815,7 @@ dissect_isns_attr_integer(tvbuff_t *tvb, guint offset, proto_tree *parent_tree,
item = proto_tree_add_uint_format_value(parent_tree, hf_isns_portal_group_tag, tvb, offset, 8, 0, "<NULL>");
tree = proto_item_add_subtree(item, ett_isns_attribute);
} else {
- item = proto_tree_add_text(parent_tree, tvb, offset, 8, "Oops, you surprised me here. a 0 byte integer.");
- tree = proto_item_add_subtree(item, ett_isns_attribute);
+ tree = proto_tree_add_subtree(parent_tree, tvb, offset, 8, ett_isns_attribute, NULL, "Oops, you surprised me here. a 0 byte integer.");
}
proto_tree_add_uint(tree, hf_isns_attr_tag, tvb, offset, 4, tag);
@@ -1075,7 +1070,7 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset,
case ISNS_ATTR_TAG_PORTAL_IP_ADDRESS:
switch(len){
case 64:
- proto_tree_add_text(tree, tvb, offset, -1, "Broken iSNS implementation. The PORTAL_IP_ADDRESS tag should be 16 bytes in length");
+ proto_tree_add_expert(tree, pinfo, &ei_isns_portal_ip_addr, tvb, offset, -1);
case 16:
dissect_isns_attr_ip_address(tvb, offset, tree, hf_isns_portal_ip_addr, tag, 16);
break;
@@ -1084,34 +1079,27 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset,
}
break;
case ISNS_ATTR_TAG_PORTAL_PORT:
- if(len != 4) THROW(ReportedBoundsError);
dissect_isns_attr_port(tvb, offset, tree, hf_isns_portal_port, tag, len, ISNS_OTHER_PORT, pinfo);
break;
case ISNS_ATTR_TAG_PORTAL_SYMBOLIC_NAME:
dissect_isns_attr_string(tvb, offset, tree, hf_isns_portal_symbolic_name, tag, len);
break;
case ISNS_ATTR_TAG_ESI_INTERVAL:
- if(len != 4) THROW(ReportedBoundsError);
dissect_isns_attr_integer(tvb, offset, tree, hf_isns_esi_interval, tag, len, function_id);
break;
case ISNS_ATTR_TAG_ESI_PORT:
- if(len != 4) THROW(ReportedBoundsError);
dissect_isns_attr_port(tvb, offset, tree, hf_isns_esi_port, tag, len, ISNS_ESI_PORT, pinfo);
break;
case ISNS_ATTR_TAG_PORTAL_INDEX:
- if(len != 4) THROW(ReportedBoundsError);
dissect_isns_attr_integer(tvb, offset, tree, hf_isns_portal_index, tag, len, function_id);
break;
case ISNS_ATTR_TAG_SCN_PORT:
- if(len != 4) THROW(ReportedBoundsError);
dissect_isns_attr_port(tvb, offset, tree, hf_isns_scn_port, tag, len, ISNS_SCN_PORT, pinfo);
break;
case ISNS_ATTR_TAG_PORTAL_NEXT_INDEX:
- if(len != 4) THROW(ReportedBoundsError);
dissect_isns_attr_integer(tvb, offset, tree, hf_isns_portal_next_index, tag, len, function_id);
break;
case ISNS_ATTR_TAG_PORTAL_SECURITY_BITMAP:
- if(len != 4) THROW(ReportedBoundsError);
dissect_isns_attr_portal_security_bitmap(tvb, offset, tree, hf_isns_psb, tag, len);
break;
case ISNS_ATTR_TAG_PORTAL_ISAKMP_PHASE_1:
@@ -1158,7 +1146,8 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset,
case ISNS_ATTR_TAG_PG_PORTAL_IP_ADDR:
switch(len){
case 64:
- proto_tree_add_text(tree, tvb, offset, -1, "Broken iSNS implementation. The PG_PORTAL_IP_ADDRESS tag should be 16 bytes in length");
+ proto_tree_add_expert_format(tree, pinfo, &ei_isns_portal_ip_addr, tvb, offset, -1,
+ "Broken iSNS implementation. The PG_PORTAL_IP_ADDRESS tag should be 16 bytes in length");
case 16:
dissect_isns_attr_ip_address(tvb, offset, tree, hf_isns_pg_portal_ip_addr, tag, 16);
break;
@@ -1918,13 +1907,22 @@ void proto_register_isns(void)
&ett_isns_port,
&ett_isns_isnt
};
+
+ static ei_register_info ei[] = {
+ { &ei_isns_portal_ip_addr, { "isns.portal.ip_address.malformed", PI_MALFORMED, PI_ERROR, "Broken iSNS implementation. The PORTAL_IP_ADDRESS tag should be 16 bytes in length", EXPFILL }},
+ { &ei_isns_not_first_pdu, { "isns.not_first_pdu", PI_PROTOCOL, PI_WARN, "This is not the first PDU. The attributes are not decoded", EXPFILL }},
+ };
+
module_t *isns_module;
+ expert_module_t* expert_isns;
/* Register the protocol name and description */
proto_isns = proto_register_protocol("iSNS",
"iSNS", "isns");
proto_register_field_array(proto_isns, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_isns = expert_register_protocol(proto_isns);
+ expert_register_field_array(expert_isns, ei, array_length(ei));
/* Register preferences */
isns_module = prefs_register_protocol(proto_isns, NULL);
diff --git a/epan/proto.c b/epan/proto.c
index f802e8c08f..96189623fe 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1195,6 +1195,23 @@ proto_tree_add_format_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint len
return pi;
}
+proto_item *
+proto_tree_add_format_wsp_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length)
+{
+ proto_item *pi;
+ header_field_info *hfinfo;
+
+ TRY_TO_FAKE_THIS_ITEM(tree, hf_text_only, hfinfo, tvb);
+
+ pi = proto_tree_add_text_node(tree, tvb, start, length);
+
+ TRY_TO_FAKE_THIS_REPR(pi);
+
+ proto_item_set_text(pi, "%s", tvb_format_text_wsp(tvb, start, length));
+
+ return pi;
+}
+
void proto_report_dissector_bug(const char *message)
{
if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL)
diff --git a/epan/proto.h b/epan/proto.h
index dada8a938e..e490546a02 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -956,6 +956,10 @@ proto_tree_add_subtree_format(proto_tree *tree, tvbuff_t *tvb, gint start, gint
proto_item *
proto_tree_add_format_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length);
+/** Add a text-only node to a proto_tree with tvb_format_text_wsp() string. */
+proto_item *
+proto_tree_add_format_wsp_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length);
+
/** Add a FT_NONE field to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index