aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorPeter Krystad <peter.krystad@linux.intel.com>2020-02-13 11:44:53 -0800
committerAnders Broman <a.broman58@gmail.com>2020-02-18 06:26:44 +0000
commit22e617d8623614a42974f7a714840ed80199b3e0 (patch)
tree2ccafb6e762e7587d5e03eeae19d05c595725d7a /epan
parentc544f7e3f4aaebbc5e18711b24697258c4802cfc (diff)
mptcp: correctly parse v1 ADD_ADDR suboption
RFC6824bis-18 (MPTCP version 1) removes the IP version field and replaces it with an Echo bit that provides a reliability mechanism for the ADD_ADDR option. This change allows either v0 or v1 ADD_ADDR options to be displayed correctly. Change-Id: I375bcf6e54c07f88ca8877a2c4b4220cf4157a64 Reviewed-on: https://code.wireshark.org/review/36095 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-tcp.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index c4a9a6eb15..ca284604ed 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -271,6 +271,7 @@ static int hf_tcp_option_mptcp_subflow_seq_no = -1;
static int hf_tcp_option_mptcp_data_lvl_len = -1;
static int hf_tcp_option_mptcp_checksum = -1;
static int hf_tcp_option_mptcp_ipver = -1;
+static int hf_tcp_option_mptcp_echo = -1;
static int hf_tcp_option_mptcp_ipv4 = -1;
static int hf_tcp_option_mptcp_ipv6 = -1;
static int hf_tcp_option_mptcp_port = -1;
@@ -4776,33 +4777,32 @@ dissect_tcpopt_mptcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
break;
case TCPOPT_MPTCP_ADD_ADDR:
- proto_tree_add_item(mptcp_tree,
- hf_tcp_option_mptcp_ipver, tvb, offset, 1, ENC_BIG_ENDIAN);
ipver = tvb_get_guint8(tvb, offset) & 0x0F;
+ if (ipver == 4 || ipver == 6)
+ proto_tree_add_item(mptcp_tree,
+ hf_tcp_option_mptcp_ipver, tvb, offset, 1, ENC_BIG_ENDIAN);
+ else
+ proto_tree_add_item(mptcp_tree,
+ hf_tcp_option_mptcp_echo, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mptcp_tree,
hf_tcp_option_mptcp_address_id, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- switch (ipver) {
- case 4:
- proto_tree_add_item(mptcp_tree,
+ if (optlen == 8 || optlen == 10 || optlen == 16 || optlen == 18) {
+ proto_tree_add_item(mptcp_tree,
hf_tcp_option_mptcp_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
- offset += 4;
- break;
+ offset += 4;
+ }
- case 6:
- proto_tree_add_item(mptcp_tree,
+ if (optlen == 20 || optlen == 22 || optlen == 28 || optlen == 30) {
+ proto_tree_add_item(mptcp_tree,
hf_tcp_option_mptcp_ipv6, tvb, offset, 16, ENC_NA);
- offset += 16;
- break;
-
- default:
- break;
+ offset += 16;
}
- if (optlen % 4 == 2) {
+ if (optlen == 10 || optlen == 18 || optlen == 22 || optlen == 30) {
proto_tree_add_item(mptcp_tree,
hf_tcp_option_mptcp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
@@ -7303,6 +7303,10 @@ proto_register_tcp(void)
{ "IP version", "tcp.options.mptcp.ipver", FT_UINT8,
BASE_DEC, NULL, 0x0F, NULL, HFILL}},
+ { &hf_tcp_option_mptcp_echo,
+ { "Echo", "tcp.options.mptcp.echo", FT_UINT8,
+ BASE_DEC, NULL, 0x01, NULL, HFILL}},
+
{ &hf_tcp_option_mptcp_ipv4,
{ "Advertised IPv4 Address", "tcp.options.mptcp.ipv4", FT_IPv4,
BASE_NONE, NULL, 0x0, NULL, HFILL}},