From 3a0b573c9c3517a6214d073095f8dcc261501d3d Mon Sep 17 00:00:00 2001 From: Ashok Narayanan Date: Wed, 26 Dec 2001 22:32:57 +0000 Subject: Added support for Generalized MPLS (GMPLS) to RSVP svn path=/trunk/; revision=4452 --- packet-rsvp.c | 426 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 406 insertions(+), 20 deletions(-) (limited to 'packet-rsvp.c') diff --git a/packet-rsvp.c b/packet-rsvp.c index a79dba9d3f..1f1f39d981 100644 --- a/packet-rsvp.c +++ b/packet-rsvp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan * - * $Id: packet-rsvp.c,v 1.49 2001/12/10 00:25:33 guy Exp $ + * $Id: packet-rsvp.c,v 1.50 2001/12/26 22:32:57 ashokn Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -66,6 +66,7 @@ # include "snprintf.h" #endif +#include "tvbuff.h" #include "packet.h" #include "in_cksum.h" #include "ieee-float.h" @@ -100,6 +101,7 @@ static gint ett_rsvp_explicit_route = -1; static gint ett_rsvp_explicit_route_subobj = -1; static gint ett_rsvp_record_route = -1; static gint ett_rsvp_record_route_subobj = -1; +static gint ett_rsvp_hop_subobj = -1; static gint ett_rsvp_unknown_class = -1; @@ -165,12 +167,18 @@ enum rsvp_classes { RSVP_CLASS_EXPLICIT_ROUTE, RSVP_CLASS_RECORD_ROUTE, - RSVP_CLASS_MESSAGE_ID = 23, + RSVP_CLASS_HELLO, + + RSVP_CLASS_MESSAGE_ID, RSVP_CLASS_MESSAGE_ID_ACK, RSVP_CLASS_MESSAGE_ID_LIST, - RSVP_CLASS_SESSION_ATTRIBUTE=207, - RSVP_CLASS_HELLO = 22 + RSVP_CLASS_UPSTREAM_LABEL, /* Number is TBA */ + RSVP_CLASS_LABEL_SET, /* Number is TBA */ + + RSVP_CLASS_SUGGESTED_LABEL = 140, /* Number is TBA */ + + RSVP_CLASS_SESSION_ATTRIBUTE = 207, }; static value_string rsvp_class_vals[] = { @@ -198,6 +206,9 @@ static value_string rsvp_class_vals[] = { {RSVP_CLASS_MESSAGE_ID_ACK, "MESSAGE-ID ACK/NACK object"}, {RSVP_CLASS_MESSAGE_ID_LIST, "MESSAGE-ID LIST object"}, {RSVP_CLASS_HELLO, "HELLO object"}, + {RSVP_CLASS_UPSTREAM_LABEL, "UPSTREAM-LABEL object"}, + {RSVP_CLASS_LABEL_SET, "LABEL-SET object"}, + {RSVP_CLASS_SUGGESTED_LABEL, "SUGGESTED-LABEL object"}, {0, NULL} }; @@ -341,6 +352,71 @@ static value_string adspec_params[] = { { 0, NULL } }; +static const value_string gmpls_lsp_enc_str[] = { + { 1, "Packet"}, + { 2, "Ethernet v2/DIX"}, + { 3, "ANSI PDH"}, + { 4, "ETSI PDH"}, + { 5, "SDH ITU-T G.707"}, + { 6, "SONET ANSI T1.105"}, + { 7, "Digital Wrapper"}, + { 8, "Lambda (photonic)"}, + { 9, "Fiber"}, + {10, "Ethernet 802.3"}, + {11, "FiberChannel"}, + { 0, NULL } +}; + +static const value_string gmpls_switching_type_str[] = { + { 1, "Packet-Switch Capable-1 (PSC-1)"}, + { 2, "Packet-Switch Capable-2 (PSC-2)"}, + { 3, "Packet-Switch Capable-3 (PSC-3)"}, + { 4, "Packet-Switch Capable-4 (PSC-4)"}, + { 51, "Layer-2 Switch Capable (L2SC)"}, + {100, "Time-Division-Multiplex Capable (TDM)"}, + {150, "Lambda-Switch Capable (LSC)"}, + {200, "Fiber-Switch Capable (FSC)"}, + { 0, NULL } +}; + +static const value_string gmpls_gpid_str[] = { + { 5, "Asynchronous mapping of E3 (SONET, SDH)"}, + { 8, "Bit synchronous mapping of E3 (SDH)"}, + { 9, "Byte synchronous mapping of E3 (SDH)"}, + {10, "Asynchronous mapping of DS2/T2 (SONET, SDH)"}, + {11, "Bit synchronous mapping of DS2/T2 (SONET, SDH)"}, + {13, "Asynchronous mapping of E1 (SONET, SDH)"}, + {14, "Byte synchronous mapping of E1 (SONET, SDH)"}, + {15, "Byte synchronous mapping of 31 * DS0 (SONET, SDH)"}, + {16, "Asynchronous mapping of DS1/T1 (SONET, SDH)"}, + {17, "Bit synchronous mapping of DS1/T1 (SONET, SDH)"}, + {18, "Byte synchronous mapping of DS1/T1 (SONET, SDH)"}, + {19, "VC-11 in VC-12 (SDH)"}, + {22, "DS1 SF Asynchronous (SONET)"}, + {23, "DS1 ESF Asynchronous (SONET)"}, + {24, "DS3 M23 Asynchronous (SONET)"}, + {25, "DS3 C-Bit Parity Asynchronous (SONET)"}, + {26, "VT/LOVC (SONET, SDH)"}, + {27, "STS SPE/HOVC (SONET, SDH)"}, + {28, "POS - No Scrambling, 16 bit CRC (SONET, SDH)"}, + {29, "POS - No Scrambling, 32 bit CRC (SONET, SDH)"}, + {30, "POS - Scrambling, 16 bit CRC (SONET, SDH)"}, + {31, "POS - Scrambling, 32 bit CRC (SONET, SDH)"}, + {32, "ATM Mapping (SONET, SDH)"}, + {33, "Ethernet (SDH, Lambda, Fiber)"}, + {34, "SDH (Lambda, Fiber)"}, + {35, "SONET (Lambda, Fiber)"}, + {36, "Digital Wrapper (Lambda, Fiber)"}, + {37, "Lambda (Fiber)"}, + {38, "ETSI PDH (SDH)"}, + {39, "ANSI PDH (SONET, SDH)"}, + {40, "Link Access Protocol SDH: LAPS - X.85 and X.86 (SONET, SDH)"}, + {41, "FDDI (SONET, SDH, Lambda, Fiber)"}, + {42, "DQDB: ETSI ETS 300 216 (SONET, SDH)"}, + {43, "FiberChannel-3 Services (FiberChannel)"}, + { 0, NULL }, +}; + /* -------------------- Stuff for MPLS/TE objects -------------------- */ static const value_string proto_vals[] = { {IP_PROTO_ICMP, "ICMP"}, @@ -396,11 +472,14 @@ enum rsvp_filter_keys { RSVPF_LABEL_REQUEST, RSVPF_EXPLICIT_ROUTE, RSVPF_RECORD_ROUTE, - RSVPF_DUMMY_4, + RSVPF_HELLO_OBJ, RSVPF_MESSAGE_ID, RSVPF_MESSAGE_ID_ACK, RSVPF_MESSAGE_ID_LIST, - RSVPF_HELLO_OBJ, + RSVPF_UPSTREAM_LABEL, + RSVPF_LABEL_SET, + + RSVPF_SUGGESTED_LABEL, RSVPF_SESSION_ATTRIBUTE, RSVPF_UNKNOWN_OBJ, @@ -536,6 +615,18 @@ static hf_register_info rsvpf_info[] = { { "LABEL", "rsvp.label", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }}, + {&rsvp_filter[RSVPF_UPSTREAM_LABEL], + { "UPSTREAM LABEL", "rsvp.upstream_label", FT_NONE, BASE_NONE, NULL, 0x0, + "", HFILL }}, + + {&rsvp_filter[RSVPF_SUGGESTED_LABEL], + { "SUGGESTED LABEL", "rsvp.suggested_label", FT_NONE, BASE_NONE, NULL, 0x0, + "", HFILL }}, + + {&rsvp_filter[RSVPF_LABEL_SET], + { "RESTRICTED LABEL SET", "rsvp.label_set", FT_NONE, BASE_NONE, NULL, 0x0, + "", HFILL }}, + {&rsvp_filter[RSVPF_LABEL_REQUEST], { "LABEL REQUEST", "rsvp.label_request", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }}, @@ -625,7 +716,10 @@ static inline int rsvp_class_to_filter_num(int classnum) case RSVP_CLASS_POLICY : case RSVP_CLASS_CONFIRM : case RSVP_CLASS_LABEL : + case RSVP_CLASS_UPSTREAM_LABEL : + case RSVP_CLASS_LABEL_SET : case RSVP_CLASS_LABEL_REQUEST : + case RSVP_CLASS_HELLO : case RSVP_CLASS_EXPLICIT_ROUTE : case RSVP_CLASS_RECORD_ROUTE : case RSVP_CLASS_MESSAGE_ID : @@ -633,10 +727,10 @@ static inline int rsvp_class_to_filter_num(int classnum) case RSVP_CLASS_MESSAGE_ID_LIST : return classnum + RSVPF_OBJECT; break; - case RSVP_CLASS_HELLO : - return RSVPF_HELLO_OBJ; - break; + case RSVP_CLASS_SUGGESTED_LABEL : + return RSVPF_SUGGESTED_LABEL; + case RSVP_CLASS_SESSION_ATTRIBUTE : return RSVPF_SESSION_ATTRIBUTE; @@ -654,6 +748,7 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *rsvp_object_tree; proto_tree *rsvp_sa_flags_tree; proto_tree *rsvp_ero_subtree; + proto_tree *rsvp_hop_subtree; guint8 ver_flags; guint8 message_type; guint16 cksum, computed_cksum; @@ -866,6 +961,78 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } + case 3: { + guint16 tlv_off; + guint16 tlv_type; + guint16 tlv_len; + proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, + "C-type: 3 - IPv4 Out-Of-Band"); + proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4, + "Neighbor address: %s", + ip_to_str(tvb_get_ptr(tvb, offset2, 4))); + proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 4, + "Logical interface: %u", + tvb_get_ntohl(tvb, offset2+4)); + + for (tlv_off = 0; tlv_off < mylen - 8; ) { + tlv_type = tvb_get_ntohs(tvb, offset2+8+tlv_off); + tlv_len = tvb_get_ntohs(tvb, offset2+8+tlv_off+2); + switch(tlv_type) { + case 1: + ti2 = proto_tree_add_text(rsvp_object_tree, tvb, + offset2+8+tlv_off, 8, + "IPv4 TLV - %s", + ip_to_str(tvb_get_ptr(tvb, offset2+8+tlv_off+4, 4))); + rsvp_hop_subtree = + proto_item_add_subtree(ti2, ett_rsvp_hop_subobj); + proto_tree_add_text(rsvp_hop_subtree, tvb, offset2+8+tlv_off, 2, + "Type: 1 (IPv4)"); + proto_tree_add_text(rsvp_hop_subtree, tvb, offset2+8+tlv_off+2, 2, + "Length: %u", + tvb_get_ntohs(tvb, offset2+8+tlv_off+2)); + proto_tree_add_text(rsvp_hop_subtree, tvb, offset2+8+tlv_off+4, 4, + "IPv4 address: %s", + ip_to_str(tvb_get_ptr(tvb, offset2+8+tlv_off+4, 4))); + proto_item_set_text(ti, "HOP: Out-of-band. Control IPv4: %s. Data IPv4: %s", + ip_to_str(tvb_get_ptr(tvb, offset2, 4)), + ip_to_str(tvb_get_ptr(tvb, offset2+8+tlv_off+4, 4))); + break; + + case 3: + ti2 = proto_tree_add_text(rsvp_object_tree, tvb, + offset2+8+tlv_off, 12, + "Interface-Index TLV - %s, %d", + ip_to_str(tvb_get_ptr(tvb, offset2+8+tlv_off+4, 4)), + tvb_get_ntohl(tvb, offset2+8+tlv_off+8)); + rsvp_hop_subtree = + proto_item_add_subtree(ti2, ett_rsvp_hop_subobj); + proto_tree_add_text(rsvp_hop_subtree, tvb, offset2+8+tlv_off, 2, + "Type: 3 (Interface Index)"); + proto_tree_add_text(rsvp_hop_subtree, tvb, offset2+8+tlv_off+2, 2, + "Length: %u", + tvb_get_ntohs(tvb, offset2+8+tlv_off+2)); + proto_tree_add_text(rsvp_hop_subtree, tvb, offset2+8+tlv_off+4, 4, + "IPv4 address: %s", + ip_to_str(tvb_get_ptr(tvb, offset2+8+tlv_off+4, 4))); + proto_tree_add_text(rsvp_hop_subtree, tvb, offset2+8+tlv_off+8, 4, + "Interface-ID: %d", + tvb_get_ntohl(tvb, offset2+8+tlv_off+8)); + proto_item_set_text(ti, "HOP: Out-of-band. Control IPv4: %s. Data If-Index: %s, %d", + ip_to_str(tvb_get_ptr(tvb, offset2, 4)), + ip_to_str(tvb_get_ptr(tvb, offset2+8+tlv_off+4, 4)), + tvb_get_ntohl(tvb, offset2+8+tlv_off+8)); + break; + + default: + proto_tree_add_text(rsvp_object_tree, tvb, offset2+4, 4, + "Logical interface: %u", + tvb_get_ntohl(tvb, offset2+4)); + } + tlv_off += tlv_len; + } + break; + } + default: { proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, "C-type: Unknown (%u)", @@ -931,12 +1098,12 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) error_code = tvb_get_guint8(tvb, offset2+5); proto_tree_add_text(rsvp_object_tree, tvb, offset2+5, 1, "Error code: %u - %s", error_code, - val_to_str(error_code, rsvp_error_vals, "Unknown")); + val_to_str(error_code, rsvp_error_vals, "Unknown (%d)")); proto_tree_add_text(rsvp_object_tree, tvb, offset2+6, 2, "Error value: %u", tvb_get_ntohs(tvb, offset2+6)); - proto_item_set_text(ti, "ERROR: IPv4, %d, %d, %s", - tvb_get_guint8(tvb, offset2+5), + proto_item_set_text(ti, "ERROR: IPv4, %s, %d, %s", + val_to_str(error_code, rsvp_error_vals, "Unknown (%d)"), tvb_get_ntohs(tvb, offset2+6), ip_to_str(tvb_get_ptr(tvb, offset2, 4))); break; @@ -1546,6 +1713,35 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } + case 4: { + unsigned short l3pid = tvb_get_ntohs(tvb, offset2+2); + unsigned char lsp_enc = tvb_get_guint8(tvb,offset2); + proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, + "C-type: 4 (Generalized Label Request)"); + proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1, + "LSP Encoding Type: %s", + val_to_str(lsp_enc, gmpls_lsp_enc_str, "Unknown (%d)")); + proto_tree_add_text(rsvp_object_tree, tvb, offset2+1, 1, + "Switching Type: %s", + val_to_str(tvb_get_guint8(tvb,offset2+1), + gmpls_switching_type_str, "Unknown (%d)")); + proto_tree_add_text(rsvp_object_tree, tvb, offset2+2, 2, + "G-PID: %s (0x%0x)", + val_to_str(l3pid, gmpls_gpid_str, + val_to_str(l3pid, etype_vals, + "Unknown G-PID(0x%04x)")), + l3pid); + proto_item_set_text(ti, "LABEL REQUEST: Generalized: LSP Encoding=%s, " + "Switching Type=%s, G-PID=%s ", + val_to_str(lsp_enc, gmpls_lsp_enc_str, "Unknown (%d)"), + val_to_str(tvb_get_guint8(tvb,offset2+1), + gmpls_switching_type_str, "Unknown (%d)"), + val_to_str(l3pid, gmpls_gpid_str, + val_to_str(l3pid, etype_vals, + "Unknown (0x%04x)"))); + break; + } + default: { proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, "C-type: Unknown (%u)", @@ -1557,7 +1753,13 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } break; - case RSVP_CLASS_LABEL : + case RSVP_CLASS_UPSTREAM_LABEL : + case RSVP_CLASS_SUGGESTED_LABEL : + case RSVP_CLASS_LABEL : { + char *name; + name = (class==RSVP_CLASS_SUGGESTED_LABEL ? "SUGGESTED LABEL" : + (class==RSVP_CLASS_UPSTREAM_LABEL ? "UPSTREAM LABEL" : + "LABEL")); rsvp_object_tree = proto_item_add_subtree(ti, ett_rsvp_label); proto_tree_add_text(rsvp_object_tree, tvb, offset, 2, "Length: %u", obj_length); @@ -1568,15 +1770,34 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch(type) { case 1: { proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, - "C-type: 1"); + "C-type: 1 (Packet Label)"); proto_tree_add_text(rsvp_object_tree, tvb, offset2, 4, "Label: %u", tvb_get_ntohl(tvb, offset2)); - proto_item_set_text(ti, "LABEL: %d", + proto_item_set_text(ti, "%s: %d", name, tvb_get_ntohl(tvb, offset2)); break; } + case 2: { + proto_tree_add_text(rsvp_object_tree, tvb, offset+3, 1, + "C-type: 2 (Generalized Label)"); + proto_item_set_text(ti, "%s: Generalized: ", name); + for (i = 0; i < mylen; i += 4) { + proto_tree_add_text(rsvp_object_tree, tvb, offset2+i, 4, + "Generalized Label: %u", + tvb_get_ntohl(tvb, offset2+i)); + if (i < 16) { + proto_item_append_text(ti, "%d%s", + tvb_get_ntohl(tvb, offset2+i), + i+4