* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
- * support for the The RPKI/Router Protocol Protocol as per draft-ietf-sidr-rpki-rtr-12
+ * support for the The RPKI/Router Protocol as RFC6810
*
*/
-#ifndef lint
-static const char rcsid[] _U_ =
-"@(#) $Header: /tcpdump/master/tcpdump/print-rpki_rtr.c,v 1.10 2008-03-20 09:30:56 hannes Exp $";
-#endif
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
u_char version; /* Version number */
u_char pdu_type; /* PDU type */
union {
- u_char cache_nonce[2]; /* Cache Nonce */
+ u_char session_id[2]; /* Session id */
u_char error_code[2]; /* Error code */
- };
+ } u;
u_char length[4];
- u_char msg[0]; /* message body */
-} __attribute__((packed)) rpki_rtr_pdu;
+} rpki_rtr_pdu;
#define RPKI_RTR_PDU_OVERHEAD (offsetof(rpki_rtr_pdu, rpki_rtr_pdu_msg))
/*
u_char zero;
u_char prefix[4];
u_char as[4];
-} __attribute__((packed)) rpki_rtr_pdu_ipv4_prefix;
+} rpki_rtr_pdu_ipv4_prefix;
/*
* IPv6 Prefix PDU.
u_char zero;
u_char prefix[16];
u_char as[4];
-} __attribute__((packed)) rpki_rtr_pdu_ipv6_prefix;
+} rpki_rtr_pdu_ipv6_prefix;
/*
* Error report PDU.
typedef struct rpki_rtr_pdu_error_report_ {
rpki_rtr_pdu pdu_header;
u_char encapsulated_pdu_length[4]; /* Encapsulated PDU length */
- u_char variable[0];
-} __attribute__((packed)) rpki_rtr_pdu_error_report;
+} rpki_rtr_pdu_error_report;
/*
* PDU type codes
* Trailing zero.
*/
buf[idx] = '\0';
-
+
return buf;
}
/*
* Print a single PDU.
*/
-static int
+static void
rpki_rtr_pdu_print (const u_char *tptr, u_int indent)
{
const rpki_rtr_pdu *pdu_header;
u_int pdu_type, pdu_len, hexdump;
+ const u_char *msg;
pdu_header = (rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
- pdu_len = pdu_len = EXTRACT_32BITS(pdu_header->length);
+ pdu_len = EXTRACT_32BITS(pdu_header->length);
hexdump = FALSE;
printf("%sRPKI-RTRv%u, %s PDU (%u), length: %u",
case RPKI_RTR_SERIAL_NOTIFY_PDU:
case RPKI_RTR_SERIAL_QUERY_PDU:
case RPKI_RTR_END_OF_DATA_PDU:
- printf("%sCache-Nonce: 0x%04x, Serial: %u",
+ msg = (const u_char *)(pdu_header + 1);
+ printf("%sSession ID: 0x%04x, Serial: %u",
indent_string(indent+2),
- EXTRACT_16BITS(pdu_header->cache_nonce),
- EXTRACT_32BITS(pdu_header->msg));
+ EXTRACT_16BITS(pdu_header->u.session_id),
+ EXTRACT_32BITS(msg));
break;
/*
break;
case RPKI_RTR_CACHE_RESPONSE_PDU:
- printf("%sCache-Nonce: 0x%04x",
+ printf("%sSession ID: 0x%04x",
indent_string(indent+2),
- EXTRACT_16BITS(pdu_header->cache_nonce));
+ EXTRACT_16BITS(pdu_header->u.session_id));
break;
case RPKI_RTR_IPV4_PREFIX_PDU:
encapsulated_pdu_length = EXTRACT_32BITS(pdu->encapsulated_pdu_length);
tlen = pdu_len;
- error_code = EXTRACT_16BITS(pdu->pdu_header.error_code);
+ error_code = EXTRACT_16BITS(pdu->pdu_header.u.error_code);
printf("%sError code: %s (%u), Encapsulated PDU length: %u",
indent_string(indent+2),
tok2str(rpki_rtr_error_codes, "Unknown", error_code),
/*
* Extract, trail-zero and print the Error message.
- */
+ */
text_length = 0;
if (tlen > 4) {
text_length = EXTRACT_32BITS(tptr);
/*
* Unknown data, please hexdump.
- */
+ */
hexdump = TRUE;
}
/* do we also want to see a hex dump ? */
if (vflag > 1 || (vflag && hexdump)) {
- print_unknown_data(tptr,"\n\t ", pdu_len);
+ print_unknown_data(gndo,tptr,"\n\t ", pdu_len);
}
}
u_int tlen, pdu_type, pdu_len;
const u_char *tptr;
const rpki_rtr_pdu *pdu_header;
-
+
tptr = pptr;
tlen = len;