aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mip6.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2015-12-11 04:02:20 +0000
committerAnders Broman <a.broman58@gmail.com>2015-12-11 13:32:42 +0000
commit6586926a477a4c504ee1b7672757f728cef7b0b3 (patch)
tree27129c08c2e0e714ed30143736e473c37e3e645a /epan/dissectors/packet-mip6.c
parent1a40ce95c546468cf4ae9d1b0980c613a6d1fe3b (diff)
MIPv6: Add support for "Home Agent Switch Message" Mobility Header
Specification in RFC 5142. Change-Id: I30d2f4591f1659b74dce5839e4439aa86f1c5e85 Reviewed-on: https://code.wireshark.org/review/12519 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-mip6.c')
-rw-r--r--epan/dissectors/packet-mip6.c87
1 files changed, 75 insertions, 12 deletions
diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c
index 4a2f9b032f..fa368ca09f 100644
--- a/epan/dissectors/packet-mip6.c
+++ b/epan/dissectors/packet-mip6.c
@@ -646,7 +646,6 @@ static const true_false_string mip6_dmnp_v_flag_value = {
#define FMIP6_FBACK_LEN 6
#define FMIP6_FNA_LEN 2
#define MIP6_EMH_LEN 0
-#define MIP6_HAS_LEN 18
#define MIP6_HB_LEN 6
#define MIP6_HI_LEN 4
#define MIP6_HAck_LEN 4
@@ -751,14 +750,6 @@ static const true_false_string mip6_dmnp_v_flag_value = {
#define FMIP6_FNA_OPTS_OFF 8
#define FMIP6_FNA_RES_LEN 2
-#define MIP6_HAS_NRADR_OFF 6
-#define MIP6_HAS_RES_OFF 7
-#define MIP6_HAS_HAA_OFF 8
-#define MIP6_HAS_OPTS_OFF 24
-#define MIP6_HAS_NRADR_LEN 1
-#define MIP6_HAS_RES_LEN 1
-#define MIP6_HAS_HAA_LEN 16
-
#define MIP6_HB_RES_OFF 6
#define MIP6_HB_FLAGS_OFF 7
#define MIP6_HB_SEQNR_OFF 8
@@ -1013,6 +1004,10 @@ static int hf_fmip6_fback_k_flag = -1;
static int hf_fmip6_fback_seqnr = -1;
static int hf_fmip6_fback_lifetime = -1;
+static int hf_mip6_has_num_addrs = -1;
+static int hf_mip6_has_reserved = -1;
+static int hf_mip6_has_address = -1;
+
static int hf_mip6_hb_u_flag = -1;
static int hf_mip6_hb_r_flag = -1;
static int hf_mip6_hb_seqnr = -1;
@@ -1490,6 +1485,61 @@ dissect_mip6_be(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
return MIP6_DATA_OFF + MIP6_BE_LEN;
}
+/* Home Agent Switch Message */
+/*
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |# of Addresses | Reserved |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | |
+ + +
+ . .
+ . Home Agent Addresses .
+ . .
+ + +
+ | |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | |
+ + +
+ . .
+ . Mobility Options .
+ . .
+ + +
+ | |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+*/
+
+static int
+dissect_mip6_has(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
+{
+ guint num_addrs, len;
+
+ num_addrs = tvb_get_guint8(tvb, MIP6_DATA_OFF);
+ len = 2 + num_addrs * 16;
+
+ if (mip6_tree) {
+ proto_tree *data_tree;
+ gint off;
+ guint i;
+
+ data_tree = proto_tree_add_subtree(mip6_tree, tvb, MIP6_DATA_OFF,
+ len, ett_mip6, NULL, "Home Agent Switch");
+
+ proto_tree_add_item(data_tree, hf_mip6_has_num_addrs, tvb,
+ MIP6_DATA_OFF, 1, ENC_BIG_ENDIAN);
+
+ proto_tree_add_item(data_tree, hf_mip6_has_reserved, tvb,
+ MIP6_DATA_OFF + 1, 1, ENC_BIG_ENDIAN);
+
+ for (i = 0, off = MIP6_DATA_OFF + 2; i < num_addrs; i++, off += 16) {
+ proto_tree_add_item(data_tree, hf_mip6_has_address, tvb, off, 16, ENC_NA);
+ }
+ }
+
+ return len;
+}
+
static int
dissect_mip6_hb(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo _U_)
{
@@ -4109,8 +4159,7 @@ dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
break;
case MIP6_HAS:
/* 12 Home Agent Switch */
- dissect_mip6_unknown(tvb, mip6_tree, pinfo);
- offset = len;
+ offset = dissect_mip6_has(tvb, mip6_tree, pinfo);
break;
case MIP6_HB:
/* 13 Heartbeat */
@@ -4419,7 +4468,21 @@ proto_register_mip6(void)
FT_UINT16, BASE_DEC, NULL, 0,
NULL, HFILL }
},
-
+ { &hf_mip6_has_num_addrs,
+ { "Number of Addresses", "mip6.has.num_addrs",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_mip6_has_reserved,
+ { "Reserved", "mip6.has.reserved",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ NULL, HFILL }
+ },
+ { &hf_mip6_has_address,
+ { "Address", "mip6.has.address",
+ FT_IPv6, BASE_NONE, NULL, 0,
+ "Home Agent Address", HFILL }
+ },
{ &hf_mip6_hb_u_flag,
{ "Unsolicited (U) flag", "mip6.hb.u_flag",
FT_BOOLEAN, 8, TFS(&mip6_hb_u_flag_value), 0x02,