Ethereal-dev: [Ethereal-dev] L2TP AVP decoding correction
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Date: Sun, 14 Oct 2001 02:12:11 +0900 (JST)
Hi, Current packet-l2tp.c doesn't take the Vendor-Specific Attribute into consideration. Attribute Type is only meaningful in a given Vendor ID context. For example, Attribute Type 7 is a "Host Name" AVP in IETF (i.e. Vendor ID = 0) context , but Attribute Type 7 can be something totally different in other Vendor-Specific context. Here's a patch to packet-l2tp.c so that 1) it decodes all currently-supported Attribute Types only if it's under IETF context. 2) If the attribute is Vendor-Specific, print the Vendor Name (if possible) and simply indicate that it's a Vendor-Specific attribute (no further decoding for the time being). Regards, =--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= +----+----+ |.. .| | Motonori Shindo |_~__| | | .. |~~_~| Sr. Systems Engineer | . | | CoSine Communications Inc. +----+----+ C o S i n e e-mail: mshindo@xxxxxxxxxxxxx Communications =--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
Index: packet-l2tp.c =================================================================== RCS file: /cvsroot/ethereal/packet-l2tp.c,v retrieving revision 1.24 diff -u -r1.24 packet-l2tp.c --- packet-l2tp.c 2001/06/18 02:17:48 1.24 +++ packet-l2tp.c 2001/10/13 17:16:50 @@ -261,6 +261,39 @@ { 0, NULL } }; +/* + * These are SMI Network Management Private Enterprise Codes for + * organizations; see + * + * http://www.isi.edu/in-notes/iana/assignments/enterprise-numbers + * + * for a list. + */ +#define VENDOR_IETF 0 +#define VENDOR_ACC 5 +#define VENDOR_CISCO 9 +#define VENDOR_SHIVA 166 +#define VENDOR_LIVINGSTON 307 +#define VENDOR_3COM 429 +#define VENDOR_ASCEND 529 +#define VENDOR_BAY 1584 +#define VENDOR_JUNIPER 2636 +#define VENDOR_COSINE 3085 +#define VENDOR_UNISPHERE 4874 + +static const value_string avp_vendor_id_vals[] = +{{VENDOR_IETF,"IETF"}, +{VENDOR_ACC,"ACC"}, +{VENDOR_CISCO,"Cisco"}, +{VENDOR_SHIVA,"Shiva"}, +{VENDOR_LIVINGSTON,"Livingston"}, +{VENDOR_3COM,"3Com"}, +{VENDOR_ASCEND,"Ascend"}, +{VENDOR_BAY,"Bay Networks"}, +{VENDOR_JUNIPER,"Juniper Networks"}, +{VENDOR_COSINE,"CoSine Communications"}, +{VENDOR_UNISPHERE,"Unisphere Networks"}, +{0,NULL}}; static gchar textbuffer[200]; @@ -280,6 +313,7 @@ guint16 cid; /* Call ID */ guint16 offset_size; /* Offset size */ guint16 ver_len_hidden; + guint16 avp_vendor_id; guint16 avp_type; guint16 msg_type; guint16 avp_len; @@ -446,11 +480,19 @@ while (index < length ) { /* Process AVP's */ ver_len_hidden = tvb_get_ntohs(tvb, index); avp_len = AVP_LENGTH(ver_len_hidden); + avp_vendor_id = tvb_get_ntohs(tvb, index + 2); avp_type = tvb_get_ntohs(tvb, index + 4); - tf = proto_tree_add_text(l2tp_tree, tvb, index, avp_len, - "%s AVP", - val_to_str(avp_type, avp_type_vals, "Unknown (%u)")); + if (avp_vendor_id == VENDOR_IETF) { + tf = proto_tree_add_text(l2tp_tree, tvb, index, + avp_len, "%s AVP", + val_to_str(avp_type, avp_type_vals, "Unknown (%u)")); + } else { /* Vendor-Specific AVP */ + tf = proto_tree_add_text(l2tp_tree, tvb, index, + avp_len, "Vendor %s AVP", + val_to_str(avp_vendor_id, avp_vendor_id_vals, "Unknown (%u)")); + } + l2tp_avp_tree = proto_item_add_subtree(tf, ett_l2tp_avp); proto_tree_add_boolean_format(l2tp_avp_tree,hf_l2tp_avp_mandatory, tvb, index, 1, @@ -479,6 +521,21 @@ index += 2; avp_len -= 2; + if (avp_vendor_id != VENDOR_IETF) { + proto_tree_add_text(l2tp_avp_tree, tvb, index, 2, + "Type: %u", avp_type); + index += 2; + avp_len -= 2; + + /* For the time being, we don't decode any Vendor- + specific AVP. */ + proto_tree_add_text(l2tp_avp_tree, tvb, index, + avp_len, "Vendor-Specific AVP"); + + index += avp_len; + continue; + } + proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_avp_type, tvb, index, 2, avp_type); index += 2; @@ -947,7 +1004,7 @@ "AVP Length", HFILL }}, { &hf_l2tp_avp_vendor_id, - { "Vendor ID", "lt2p.avp.vendor_id", FT_UINT16, BASE_DEC, NULL, 0, + { "Vendor ID", "lt2p.avp.vendor_id", FT_UINT16, BASE_DEC, VALS(avp_vendor_id_vals), 0, "AVP Vendor ID", HFILL }}, { &hf_l2tp_avp_type,
- Follow-Ups:
- Re: [Ethereal-dev] L2TP AVP decoding correction
- From: Guy Harris
- Re: [Ethereal-dev] L2TP AVP decoding correction
- Prev by Date: Re: [Ethereal-dev] too long arguments passed from Makefile.nmake
- Next by Date: [Ethereal-dev] Ethereal in the press
- Previous by thread: Re: [Ethereal-dev] A new user guide with A4 and US Letter PDFsreleased
- Next by thread: Re: [Ethereal-dev] L2TP AVP decoding correction
- Index(es):