aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-02-22 09:52:01 +0000
committerGuy Harris <guy@alum.mit.edu>2002-02-22 09:52:01 +0000
commit33620ec7f8473b0d6c517d9a738d6a9d07c47bc0 (patch)
tree5021b1ca8b8cb3d1f525d7418f69a1c4a6d6df8a
parente9bc3da3707e51d56a96bf079b99f577f7c5ae6c (diff)
downloadwireshark-33620ec7f8473b0d6c517d9a738d6a9d07c47bc0.tar.gz
wireshark-33620ec7f8473b0d6c517d9a738d6a9d07c47bc0.tar.bz2
wireshark-33620ec7f8473b0d6c517d9a738d6a9d07c47bc0.zip
From Adam Sulmicki <adam[AT]cfar.umd.edu>:
Add more type values for EAP. Fix off-by-one bug when displaying Code of EAP message. Get rid of an unnecessary "volatile". Give the code and type fields value_string arrays, and use them when putting the code and type into the protocol tree. Base the decision of whether to put the type field into the tree on the request code, not on the length of the packet. Display the Type-Data field, under that name, under the EAP tree, as it's part of the EAP PDU. svn path=/trunk/; revision=4779
-rw-r--r--AUTHORS5
-rw-r--r--doc/ethereal.pod.template1
-rw-r--r--packet-eap.c54
3 files changed, 36 insertions, 24 deletions
diff --git a/AUTHORS b/AUTHORS
index 90522e4cf8..03f837d268 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1044,6 +1044,11 @@ Dermot Bradley <dermot.bradley[AT]openwave.com> {
Support for additional WSP language values
}
+Adam Sulmicki <adam[AT]cfar.umd.edu> {
+ Add more type values for EAP.
+ Fix off-by-one bug when displaying Code of EAP message.
+}
+
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to
give his permission to use his version of snprintf.c.
diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template
index 4edeb1e167..f4c0ed6b49 100644
--- a/doc/ethereal.pod.template
+++ b/doc/ethereal.pod.template
@@ -1384,6 +1384,7 @@ B<http://www.ethereal.com>.
Charlie Duke <cduke[AT]fvc.com>
Alfred Arnold <Alfred.Arnold[AT]elsa.de>
Dermot Bradley <dermot.bradley[AT]openwave.com>
+ Adam Sulmicki <adam[AT]cfar.umd.edu>
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to give his
permission to use his version of snprintf.c.
diff --git a/packet-eap.c b/packet-eap.c
index fa81cbfce6..6796e49a1e 100644
--- a/packet-eap.c
+++ b/packet-eap.c
@@ -1,7 +1,8 @@
/* packet-eap.c
- * Routines for EAP Extensible Authentication Protocol header disassembly
+ * Routines for EAP Extensible Authentication Protocol header disassembly,
+ * RFC 2284
*
- * $Id: packet-eap.c,v 1.7 2002/02/17 00:51:19 guy Exp $
+ * $Id: packet-eap.c,v 1.8 2002/02/22 09:52:00 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -50,20 +51,23 @@ static int hf_eap_type = -1;
static gint ett_eap = -1;
-static dissector_handle_t data_handle;
-
typedef struct _e_eap {
guint8 eap_code;
guint8 eap_id;
guint16 eap_len;
} e_eap;
+#define EAP_REQUEST 1
+#define EAP_RESPONSE 2
+#define EAP_SUCCESS 3
+#define EAP_FAILURE 4
+
static const value_string eap_code_vals[] = {
- { 1, "Request" },
- { 2, "Response" },
- { 3, "Success" },
- { 4, "Failure" },
- { 0, NULL }
+ { EAP_REQUEST, "Request" },
+ { EAP_RESPONSE, "Response" },
+ { EAP_SUCCESS, "Success" },
+ { EAP_FAILURE, "Failure" },
+ { 0, NULL }
};
static const value_string eap_type_vals[] = {
@@ -71,8 +75,9 @@ static const value_string eap_type_vals[] = {
{ 2, "Notification" },
{ 3, "Nak (Response only)" },
{ 4, "MD5-Challenge" },
- { 5, "One-Time Password" },
+ { 5, "One-Time Password (OTP) (RFC 1938)" },
{ 6, "Generic Token Card" },
+ { 13, "EAP/TLS (RFC2716)" },
{ 0, NULL }
};
@@ -82,7 +87,7 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
e_eap eaph;
guint len;
proto_tree *ti;
- proto_tree *volatile eap_tree;
+ proto_tree *eap_tree;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "EAP");
@@ -102,21 +107,23 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(tree, proto_eap, tvb, 0, len, FALSE);
eap_tree = proto_item_add_subtree(ti, ett_eap);
- proto_tree_add_text(eap_tree, tvb, 0, 0, "Code: %s (%u) ",
- val_to_str(eaph.eap_code, eap_code_vals, "Unknown"),
- eaph.eap_code);
+ proto_tree_add_uint(eap_tree, hf_eap_code, tvb, 0, 1, eaph.eap_code);
proto_tree_add_uint(eap_tree, hf_eap_identifier, tvb, 1, 1, eaph.eap_id);
proto_tree_add_uint(eap_tree, hf_eap_len, tvb, 2, 2, eaph.eap_len);
+ }
- if (len > 4) {
- guint8 eap_type = tvb_get_guint8(tvb, 4);
- proto_tree_add_text(eap_tree, tvb, 4, 1, "Type: %s (%u)",
- val_to_str(eap_type, eap_type_vals, "Unknown"),
- eap_type);
+ switch (eaph.eap_code) {
+
+ case EAP_REQUEST:
+ case EAP_RESPONSE:
+ if (tree) {
+ proto_tree_add_item(eap_tree, hf_eap_type, tvb, 4, 1, FALSE);
+ if (len > 5) {
+ proto_tree_add_text(eap_tree, tvb, 5, len - 5, "Type-Data (%d byte%s)",
+ len - 5, plurality(len - 5, "", "s"));
+ }
}
- if (len > 5)
- call_dissector(data_handle,tvb_new_subset(tvb, 5,-1,tvb_reported_length_remaining(tvb,5)), pinfo, tree);
}
}
@@ -126,7 +133,7 @@ proto_register_eap(void)
static hf_register_info hf[] = {
{ &hf_eap_code, {
"Code", "eap.code", FT_UINT8, BASE_DEC,
- NULL, 0x0, "", HFILL }},
+ VALS(eap_code_vals), 0x0, "", HFILL }},
{ &hf_eap_identifier, {
"Id", "eap.id", FT_UINT8, BASE_DEC,
NULL, 0x0, "", HFILL }},
@@ -135,7 +142,7 @@ proto_register_eap(void)
NULL, 0x0, "", HFILL }},
{ &hf_eap_type, {
"Type", "eap.type", FT_UINT8, BASE_DEC,
- NULL, 0x0, "", HFILL }},
+ VALS(eap_type_vals), 0x0, "", HFILL }},
};
static gint *ett[] = {
&ett_eap,
@@ -152,7 +159,6 @@ proto_reg_handoff_eap(void)
{
dissector_handle_t eap_handle;
- data_handle = find_dissector("data");
eap_handle = create_dissector_handle(dissect_eap, proto_eap);
dissector_add("ppp.protocol", PPP_EAP, eap_handle);
}