From 4254cbe7d10a03bb4ab5e1d98cc1c1d25202adee Mon Sep 17 00:00:00 2001 From: hannes Date: Sat, 7 Jun 2003 22:41:31 +0000 Subject: [PATCH] add support for GMPLS related objects as per rfc3473 --- print-rsvp.c | 137 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 108 insertions(+), 29 deletions(-) diff --git a/print-rsvp.c b/print-rsvp.c index 8c915777..b48ad0f7 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -15,7 +15,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.19 2003-05-08 14:52:20 hannes Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.20 2003-06-07 22:41:31 hannes Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -32,6 +32,7 @@ static const char rcsid[] = #include "extract.h" #include "addrtoname.h" #include "ethertype.h" +#include "gmpls.h" /* * RFC 2205 common header @@ -106,36 +107,43 @@ static const struct tok rsvp_msg_type_values[] = { { 0, NULL} }; -#define RSVP_OBJ_SESSION 1 /* rfc2205 */ -#define RSVP_OBJ_RSVP_HOP 3 /* rfc2205 */ +#define RSVP_OBJ_SESSION 1 /* rfc2205 */ +#define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */ #define RSVP_OBJ_INTEGRITY 4 -#define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */ +#define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */ #define RSVP_OBJ_ERROR_SPEC 6 #define RSVP_OBJ_SCOPE 7 -#define RSVP_OBJ_STYLE 8 /* rfc2205 */ -#define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */ -#define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */ +#define RSVP_OBJ_STYLE 8 /* rfc2205 */ +#define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */ +#define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */ #define RSVP_OBJ_SENDER_TEMPLATE 11 -#define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */ -#define RSVP_OBJ_ADSPEC 13 /* rfc2215 */ +#define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */ +#define RSVP_OBJ_ADSPEC 13 /* rfc2215 */ #define RSVP_OBJ_POLICY_DATA 14 -#define RSVP_OBJ_CONFIRM 15 /* rfc2205 */ -#define RSVP_OBJ_LABEL 16 /* rfc3209 */ -#define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */ -#define RSVP_OBJ_ERO 20 /* rfc3209 */ -#define RSVP_OBJ_RRO 21 /* rfc3209 */ -#define RSVP_OBJ_HELLO 22 /* rfc3209 */ +#define RSVP_OBJ_CONFIRM 15 /* rfc2205 */ +#define RSVP_OBJ_LABEL 16 /* rfc3209 */ +#define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */ +#define RSVP_OBJ_ERO 20 /* rfc3209 */ +#define RSVP_OBJ_RRO 21 /* rfc3209 */ +#define RSVP_OBJ_HELLO 22 /* rfc3209 */ #define RSVP_OBJ_MESSAGE_ID 23 #define RSVP_OBJ_MESSAGE_ID_ACK 24 #define RSVP_OBJ_MESSAGE_ID_LIST 25 -#define RSVP_OBJ_RECOVERY_LABEL 34 -#define RSVP_OBJ_UPSTREAM_LABEL 35 +#define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */ +#define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */ +#define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */ +#define RSVP_OBJ_PROTECTION 37 /* rfc3473 */ #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */ -#define RSVP_OBJ_SUGGESTED_LABEL 129 -#define RSVP_OBJ_PROPERTIES 204 +#define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */ +#define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */ +#define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */ +#define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */ +#define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */ +#define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */ #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */ #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */ -#define RSVP_OBJ_RESTART_CAPABILITY 131 /* draft-pan-rsvp-te-restart */ +#define RSVP_OBJ_CALL_ID 230 /* rfc3474 */ +#define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */ static const struct tok rsvp_obj_values[] = { { RSVP_OBJ_SESSION, "Session" }, @@ -162,12 +170,19 @@ static const struct tok rsvp_obj_values[] = { { RSVP_OBJ_MESSAGE_ID_LIST, "Message ID List" }, { RSVP_OBJ_RECOVERY_LABEL, "Recovery Label" }, { RSVP_OBJ_UPSTREAM_LABEL, "Upstream Label" }, + { RSVP_OBJ_LABEL_SET, "Label Set" }, + { RSVP_OBJ_ACCEPT_LABEL_SET, "Acceptable Label Set" }, { RSVP_OBJ_DETOUR, "Detour" }, { RSVP_OBJ_SUGGESTED_LABEL, "Suggested Label" }, { RSVP_OBJ_PROPERTIES, "Properties" }, { RSVP_OBJ_FASTREROUTE, "Fast Re-Route" }, { RSVP_OBJ_SESSION_ATTRIBUTE, "Session Attribute" }, + { RSVP_OBJ_CALL_ID, "Call-ID" }, + { RSVP_OBJ_CALL_OPS, "Call Capability" }, { RSVP_OBJ_RESTART_CAPABILITY, "Restart Capability" }, + { RSVP_OBJ_NOTIFY_REQ, "Notify Request" }, + { RSVP_OBJ_PROTECTION, "Protection" }, + { RSVP_OBJ_ADMIN_STATUS, "Administrative Status" }, { 0, NULL} }; @@ -178,6 +193,7 @@ static const struct tok rsvp_obj_values[] = { #define RSVP_CTYPE_1 1 #define RSVP_CTYPE_2 2 #define RSVP_CTYPE_3 3 +#define RSVP_CTYPE_4 4 /* * the ctypes are not globally unique so for @@ -188,6 +204,10 @@ static const struct tok rsvp_obj_values[] = { static const struct tok rsvp_ctype_values[] = { { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_IPV4, "IPv4" }, { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_IPV6, "IPv6" }, + { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_3, "IPv4 plus opt. TLVs" }, + { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_4, "IPv6 plus opt. TLVs" }, + { 256*RSVP_OBJ_NOTIFY_REQ+RSVP_CTYPE_IPV4, "IPv4" }, + { 256*RSVP_OBJ_NOTIFY_REQ+RSVP_CTYPE_IPV6, "IPv6" }, { 256*RSVP_OBJ_CONFIRM+RSVP_CTYPE_IPV4, "IPv4" }, { 256*RSVP_OBJ_CONFIRM+RSVP_CTYPE_IPV6, "IPv6" }, { 256*RSVP_OBJ_TIME_VALUES+RSVP_CTYPE_1, "1" }, @@ -211,11 +231,19 @@ static const struct tok rsvp_ctype_values[] = { { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_1, "without label range" }, { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_2, "with ATM label range" }, { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_3, "with FR label range" }, + { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_4, "generalized" }, { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_1, "1" }, + { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_3, "Waveband Switching" }, + { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_1, "1" }, + { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_3, "Waveband Switching" }, + { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_1, "1" }, + { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_3, "Waveband Switching" }, { 256*RSVP_OBJ_ERO+RSVP_CTYPE_IPV4, "IPv4" }, { 256*RSVP_OBJ_RRO+RSVP_CTYPE_IPV4, "IPv4" }, { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_IPV4, "IPv4" }, { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_IPV6, "IPv6" }, + { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_3, "IPv4 plus opt. TLVs" }, + { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_4, "IPv6 plus opt. TLVs" }, { 256*RSVP_OBJ_RESTART_CAPABILITY+RSVP_CTYPE_1, "IPv4" }, { 256*RSVP_OBJ_SESSION_ATTRIBUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" }, { 256*RSVP_OBJ_FASTREROUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" }, @@ -615,15 +643,46 @@ rsvp_print(register const u_char *pptr, register u_int len) { } break; + case RSVP_OBJ_NOTIFY_REQ: + switch(rsvp_obj_ctype) { + case RSVP_CTYPE_IPV4: + printf("\n\t IPv4 Notify Node Address %s", + ipaddr_string(obj_tptr)); + obj_tlen-=4; + obj_tptr+=4; + break; +#ifdef INET6 + case RSVP_CTYPE_IPV6: + printf("\n\t IPv6 Notify Node Address %s", + ip6addr_string(obj_tptr)); + obj_tlen-=16; + obj_tptr+=16; + break; +#endif + default: + hexdump=TRUE; + } + break; + + case RSVP_OBJ_SUGGESTED_LABEL: /* fall through */ + case RSVP_OBJ_UPSTREAM_LABEL: /* fall through */ case RSVP_OBJ_LABEL: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { - printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr)); + printf("\n\t Label %u", EXTRACT_32BITS(obj_tptr)); obj_tlen-=4; obj_tptr+=4; } break; + case RSVP_CTYPE_3: + printf("\n\t Waveband ID %u\n\t Start Label %u, Stop Label %u", + EXTRACT_32BITS(obj_tptr), + EXTRACT_32BITS(obj_tptr+4), + EXTRACT_32BITS(obj_tptr+8)); + obj_tlen-=16; + obj_tptr+=16; + break; default: hexdump=TRUE; } @@ -679,18 +738,18 @@ rsvp_print(register const u_char *pptr, register u_int len) { switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { - printf("\n\t L3 Protocol ID: %s", + printf("\n\t L3 Protocol ID %s", tok2str(ethertype_values, - "Unknown Protocol 0x%04x", + "Unknown Protocol (0x%04x)", EXTRACT_16BITS(obj_tptr+2))); obj_tlen-=4; obj_tptr+=4; } break; case RSVP_CTYPE_2: - printf("\n\t L3 Protocol ID: %s", + printf("\n\t L3 Protocol ID %s", tok2str(ethertype_values, - "Unknown Protocol 0x%04x", + "Unknown Protocol (0x%04x)", EXTRACT_16BITS(obj_tptr+2))); printf(",%s merge capability",((*(obj_tptr+4))&0x80) ? "no" : "" ); printf("\n\t Minimum VPI/VCI %u/%u", @@ -703,9 +762,9 @@ rsvp_print(register const u_char *pptr, register u_int len) { obj_tptr+=12; break; case RSVP_CTYPE_3: - printf("\n\t L3 Protocol ID: %s", + printf("\n\t L3 Protocol ID %s", tok2str(ethertype_values, - "Unknown Protocol 0x%04x", + "Unknown Protocol (0x%04x)", EXTRACT_16BITS(obj_tptr+2))); printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI", (EXTRACT_32BITS(obj_tptr+4))&0x7fffff, @@ -715,6 +774,21 @@ rsvp_print(register const u_char *pptr, register u_int len) { obj_tlen-=12; obj_tptr+=12; break; + case RSVP_CTYPE_4: + printf("\n\t LSP Encoding Type %s", + tok2str(gmpls_encoding_values, + "Unknown (0x%02x)", + *obj_tptr)); + printf("\n\t Switching Type %s, Payload ID %s", + tok2str(gmpls_switch_cap_values, + "Unknown (0x%02x)", + *(obj_tptr+1)), + tok2str(gmpls_payload_values, + "Unknown (0x%04x)", + EXTRACT_16BITS(obj_tptr+2))); + obj_tlen-=8; + obj_tptr+=8; + break; default: hexdump=TRUE; } @@ -796,6 +870,7 @@ rsvp_print(register const u_char *pptr, register u_int len) { case RSVP_OBJ_RSVP_HOP: switch(rsvp_obj_ctype) { + case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV4: printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", ipaddr_string(obj_tptr), @@ -804,6 +879,7 @@ rsvp_print(register const u_char *pptr, register u_int len) { obj_tptr+=8; break; #ifdef INET6 + case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV6: printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", ip6addr_string(obj_tptr), @@ -950,6 +1026,7 @@ rsvp_print(register const u_char *pptr, register u_int len) { case RSVP_OBJ_ERROR_SPEC: switch(rsvp_obj_ctype) { + case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV4: error_code=*(obj_tptr+5); error_value=EXTRACT_16BITS(obj_tptr+6); @@ -970,6 +1047,7 @@ rsvp_print(register const u_char *pptr, register u_int len) { } break; #ifdef INET6 + case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV6: error_code=*(obj_tptr+17); error_value=EXTRACT_16BITS(obj_tptr+18); @@ -1033,8 +1111,9 @@ rsvp_print(register const u_char *pptr, register u_int len) { case RSVP_OBJ_MESSAGE_ID_ACK: case RSVP_OBJ_MESSAGE_ID_LIST: case RSVP_OBJ_RECOVERY_LABEL: - case RSVP_OBJ_UPSTREAM_LABEL: - case RSVP_OBJ_SUGGESTED_LABEL: + case RSVP_OBJ_LABEL_SET: + case RSVP_OBJ_ACCEPT_LABEL_SET: + case RSVP_OBJ_PROTECTION: default: if (vflag <= 1) print_unknown_data(obj_tptr,"\n\t ",obj_tlen); -- 2.39.5