#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.28 2004-07-16 00:13:51 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.35 2005-04-25 19:28:30 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
#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_CLASSTYPE 125 /* draft-ietf-tewg-diff-te-proto-07 */
#define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
#define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
#define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
{ RSVP_OBJ_LABEL_SET, "Label Set" },
{ RSVP_OBJ_ACCEPT_LABEL_SET, "Acceptable Label Set" },
{ RSVP_OBJ_DETOUR, "Detour" },
+ { RSVP_OBJ_CLASSTYPE, "Class Type" },
{ RSVP_OBJ_SUGGESTED_LABEL, "Suggested Label" },
{ RSVP_OBJ_PROPERTIES, "Properties" },
{ RSVP_OBJ_FASTREROUTE, "Fast Re-Route" },
{ 256*RSVP_OBJ_FASTREROUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
{ 256*RSVP_OBJ_DETOUR+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
{ 256*RSVP_OBJ_PROPERTIES+RSVP_CTYPE_1, "1" },
+ { 256*RSVP_OBJ_CLASSTYPE+RSVP_CTYPE_1, "1" },
{ 0, NULL}
};
#define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
#define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
+#define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 125
static struct tok rsvp_obj_error_code_values[] = {
{ RSVP_OBJ_ERROR_SPEC_CODE_ROUTING, "Routing Problem" },
{ RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY, "Notify Error" },
+ { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE, "Diffserv TE Error" },
{ 0, NULL}
};
{ 0, NULL}
};
+static struct tok rsvp_obj_error_code_diffserv_te_values[] = {
+ { 1, "Unexpected CLASSTYPE object" },
+ { 2, "Unsupported Class-Type" },
+ { 3, "Invalid Class-Type value" },
+ { 4, "Class-Type and setup priority do not form a configured TE-Class" },
+ { 5, "Class-Type and holding priority do not form a configured TE-Class" },
+ { 6, "Inconsistency between signaled PSC and signaled Class-Type" },
+ { 7, "Inconsistency between signaled PHBs and signaled Class-Type" },
+ { 0, NULL}
+};
+
#define FALSE 0
#define TRUE 1
}
static int
-rsvp_obj_print (const u_char *tptr, const u_char *ident, u_int tlen) {
+rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
const struct rsvp_object_header *rsvp_obj_header;
const u_char *obj_tptr;
rsvp_obj_ctype=rsvp_obj_header->ctype;
if(rsvp_obj_len % 4 || rsvp_obj_len < sizeof(struct rsvp_object_header)) {
- printf("ERROR: object header too short %u < %u", rsvp_obj_len, sizeof(const struct rsvp_object_header));
+ printf("%sERROR: object header too short %u < %lu", ident, rsvp_obj_len,
+ (unsigned long)sizeof(const struct rsvp_object_header));
return -1;
}
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
while(obj_tlen >= 4 ) {
- printf("%s Subobject Type: %s",
+ printf("%s Subobject Type: %s, length %u",
ident,
tok2str(rsvp_obj_xro_values,
"Unknown %u",
- RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)));
+ RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)),
+ *(obj_tptr+1));
+
+ if (*(obj_tptr+1) == 0) { /* prevent infinite loops */
+ printf("%s ERROR: zero length ERO subtype",ident);
+ break;
+ }
+
switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)) {
case RSVP_OBJ_XRO_IPV4:
printf(", %s, %s/%u, Flags: [%s]",
return-1;
printf("%s Restart Time: %ums, Recovery Time: %ums",
ident,
- EXTRACT_16BITS(obj_tptr),
- EXTRACT_16BITS(obj_tptr+4));
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr+4));
obj_tlen-=8;
obj_tptr+=8;
break;
}
break;
+ case RSVP_OBJ_CLASSTYPE:
+ switch(rsvp_obj_ctype) {
+ case RSVP_CTYPE_1:
+ printf("%s Class Type: %u",
+ ident,
+ EXTRACT_32BITS(obj_tptr)&0x7);
+ obj_tlen-=4;
+ obj_tptr+=4;
+ break;
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
case RSVP_OBJ_ERROR_SPEC:
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */
return-1;
error_code=*(obj_tptr+5);
error_value=EXTRACT_16BITS(obj_tptr+6);
- printf("%s Error Node Adress: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
+ printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
ident,
ipaddr_string(obj_tptr),
*(obj_tptr+4),
tok2str(rsvp_obj_error_code_routing_values,"unknown",error_value),
error_value);
break;
+ case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE:
+ printf(", Error Value: %s (%u)",
+ tok2str(rsvp_obj_error_code_diffserv_te_values,"unknown",error_value),
+ error_value);
+ break;
default:
printf(", Unknown Error Value (%u)", error_value);
break;
return-1;
error_code=*(obj_tptr+17);
error_value=EXTRACT_16BITS(obj_tptr+18);
- printf("%s Error Node Adress: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
+ printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
ident,
ip6addr_string(obj_tptr),
*(obj_tptr+16),
case RSVP_OBJ_PROTECTION:
default:
if (vflag <= 1)
- print_unknown_data(obj_tptr,"\n\t ",obj_tlen); /* FIXME identation */
+ print_unknown_data(obj_tptr,"\n\t ",obj_tlen); /* FIXME indentation */
break;
}
- /* do we want to see an additionally hexdump ? */
+ /* do we also want to see a hex dump ? */
if (vflag > 1 || hexdump==TRUE)
- print_unknown_data(tptr+sizeof(sizeof(struct rsvp_object_header)),"\n\t ", /* FIXME identation */
+ print_unknown_data(tptr+sizeof(sizeof(struct rsvp_object_header)),"\n\t ", /* FIXME indentation */
rsvp_obj_len-sizeof(struct rsvp_object_header));
tptr+=rsvp_obj_len;
EXTRACT_16BITS(rsvp_com_header->checksum));
if (tlen < sizeof(const struct rsvp_common_header)) {
- printf("ERROR: common header too short %u < %u", tlen, sizeof(const struct rsvp_common_header));
+ printf("ERROR: common header too short %u < %lu", tlen,
+ (unsigned long)sizeof(const struct rsvp_common_header));
return;
}
EXTRACT_16BITS(rsvp_com_header->checksum));
if (subtlen < sizeof(const struct rsvp_common_header)) {
- printf("ERROR: common header too short %u < %u", subtlen, sizeof(const struct rsvp_common_header));
+ printf("ERROR: common header too short %u < %lu", subtlen,
+ (unsigned long)sizeof(const struct rsvp_common_header));
return;
}