summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-teredo.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-teredo.c')
-rw-r--r--epan/dissectors/packet-teredo.c91
1 files changed, 46 insertions, 45 deletions
diff --git a/epan/dissectors/packet-teredo.c b/epan/dissectors/packet-teredo.c
index 3176e65c..353181be 100644
--- a/epan/dissectors/packet-teredo.c
+++ b/epan/dissectors/packet-teredo.c
@@ -25,35 +25,36 @@
void proto_reg_handoff_teredo(void);
void proto_register_teredo(void);
-static int teredo_tap = -1;
+static int teredo_tap;
-static int proto_teredo = -1;
+static int proto_teredo;
-static int hf_teredo_auth = -1;
-static int hf_teredo_auth_idlen = -1;
-static int hf_teredo_auth_aulen = -1;
-static int hf_teredo_auth_id = -1;
-static int hf_teredo_auth_value = -1;
-static int hf_teredo_auth_nonce = -1;
-static int hf_teredo_auth_conf = -1;
-static int hf_teredo_orig = -1;
-static int hf_teredo_orig_port = -1;
-static int hf_teredo_orig_addr = -1;
+static int hf_teredo_auth;
+static int hf_teredo_auth_idlen;
+static int hf_teredo_auth_aulen;
+static int hf_teredo_auth_id;
+static int hf_teredo_auth_value;
+static int hf_teredo_auth_nonce;
+static int hf_teredo_auth_conf;
+static int hf_teredo_orig;
+static int hf_teredo_orig_port;
+static int hf_teredo_orig_addr;
-static gint ett_teredo = -1;
-static gint ett_teredo_auth = -1, ett_teredo_orig = -1;
+static int ett_teredo;
+static int ett_teredo_auth;
+static int ett_teredo_orig;
typedef struct {
- guint16 th_indtyp;
- guint8 th_cidlen;
- guint8 th_authdlen;
- guint8 th_nonce[8];
- guint8 th_conf;
-
- guint8 th_ip_v_hl;
- guint16 th_header;
- guint16 th_orgport;
- guint32 th_iporgaddr;
+ uint16_t th_indtyp;
+ uint8_t th_cidlen;
+ uint8_t th_authdlen;
+ uint8_t th_nonce[8];
+ uint8_t th_conf;
+
+ uint8_t th_ip_v_hl;
+ uint16_t th_header;
+ uint16_t th_orgport;
+ uint32_t th_iporgaddr;
} e_teredohdr;
static dissector_table_t teredo_dissector_table;
@@ -65,7 +66,7 @@ static int
parse_teredo_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset, e_teredohdr *teredoh)
{
- guint idlen, aulen;
+ unsigned idlen, aulen;
col_append_sep_str (pinfo->cinfo, COL_INFO, ", ",
"Authentication header");
@@ -73,11 +74,11 @@ parse_teredo_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
teredoh->th_indtyp = 1;
offset += 2;
- idlen = tvb_get_guint8(tvb, offset);
+ idlen = tvb_get_uint8(tvb, offset);
teredoh->th_cidlen = idlen;
offset++;
- aulen = tvb_get_guint8(tvb, offset);
+ aulen = tvb_get_uint8(tvb, offset);
teredoh->th_authdlen = aulen;
offset++;
@@ -119,7 +120,7 @@ parse_teredo_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += idlen + aulen + 9;
tvb_memcpy(tvb, teredoh->th_nonce, offset - 9, 8);
- teredoh->th_conf = tvb_get_guint8(tvb, offset - 1);
+ teredoh->th_conf = tvb_get_uint8(tvb, offset - 1);
return offset;
}
@@ -157,7 +158,7 @@ parse_teredo_orig(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
proto_tree_add_uint(tree, hf_teredo_orig_port, tvb,
offset, 2,
- (guint16)~teredoh->th_orgport);
+ (uint16_t)~teredoh->th_orgport);
}
offset += 2;
@@ -226,7 +227,7 @@ dissect_teredo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
offset, teredoh);
}
- teredoh->th_ip_v_hl = tvb_get_guint8(tvb, offset);
+ teredoh->th_ip_v_hl = tvb_get_uint8(tvb, offset);
decode_teredo_ports(tvb, offset, pinfo, tree, teredoh->th_header /* , teredoh->th_orgport*/);
tap_queue_packet(teredo_tap, pinfo, teredoh);
@@ -234,31 +235,31 @@ dissect_teredo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
}
-static gboolean
+static bool
dissect_teredo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- guint16 val;
+ uint16_t val;
int offset = 0;
if (tvb_captured_length_remaining(tvb, offset) < 40)
- return FALSE;
+ return false;
val = tvb_get_ntohs(tvb, offset);
if (val == 1) /* possible auth header */
{
- guint8 idlen, aulen;
+ uint8_t idlen, aulen;
offset += 2;
- idlen = tvb_get_guint8(tvb, offset);
+ idlen = tvb_get_uint8(tvb, offset);
offset++;
- aulen = tvb_get_guint8(tvb, offset);
+ aulen = tvb_get_uint8(tvb, offset);
offset += 10;
if (tvb_captured_length_remaining(tvb, offset) < idlen + aulen + 40)
- return FALSE;
+ return false;
offset += idlen + aulen;
@@ -270,7 +271,7 @@ dissect_teredo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
offset += 8;
if (tvb_captured_length_remaining(tvb, offset) < 40)
- return FALSE;
+ return false;
val = tvb_get_ntohs(tvb, offset);
}
@@ -289,16 +290,16 @@ dissect_teredo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
offset += 40;
if (val > 65467)
- return FALSE; /* length too big for Teredo */
+ return false; /* length too big for Teredo */
if (tvb_reported_length_remaining(tvb, offset) != val)
- return FALSE; /* length mismatch */
+ return false; /* length mismatch */
dissect_teredo (tvb, pinfo, tree, data);
- return TRUE;
+ return true;
}
- return FALSE; /* not an IPv6 packet */
+ return false; /* not an IPv6 packet */
}
@@ -348,7 +349,7 @@ proto_register_teredo(void)
{ &hf_teredo_orig,
{ "Teredo Origin Indication header", "teredo.orig",
FT_NONE, BASE_NONE, NULL, 0x0,
- "Teredo Origin Indication", HFILL }},
+ NULL, HFILL }},
{ &hf_teredo_orig_port,
{ "Origin UDP port", "teredo.orig.port",
@@ -361,7 +362,7 @@ proto_register_teredo(void)
NULL, HFILL }},
};
- static gint *ett[] = {
+ static int *ett[] = {
&ett_teredo, &ett_teredo_auth, &ett_teredo_orig
};
@@ -379,13 +380,13 @@ proto_register_teredo(void)
prefs_register_obsolete_preference(teredo_module, "heuristic_teredo");
+ teredo_tap = register_tap("teredo");
}
void
proto_reg_handoff_teredo(void)
{
data_handle = find_dissector("ipv6");
- teredo_tap = register_tap("teredo");
dissector_add_uint_with_preference("udp.port", UDP_PORT_TEREDO, teredo_handle);
heur_dissector_add("udp", dissect_teredo_heur, "Teredo over UDP", "teredo_udp", proto_teredo, HEURISTIC_DISABLE);