aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-06-29 19:59:08 +0000
committerMichael Mann <mmann78@netscape.net>2013-06-29 19:59:08 +0000
commite5af2f55ee08b521dee843fa2e030714045ce061 (patch)
tree7a840aeeff0ffb89b11a2cf20881748a773e10e6
parent04f8906be3d59cf3c33c0302adfef8bd184abb99 (diff)
Separate IP option header fields for each dissector that uses dissect_ip_tcp_options(). Bug 8823 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8823)
svn path=/trunk/; revision=50230
-rw-r--r--epan/dissectors/packet-ip.c57
-rw-r--r--epan/dissectors/packet-ppp.c37
-rw-r--r--epan/dissectors/packet-tcp.c27
-rw-r--r--epan/ip_opts.h24
4 files changed, 103 insertions, 42 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 845b62e7bf..0eeef31f9c 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -360,17 +360,13 @@ static dissector_handle_t tapa_handle;
#define IPTOS_PREC_ROUTINE 0
/* IP options */
-#define IPOPT_COPY_MASK 0x80
#define IPOPT_COPY 0x80
-#define IPOPT_CLASS_MASK 0x60
#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_MEASUREMENT 0x40
#define IPOPT_RESERVED2 0x60
-#define IPOPT_NUMBER_MASK 0x1F
-
/* REF: http://www.iana.org/assignments/ip-parameters */
/* TODO: Not all of these are implemented. */
#define IPOPT_EOOL (0 |IPOPT_CONTROL)
@@ -623,7 +619,7 @@ add_geoip_info(proto_tree *tree, tvbuff_t *tvb, gint offset, guint32 src32,
}
#endif /* HAVE_GEOIP */
-static const value_string ipopt_type_class_vals[] = {
+const value_string ipopt_type_class_vals[] = {
{(IPOPT_CONTROL & IPOPT_CLASS_MASK) >> 5, "Control"},
{(IPOPT_RESERVED1 & IPOPT_CLASS_MASK) >> 5, "Reserved for future use"},
{(IPOPT_MEASUREMENT & IPOPT_CLASS_MASK) >> 5, "Debugging and measurement"},
@@ -631,7 +627,7 @@ static const value_string ipopt_type_class_vals[] = {
{0, NULL}
};
-static const value_string ipopt_type_number_vals[] = {
+const value_string ipopt_type_number_vals[] = {
{IPOPT_EOOL & IPOPT_NUMBER_MASK, "End of Option List (EOL)"},
{IPOPT_NOP & IPOPT_NUMBER_MASK, "No-Operation (NOP)"},
{IPOPT_SEC & IPOPT_NUMBER_MASK, "Security"},
@@ -662,17 +658,20 @@ static const value_string ipopt_type_number_vals[] = {
{0, NULL}
};
+static ip_tcp_opt_type IP_OPT_TYPES = {&hf_ip_opt_type, &ett_ip_opt_type,
+ &hf_ip_opt_type_copy, &hf_ip_opt_type_class, &hf_ip_opt_type_number};
+
static void
-dissect_ipopt_type(tvbuff_t *tvb, int offset, proto_tree *tree)
+dissect_ipopt_type(tvbuff_t *tvb, int offset, proto_tree *tree, ip_tcp_opt_type* opttypes)
{
proto_tree *type_tree;
proto_item *ti;
- ti = proto_tree_add_item(tree, hf_ip_opt_type, tvb, offset, 1, ENC_NA);
- type_tree = proto_item_add_subtree(ti, ett_ip_opt_type);
- proto_tree_add_item(type_tree, hf_ip_opt_type_copy, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(type_tree, hf_ip_opt_type_class, tvb, offset, 1, ENC_NA);
- proto_tree_add_item(type_tree, hf_ip_opt_type_number, tvb, offset, 1, ENC_NA);
+ ti = proto_tree_add_item(tree, *opttypes->phf_opt_type, tvb, offset, 1, ENC_NA);
+ type_tree = proto_item_add_subtree(ti, *opttypes->pett_opt_type);
+ proto_tree_add_item(type_tree, *opttypes->phf_opt_type_copy, tvb, offset, 1, ENC_NA);
+ proto_tree_add_item(type_tree, *opttypes->phf_opt_type_class, tvb, offset, 1, ENC_NA);
+ proto_tree_add_item(type_tree, *opttypes->phf_opt_type_number, tvb, offset, 1, ENC_NA);
}
static void
@@ -685,7 +684,7 @@ dissect_ipopt_eool(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, 1, "%s", optp->name);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
}
#define dissect_ipopt_nop dissect_ipopt_eool
@@ -762,7 +761,7 @@ dissect_ipopt_security(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, curr_offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, curr_offset, field_tree);
+ dissect_ipopt_type(tvb, curr_offset, field_tree, &IP_OPT_TYPES);
curr_offset++;
tf_sub = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, curr_offset, 1, ENC_NA);
if (optlen > IPOLEN_MAX)
@@ -831,7 +830,7 @@ dissect_ipopt_ext_security(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, curr_offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, curr_offset, field_tree);
+ dissect_ipopt_type(tvb, curr_offset, field_tree, &IP_OPT_TYPES);
curr_offset++;
tf_sub = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, curr_offset, 1, ENC_NA);
if (optlen > IPOLEN_MAX)
@@ -869,7 +868,7 @@ dissect_ipopt_cipso(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen > IPOLEN_MAX)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1130,7 +1129,7 @@ dissect_ipopt_route(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen > IPOLEN_MAX)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1210,7 +1209,7 @@ dissect_ipopt_record_route(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen > IPOLEN_MAX)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1269,7 +1268,7 @@ dissect_ipopt_sid(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes): %u",
optp->name, optlen, tvb_get_ntohs(tvb, offset + 2));
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen != (guint)optp->optlen)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1288,7 +1287,7 @@ dissect_ipopt_mtu(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes): %u",
optp->name, optlen, tvb_get_ntohs(tvb, offset + 2));
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen != (guint)optp->optlen)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1307,7 +1306,7 @@ dissect_ipopt_tr(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen != (guint)optp->optlen)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1339,7 +1338,7 @@ dissect_ipopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen > IPOLEN_MAX)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1416,7 +1415,7 @@ dissect_ipopt_ra(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
rval_to_str(value, ra_rvals, "Unknown (%u)"),
value);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen != (guint)optp->optlen)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1435,7 +1434,7 @@ dissect_ipopt_sdb(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s (%u bytes)",
optp->name, optlen);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
tf = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen > IPOLEN_MAX)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1492,7 +1491,7 @@ dissect_ipopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
val_to_str(function, qs_func_vals, "Unknown (%u)"),
function);
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, &IP_OPT_TYPES);
ti = proto_tree_add_item(field_tree, hf_ip_opt_len, tvb, offset + 1, 1, ENC_NA);
if (optlen != (guint)optp->optlen)
expert_add_info(pinfo, tf, &ei_ip_opt_len_invalid);
@@ -1594,7 +1593,7 @@ static const ip_tcp_opt ipopts[] = {
* options in a packet. */
void
dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
- const ip_tcp_opt *opttab, int nopts, int eol,
+ const ip_tcp_opt *opttab, int nopts, int eol, ip_tcp_opt_type* opttypes,
packet_info *pinfo, proto_tree *opt_tree,
proto_item *opt_item, void * data)
{
@@ -1698,7 +1697,7 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
name);
tf = proto_tree_add_text(opt_tree, tvb, offset, len, "%s", name);
field_tree = proto_item_add_subtree(tf, ett_ip_option_other);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, opttypes);
}
}
len -= 2; /* subtract size of type and length */
@@ -1718,7 +1717,7 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
proto_item_append_text(proto_tree_get_parent(opt_tree), ", %s", name);
tf = proto_tree_add_text(opt_tree, tvb, offset, 1, "%s", name);
field_tree = proto_item_add_subtree(tf, ett_ip_option_other);
- dissect_ipopt_type(tvb, offset, field_tree);
+ dissect_ipopt_type(tvb, offset, field_tree, opttypes);
}
offset += 1;
@@ -2317,7 +2316,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
"Options: (%u bytes)", optlen);
field_tree = proto_item_add_subtree(tf, ett_ip_options);
dissect_ip_tcp_options(tvb, offset + 20, optlen, ipopts, N_IP_OPTS,
- IPOPT_EOOL, pinfo, field_tree, tf, NULL);
+ IPOPT_EOOL, &IP_OPT_TYPES, pinfo, field_tree, tf, NULL);
}
pinfo->ipproto = iph->ip_p;
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index 0a256b3e21..be36b47a41 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -62,8 +62,13 @@ static int hf_ppp_magic_number = -1;
static int hf_ppp_oui = -1;
static int hf_ppp_kind = -1;
static int hf_ppp_data = -1;
+static int hf_ppp_opt_type = -1;
+static int hf_ppp_opt_type_copy = -1;
+static int hf_ppp_opt_type_class = -1;
+static int hf_ppp_opt_type_number = -1;
static gint ett_ppp = -1;
+static gint ett_ppp_opt_type = -1;
static int proto_ppp_hdlc = -1;
@@ -1249,6 +1254,9 @@ static const ip_tcp_opt ipcp_rohc_subopts[] = {
#define N_IPCP_ROHC_SUBOPTS (sizeof ipcp_rohc_subopts / sizeof ipcp_rohc_subopts[0])
+static ip_tcp_opt_type PPP_OPT_TYPES = {&hf_ppp_opt_type, &ett_ppp_opt_type,
+ &hf_ppp_opt_type_copy, &hf_ppp_opt_type_class, &hf_ppp_opt_type_number};
+
/*
* Options. (OSINLCP)
*/
@@ -2705,7 +2713,7 @@ dissect_ipcp_compress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
"Suboptions: (%u byte%s)", length, plurality(length, "", "s"));
subopt_tree = proto_item_add_subtree(tso, *optp->subtree_index);
dissect_ip_tcp_options(tvb, offset, length, ipcp_rohc_subopts,
- N_IPCP_ROHC_SUBOPTS, -1, pinfo, subopt_tree, NULL, NULL);
+ N_IPCP_ROHC_SUBOPTS, -1, &PPP_OPT_TYPES, pinfo, subopt_tree, NULL, NULL);
}
break;
@@ -2744,7 +2752,7 @@ dissect_ipcp_compress_opt(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
"Suboptions: (%u byte%s)", length, plurality(length, "", "s"));
subopt_tree = proto_item_add_subtree(tso, *optp->subtree_index);
dissect_ip_tcp_options(tvb, offset, length, ipcp_iphc_subopts,
- N_IPCP_IPHC_SUBOPTS, -1, pinfo, subopt_tree, NULL, NULL);
+ N_IPCP_IPHC_SUBOPTS, -1, &PPP_OPT_TYPES, pinfo, subopt_tree, NULL, NULL);
}
break;
@@ -3846,7 +3854,7 @@ dissect_cp(tvbuff_t *tvb, int proto_id, int proto_subtree_index,
tf = proto_tree_add_text(fh_tree, tvb, offset, length,
"Options: (%d byte%s)", length, plurality(length, "", "s"));
field_tree = proto_item_add_subtree(tf, options_subtree_index);
- dissect_ip_tcp_options(tvb, offset, length, opts, nopts, -1, pinfo,
+ dissect_ip_tcp_options(tvb, offset, length, opts, nopts, -1, &PPP_OPT_TYPES, pinfo,
field_tree, NULL, NULL);
}
break;
@@ -4014,7 +4022,7 @@ static void
dissect_lcp_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_ip_tcp_options(tvb, 0, tvb_reported_length(tvb), lcp_opts,
- N_LCP_OPTS, -1, pinfo, tree, NULL, NULL);
+ N_LCP_OPTS, -1, &PPP_OPT_TYPES, pinfo, tree, NULL, NULL);
}
/*
@@ -4072,7 +4080,7 @@ dissect_vsncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
plurality(length, "", "s"));
field_tree = proto_item_add_subtree(tf, ett_vsncp_options);
dissect_ip_tcp_options(tvb, offset, length, vsncp_opts,
- N_VSNCP_OPTS, -1, pinfo, field_tree, NULL, NULL);
+ N_VSNCP_OPTS, -1, &PPP_OPT_TYPES, pinfo, field_tree, NULL, NULL);
}
break;
@@ -4335,7 +4343,7 @@ dissect_bap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
"Data (%d byte%s)", length, plurality(length, "", "s"));
field_tree = proto_item_add_subtree(tf, ett_bap_options);
dissect_ip_tcp_options(tvb, offset, length, bap_opts, N_BAP_OPTS,
- -1, pinfo, field_tree, NULL, NULL);
+ -1, &PPP_OPT_TYPES, pinfo, field_tree, NULL, NULL);
}
}
@@ -5463,10 +5471,23 @@ proto_register_ppp(void)
NULL, 0x0, NULL, HFILL }},
{ &hf_ppp_data,
{ "Data", "ppp.data", FT_BYTES, BASE_NONE,
- NULL, 0x0, NULL, HFILL }}
+ NULL, 0x0, NULL, HFILL }},
+ { &hf_ppp_opt_type,
+ { "Type", "ppp.opt.type", FT_UINT8, BASE_DEC,
+ NULL, 0x0, NULL, HFILL}},
+ { &hf_ppp_opt_type_copy,
+ { "Copy on fragmentation", "ppp.opt.type.copy", FT_BOOLEAN, 8,
+ TFS(&tfs_yes_no), IPOPT_COPY_MASK, NULL, HFILL}},
+ { &hf_ppp_opt_type_class,
+ { "Class", "ppp.opt.type.class", FT_UINT8, BASE_DEC,
+ VALS(ipopt_type_class_vals), IPOPT_CLASS_MASK, NULL, HFILL}},
+ { &hf_ppp_opt_type_number,
+ { "Number", "ppp.opt.type.number", FT_UINT8, BASE_DEC,
+ VALS(ipopt_type_number_vals), IPOPT_NUMBER_MASK, NULL, HFILL}},
};
static gint *ett[] = {
- &ett_ppp
+ &ett_ppp,
+ &ett_ppp_opt_type
};
module_t *ppp_module;
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 90bea4c96a..521b41a21f 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -241,6 +241,10 @@ static int hf_tcp_option_fast_open_cookie = -1;
static int hf_tcp_ts_relative = -1;
static int hf_tcp_ts_delta = -1;
+static int hf_tcp_option_type = -1;
+static int hf_tcp_option_type_copy = -1;
+static int hf_tcp_option_type_class = -1;
+static int hf_tcp_option_type_number = -1;
static int hf_tcp_option_scps = -1;
static int hf_tcp_option_scps_vector = -1;
static int hf_tcp_option_scps_binding = -1;
@@ -272,6 +276,7 @@ static int hf_tcp_segment_data = -1;
static gint ett_tcp = -1;
static gint ett_tcp_flags = -1;
+static gint ett_tcp_option_type = -1;
static gint ett_tcp_options = -1;
static gint ett_tcp_option_timestamp = -1;
static gint ett_tcp_option_mss = -1;
@@ -3880,6 +3885,9 @@ static const ip_tcp_opt tcpopts[] = {
#define N_TCP_OPTS array_length(tcpopts)
+static ip_tcp_opt_type TCP_OPT_TYPES = {&hf_tcp_option_type, &ett_tcp_option_type,
+ &hf_tcp_option_type_copy, &hf_tcp_option_type_class, &hf_tcp_option_type_number};
+
/* Determine if there is a sub-dissector and call it; return TRUE
if there was a sub-dissector, FALSE otherwise.
@@ -4705,7 +4713,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
field_tree = NULL;
}
dissect_ip_tcp_options(tvb, offset + 20, optlen,
- tcpopts, N_TCP_OPTS, TCPOPT_EOL, pinfo, field_tree, tf, tcph);
+ tcpopts, N_TCP_OPTS, TCPOPT_EOL, &TCP_OPT_TYPES, pinfo, field_tree, tf, tcph);
}
if(!pinfo->fd->flags.visited) {
@@ -5347,6 +5355,22 @@ proto_register_tcp(void)
{ "TCP QS Option", "tcp.options.qs", FT_BOOLEAN, BASE_NONE,
NULL, 0x0, NULL, HFILL}},
+ { &hf_tcp_option_type,
+ { "Type", "tcp.options.type", FT_UINT8, BASE_DEC,
+ NULL, 0x0, NULL, HFILL}},
+
+ { &hf_tcp_option_type_copy,
+ { "Copy on fragmentation", "tcp.options.type.copy", FT_BOOLEAN, 8,
+ TFS(&tfs_yes_no), IPOPT_COPY_MASK, NULL, HFILL}},
+
+ { &hf_tcp_option_type_class,
+ { "Class", "tcp.options.type.class", FT_UINT8, BASE_DEC,
+ VALS(ipopt_type_class_vals), IPOPT_CLASS_MASK, NULL, HFILL}},
+
+ { &hf_tcp_option_type_number,
+ { "Number", "tcp.options.type.number", FT_UINT8, BASE_DEC,
+ VALS(ipopt_type_number_vals), IPOPT_NUMBER_MASK, NULL, HFILL}},
+
{ &hf_tcp_option_scps,
{ "TCP SCPS Capabilities Option", "tcp.options.scps",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
@@ -5658,6 +5682,7 @@ proto_register_tcp(void)
static gint *ett[] = {
&ett_tcp,
&ett_tcp_flags,
+ &ett_tcp_option_type,
&ett_tcp_options,
&ett_tcp_option_timestamp,
&ett_tcp_option_mptcp,
diff --git a/epan/ip_opts.h b/epan/ip_opts.h
index b152d097fd..cbfa2958c1 100644
--- a/epan/ip_opts.h
+++ b/epan/ip_opts.h
@@ -53,13 +53,21 @@ typedef struct ip_tcp_opt {
void *); /**< routine to dissect option */
} ip_tcp_opt;
+typedef struct ip_tcp_opt_type {
+ int* phf_opt_type;
+ int* pett_opt_type;
+ int* phf_opt_type_copy;
+ int* phf_opt_type_class;
+ int* phf_opt_type_number;
+} ip_tcp_opt_type;
+
/** Routine to dissect options that work like IPv4 options, where the
length field in the option, if present, includes the type and
length bytes. */
-extern void dissect_ip_tcp_options(tvbuff_t *, int, guint,
- const ip_tcp_opt *, int, int,
- packet_info *, proto_tree *, proto_item *,
- void *);
+extern void dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length,
+ const ip_tcp_opt *opttab, int nopts, int eol, ip_tcp_opt_type* opttypes,
+ packet_info *pinfo, proto_tree *opt_tree,
+ proto_item *opt_item, void * data);
/* Quick-Start option, as defined by RFC4782 */
#define QS_FUNC_MASK 0xf0
@@ -67,7 +75,15 @@ extern void dissect_ip_tcp_options(tvbuff_t *, int, guint,
#define QS_RATE_REQUEST 0
#define QS_RATE_REPORT 8
+/* IP options */
+#define IPOPT_COPY_MASK 0x80
+#define IPOPT_CLASS_MASK 0x60
+#define IPOPT_NUMBER_MASK 0x1F
+
WS_DLL_PUBLIC const value_string qs_func_vals[];
WS_DLL_PUBLIC value_string_ext qs_rate_vals_ext;
+WS_DLL_PUBLIC const value_string ipopt_type_class_vals[];
+WS_DLL_PUBLIC const value_string ipopt_type_number_vals[];
+
#endif