Deleted Added
full compact
print-rpki-rtr.c (236192) print-rpki-rtr.c (252283)
1/*
2 * Copyright (c) 1998-2011 The TCPDUMP project
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
14 *
1/*
2 * Copyright (c) 1998-2011 The TCPDUMP project
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
14 *
15 * support for the The RPKI/Router Protocol Protocol as per draft-ietf-sidr-rpki-rtr-12
15 * support for the The RPKI/Router Protocol as RFC6810
16 *
17 * Original code by Hannes Gredler (hannes@juniper.net)
18 */
19
20#ifndef lint
21static const char rcsid[] _U_ =
22"@(#) $Header: /tcpdump/master/tcpdump/print-rpki_rtr.c,v 1.10 2008-03-20 09:30:56 hannes Exp $";
23#endif

--- 17 unchanged lines hidden (view full) ---

41 *
42 * Here's what the PDU header looks like.
43 * The length does include the version and length fields.
44 */
45typedef struct rpki_rtr_pdu_ {
46 u_char version; /* Version number */
47 u_char pdu_type; /* PDU type */
48 union {
16 *
17 * Original code by Hannes Gredler (hannes@juniper.net)
18 */
19
20#ifndef lint
21static const char rcsid[] _U_ =
22"@(#) $Header: /tcpdump/master/tcpdump/print-rpki_rtr.c,v 1.10 2008-03-20 09:30:56 hannes Exp $";
23#endif

--- 17 unchanged lines hidden (view full) ---

41 *
42 * Here's what the PDU header looks like.
43 * The length does include the version and length fields.
44 */
45typedef struct rpki_rtr_pdu_ {
46 u_char version; /* Version number */
47 u_char pdu_type; /* PDU type */
48 union {
49 u_char cache_nonce[2]; /* Cache Nonce */
49 u_char session_id[2]; /* Session id */
50 u_char error_code[2]; /* Error code */
51 } u;
52 u_char length[4];
53} rpki_rtr_pdu;
54#define RPKI_RTR_PDU_OVERHEAD (offsetof(rpki_rtr_pdu, rpki_rtr_pdu_msg))
55
56/*
57 * IPv4 Prefix PDU.

--- 104 unchanged lines hidden (view full) ---

162 idx++;
163 indent--;
164 }
165
166 /*
167 * Trailing zero.
168 */
169 buf[idx] = '\0';
50 u_char error_code[2]; /* Error code */
51 } u;
52 u_char length[4];
53} rpki_rtr_pdu;
54#define RPKI_RTR_PDU_OVERHEAD (offsetof(rpki_rtr_pdu, rpki_rtr_pdu_msg))
55
56/*
57 * IPv4 Prefix PDU.

--- 104 unchanged lines hidden (view full) ---

162 idx++;
163 indent--;
164 }
165
166 /*
167 * Trailing zero.
168 */
169 buf[idx] = '\0';
170
170
171 return buf;
172}
173
174/*
175 * Print a single PDU.
176 */
177static void
178rpki_rtr_pdu_print (const u_char *tptr, u_int indent)

--- 17 unchanged lines hidden (view full) ---

196
197 /*
198 * The following PDUs share the message format.
199 */
200 case RPKI_RTR_SERIAL_NOTIFY_PDU:
201 case RPKI_RTR_SERIAL_QUERY_PDU:
202 case RPKI_RTR_END_OF_DATA_PDU:
203 msg = (const u_char *)(pdu_header + 1);
171 return buf;
172}
173
174/*
175 * Print a single PDU.
176 */
177static void
178rpki_rtr_pdu_print (const u_char *tptr, u_int indent)

--- 17 unchanged lines hidden (view full) ---

196
197 /*
198 * The following PDUs share the message format.
199 */
200 case RPKI_RTR_SERIAL_NOTIFY_PDU:
201 case RPKI_RTR_SERIAL_QUERY_PDU:
202 case RPKI_RTR_END_OF_DATA_PDU:
203 msg = (const u_char *)(pdu_header + 1);
204 printf("%sCache-Nonce: 0x%04x, Serial: %u",
204 printf("%sSession ID: 0x%04x, Serial: %u",
205 indent_string(indent+2),
205 indent_string(indent+2),
206 EXTRACT_16BITS(pdu_header->u.cache_nonce),
206 EXTRACT_16BITS(pdu_header->u.session_id),
207 EXTRACT_32BITS(msg));
208 break;
209
210 /*
211 * The following PDUs share the message format.
212 */
213 case RPKI_RTR_RESET_QUERY_PDU:
214 case RPKI_RTR_CACHE_RESET_PDU:
215
216 /*
217 * Zero payload PDUs.
218 */
219 break;
220
221 case RPKI_RTR_CACHE_RESPONSE_PDU:
207 EXTRACT_32BITS(msg));
208 break;
209
210 /*
211 * The following PDUs share the message format.
212 */
213 case RPKI_RTR_RESET_QUERY_PDU:
214 case RPKI_RTR_CACHE_RESET_PDU:
215
216 /*
217 * Zero payload PDUs.
218 */
219 break;
220
221 case RPKI_RTR_CACHE_RESPONSE_PDU:
222 printf("%sCache-Nonce: 0x%04x",
222 printf("%sSession ID: 0x%04x",
223 indent_string(indent+2),
223 indent_string(indent+2),
224 EXTRACT_16BITS(pdu_header->u.cache_nonce));
224 EXTRACT_16BITS(pdu_header->u.session_id));
225 break;
226
227 case RPKI_RTR_IPV4_PREFIX_PDU:
228 {
229 rpki_rtr_pdu_ipv4_prefix *pdu;
230
231 pdu = (rpki_rtr_pdu_ipv4_prefix *)tptr;
232 printf("%sIPv4 Prefix %s/%u-%u, origin-as %u, flags 0x%02x",

--- 82 unchanged lines hidden (view full) ---

315}
316
317void
318rpki_rtr_print(register const u_char *pptr, register u_int len) {
319
320 u_int tlen, pdu_type, pdu_len;
321 const u_char *tptr;
322 const rpki_rtr_pdu *pdu_header;
225 break;
226
227 case RPKI_RTR_IPV4_PREFIX_PDU:
228 {
229 rpki_rtr_pdu_ipv4_prefix *pdu;
230
231 pdu = (rpki_rtr_pdu_ipv4_prefix *)tptr;
232 printf("%sIPv4 Prefix %s/%u-%u, origin-as %u, flags 0x%02x",

--- 82 unchanged lines hidden (view full) ---

315}
316
317void
318rpki_rtr_print(register const u_char *pptr, register u_int len) {
319
320 u_int tlen, pdu_type, pdu_len;
321 const u_char *tptr;
322 const rpki_rtr_pdu *pdu_header;
323
323
324 tptr = pptr;
325 tlen = len;
326
327 if (!vflag) {
328 printf(", RPKI-RTR");
329 return;
330 }
331

--- 37 unchanged lines hidden ---
324 tptr = pptr;
325 tlen = len;
326
327 if (!vflag) {
328 printf(", RPKI-RTR");
329 return;
330 }
331

--- 37 unchanged lines hidden ---