]> The Tcpdump Group git mirrors - tcpdump/blob - print-dccp.c
Don't overwrite the destination IPv6 address for routing headers.
[tcpdump] / print-dccp.c
1 /*
2 * Copyright (C) Arnaldo Carvalho de Melo 2004
3 * Copyright (C) Ian McDonald 2005
4 * Copyright (C) Yoshifumi Nishida 2005
5 *
6 * This software may be distributed either under the terms of the
7 * BSD-style license that accompanies tcpdump or the GNU GPL version 2
8 */
9
10 #ifdef HAVE_CONFIG_H
11 #include "config.h"
12 #endif
13
14 #include <netdissect-stdinc.h>
15
16 #include <stdio.h>
17 #include <string.h>
18
19 #include "netdissect.h"
20 #include "addrtoname.h"
21 #include "extract.h"
22 #include "ip.h"
23 #include "ip6.h"
24 #include "ipproto.h"
25
26 /* RFC4340: Datagram Congestion Control Protocol (DCCP) */
27
28 /**
29 * struct dccp_hdr - generic part of DCCP packet header, with a 24-bit
30 * sequence number
31 *
32 * @dccph_sport - Relevant port on the endpoint that sent this packet
33 * @dccph_dport - Relevant port on the other endpoint
34 * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
35 * @dccph_ccval - Used by the HC-Sender CCID
36 * @dccph_cscov - Parts of the packet that are covered by the Checksum field
37 * @dccph_checksum - Internet checksum, depends on dccph_cscov
38 * @dccph_x - 0 = 24 bit sequence number, 1 = 48
39 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros
40 * @dccph_seq - 24-bit sequence number
41 */
42 struct dccp_hdr {
43 uint16_t dccph_sport,
44 dccph_dport;
45 uint8_t dccph_doff;
46 uint8_t dccph_ccval_cscov;
47 uint16_t dccph_checksum;
48 uint8_t dccph_xtr;
49 uint8_t dccph_seq[3];
50 } UNALIGNED;
51
52 /**
53 * struct dccp_hdr_ext - generic part of DCCP packet header, with a 48-bit
54 * sequence number
55 *
56 * @dccph_sport - Relevant port on the endpoint that sent this packet
57 * @dccph_dport - Relevant port on the other endpoint
58 * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
59 * @dccph_ccval - Used by the HC-Sender CCID
60 * @dccph_cscov - Parts of the packet that are covered by the Checksum field
61 * @dccph_checksum - Internet checksum, depends on dccph_cscov
62 * @dccph_x - 0 = 24 bit sequence number, 1 = 48
63 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros
64 * @dccph_seq - 48-bit sequence number
65 */
66 struct dccp_hdr_ext {
67 uint16_t dccph_sport,
68 dccph_dport;
69 uint8_t dccph_doff;
70 uint8_t dccph_ccval_cscov;
71 uint16_t dccph_checksum;
72 uint8_t dccph_xtr;
73 uint8_t reserved;
74 uint8_t dccph_seq[6];
75 } UNALIGNED;
76
77 #define DCCPH_CCVAL(dh) (((dh)->dccph_ccval_cscov >> 4) & 0xF)
78 #define DCCPH_CSCOV(dh) (((dh)->dccph_ccval_cscov) & 0xF)
79
80 #define DCCPH_X(dh) ((dh)->dccph_xtr & 1)
81 #define DCCPH_TYPE(dh) (((dh)->dccph_xtr >> 1) & 0xF)
82
83 /**
84 * struct dccp_hdr_request - Conection initiation request header
85 *
86 * @dccph_req_service - Service to which the client app wants to connect
87 */
88 struct dccp_hdr_request {
89 uint32_t dccph_req_service;
90 } UNALIGNED;
91
92 /**
93 * struct dccp_hdr_response - Conection initiation response header
94 *
95 * @dccph_resp_ack - 48 bit ack number, contains GSR
96 * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
97 */
98 struct dccp_hdr_response {
99 uint8_t dccph_resp_ack[8]; /* always 8 bytes */
100 uint32_t dccph_resp_service;
101 } UNALIGNED;
102
103 /**
104 * struct dccp_hdr_reset - Unconditionally shut down a connection
105 *
106 * @dccph_resp_ack - 48 bit ack number
107 * @dccph_reset_service - Echoes the Service Code on a received DCCP-Request
108 */
109 struct dccp_hdr_reset {
110 uint8_t dccph_reset_ack[8]; /* always 8 bytes */
111 uint8_t dccph_reset_code,
112 dccph_reset_data[3];
113 } UNALIGNED;
114
115 enum dccp_pkt_type {
116 DCCP_PKT_REQUEST = 0,
117 DCCP_PKT_RESPONSE,
118 DCCP_PKT_DATA,
119 DCCP_PKT_ACK,
120 DCCP_PKT_DATAACK,
121 DCCP_PKT_CLOSEREQ,
122 DCCP_PKT_CLOSE,
123 DCCP_PKT_RESET,
124 DCCP_PKT_SYNC,
125 DCCP_PKT_SYNCACK
126 };
127
128 static const struct tok dccp_pkt_type_str[] = {
129 { DCCP_PKT_REQUEST, "DCCP-Request" },
130 { DCCP_PKT_RESPONSE, "DCCP-Response" },
131 { DCCP_PKT_DATA, "DCCP-Data" },
132 { DCCP_PKT_ACK, "DCCP-Ack" },
133 { DCCP_PKT_DATAACK, "DCCP-DataAck" },
134 { DCCP_PKT_CLOSEREQ, "DCCP-CloseReq" },
135 { DCCP_PKT_CLOSE, "DCCP-Close" },
136 { DCCP_PKT_RESET, "DCCP-Reset" },
137 { DCCP_PKT_SYNC, "DCCP-Sync" },
138 { DCCP_PKT_SYNCACK, "DCCP-SyncAck" },
139 { 0, NULL}
140 };
141
142 enum dccp_reset_codes {
143 DCCP_RESET_CODE_UNSPECIFIED = 0,
144 DCCP_RESET_CODE_CLOSED,
145 DCCP_RESET_CODE_ABORTED,
146 DCCP_RESET_CODE_NO_CONNECTION,
147 DCCP_RESET_CODE_PACKET_ERROR,
148 DCCP_RESET_CODE_OPTION_ERROR,
149 DCCP_RESET_CODE_MANDATORY_ERROR,
150 DCCP_RESET_CODE_CONNECTION_REFUSED,
151 DCCP_RESET_CODE_BAD_SERVICE_CODE,
152 DCCP_RESET_CODE_TOO_BUSY,
153 DCCP_RESET_CODE_BAD_INIT_COOKIE,
154 DCCP_RESET_CODE_AGGRESSION_PENALTY,
155 __DCCP_RESET_CODE_LAST
156 };
157
158 static const char tstr[] = "[|dccp]";
159
160 static const char *dccp_reset_codes[] = {
161 "unspecified",
162 "closed",
163 "aborted",
164 "no_connection",
165 "packet_error",
166 "option_error",
167 "mandatory_error",
168 "connection_refused",
169 "bad_service_code",
170 "too_busy",
171 "bad_init_cookie",
172 "aggression_penalty",
173 };
174
175 static const char *dccp_feature_nums[] = {
176 "reserved",
177 "ccid",
178 "allow_short_seqno",
179 "sequence_window",
180 "ecn_incapable",
181 "ack_ratio",
182 "send_ack_vector",
183 "send_ndp_count",
184 "minimum checksum coverage",
185 "check data checksum",
186 };
187
188 static inline u_int dccp_csum_coverage(const struct dccp_hdr* dh, u_int len)
189 {
190 u_int cov;
191
192 if (DCCPH_CSCOV(dh) == 0)
193 return len;
194 cov = (dh->dccph_doff + DCCPH_CSCOV(dh) - 1) * sizeof(uint32_t);
195 return (cov > len)? len : cov;
196 }
197
198 static int dccp_cksum(netdissect_options *ndo, const struct ip *ip,
199 const struct dccp_hdr *dh, u_int len)
200 {
201 return nextproto4_cksum(ndo, ip, (const uint8_t *)(const void *)dh, len,
202 dccp_csum_coverage(dh, len), IPPROTO_DCCP);
203 }
204
205 static int dccp6_cksum(netdissect_options *ndo, const struct ip6_hdr *ip6,
206 const struct dccp_hdr *dh, u_int len)
207 {
208 return nextproto6_cksum(ndo, ip6, (const uint8_t *)(const void *)dh, len,
209 dccp_csum_coverage(dh, len), IPPROTO_DCCP);
210 }
211
212 static const char *dccp_reset_code(uint8_t code)
213 {
214 if (code >= __DCCP_RESET_CODE_LAST)
215 return "invalid";
216 return dccp_reset_codes[code];
217 }
218
219 static uint64_t dccp_seqno(const u_char *bp)
220 {
221 const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;
222 uint64_t seqno;
223
224 if (DCCPH_X(dh) != 0) {
225 const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp;
226 seqno = EXTRACT_48BITS(dhx->dccph_seq);
227 } else {
228 seqno = EXTRACT_24BITS(dh->dccph_seq);
229 }
230
231 return seqno;
232 }
233
234 static inline unsigned int dccp_basic_hdr_len(const struct dccp_hdr *dh)
235 {
236 return DCCPH_X(dh) ? sizeof(struct dccp_hdr_ext) : sizeof(struct dccp_hdr);
237 }
238
239 static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp)
240 {
241 const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;
242 const u_char *ackp = bp + dccp_basic_hdr_len(dh);
243 uint64_t ackno;
244
245 if (DCCPH_X(dh) != 0) {
246 ND_TCHECK2(*ackp, 8);
247 ackno = EXTRACT_48BITS(ackp + 2);
248 } else {
249 ND_TCHECK2(*ackp, 4);
250 ackno = EXTRACT_24BITS(ackp + 1);
251 }
252
253 ND_PRINT((ndo, "(ack=%" PRIu64 ") ", ackno));
254 trunc:
255 return;
256 }
257
258 static int dccp_print_option(netdissect_options *, const u_char *, u_int);
259
260 /**
261 * dccp_print - show dccp packet
262 * @bp - beginning of dccp packet
263 * @data2 - beginning of enclosing
264 * @len - lenght of ip packet
265 */
266 void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
267 u_int len)
268 {
269 const struct dccp_hdr *dh;
270 const struct ip *ip;
271 const struct ip6_hdr *ip6;
272 const u_char *cp;
273 u_short sport, dport;
274 u_int hlen;
275 u_int fixed_hdrlen;
276 uint8_t dccph_type;
277
278 dh = (const struct dccp_hdr *)bp;
279
280 ip = (const struct ip *)data2;
281 if (IP_V(ip) == 6)
282 ip6 = (const struct ip6_hdr *)data2;
283 else
284 ip6 = NULL;
285
286 /* make sure we have enough data to look at the X bit */
287 cp = (const u_char *)(dh + 1);
288 if (cp > ndo->ndo_snapend) {
289 ND_PRINT((ndo, "[Invalid packet|dccp]"));
290 return;
291 }
292 if (len < sizeof(struct dccp_hdr)) {
293 ND_PRINT((ndo, "truncated-dccp - %u bytes missing!",
294 len - (u_int)sizeof(struct dccp_hdr)));
295 return;
296 }
297
298 /* get the length of the generic header */
299 fixed_hdrlen = dccp_basic_hdr_len(dh);
300 if (len < fixed_hdrlen) {
301 ND_PRINT((ndo, "truncated-dccp - %u bytes missing!",
302 len - fixed_hdrlen));
303 return;
304 }
305 ND_TCHECK2(*dh, fixed_hdrlen);
306
307 sport = EXTRACT_16BITS(&dh->dccph_sport);
308 dport = EXTRACT_16BITS(&dh->dccph_dport);
309 hlen = dh->dccph_doff * 4;
310
311 if (ip6) {
312 ND_PRINT((ndo, "%s.%d > %s.%d: ",
313 ip6addr_string(ndo, &ip6->ip6_src), sport,
314 ip6addr_string(ndo, &ip6->ip6_dst), dport));
315 } else {
316 ND_PRINT((ndo, "%s.%d > %s.%d: ",
317 ipaddr_string(ndo, &ip->ip_src), sport,
318 ipaddr_string(ndo, &ip->ip_dst), dport));
319 }
320
321 ND_PRINT((ndo, "DCCP"));
322
323 if (ndo->ndo_qflag) {
324 ND_PRINT((ndo, " %d", len - hlen));
325 if (hlen > len) {
326 ND_PRINT((ndo, " [bad hdr length %u - too long, > %u]",
327 hlen, len));
328 }
329 return;
330 }
331
332 /* other variables in generic header */
333 if (ndo->ndo_vflag) {
334 ND_PRINT((ndo, " (CCVal %d, CsCov %d, ", DCCPH_CCVAL(dh), DCCPH_CSCOV(dh)));
335 }
336
337 /* checksum calculation */
338 if (ndo->ndo_vflag && ND_TTEST2(bp[0], len)) {
339 uint16_t sum = 0, dccp_sum;
340
341 dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);
342 ND_PRINT((ndo, "cksum 0x%04x ", dccp_sum));
343 if (IP_V(ip) == 4)
344 sum = dccp_cksum(ndo, ip, dh, len);
345 else if (IP_V(ip) == 6)
346 sum = dccp6_cksum(ndo, ip6, dh, len);
347 if (sum != 0)
348 ND_PRINT((ndo, "(incorrect -> 0x%04x)",in_cksum_shouldbe(dccp_sum, sum)));
349 else
350 ND_PRINT((ndo, "(correct)"));
351 }
352
353 if (ndo->ndo_vflag)
354 ND_PRINT((ndo, ")"));
355 ND_PRINT((ndo, " "));
356
357 dccph_type = DCCPH_TYPE(dh);
358 switch (dccph_type) {
359 case DCCP_PKT_REQUEST: {
360 const struct dccp_hdr_request *dhr =
361 (const struct dccp_hdr_request *)(bp + fixed_hdrlen);
362 fixed_hdrlen += 4;
363 if (len < fixed_hdrlen) {
364 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
365 tok2str(dccp_pkt_type_str, "", dccph_type),
366 len - fixed_hdrlen));
367 return;
368 }
369 ND_TCHECK(*dhr);
370 ND_PRINT((ndo, "%s (service=%d) ",
371 tok2str(dccp_pkt_type_str, "", dccph_type),
372 EXTRACT_32BITS(&dhr->dccph_req_service)));
373 break;
374 }
375 case DCCP_PKT_RESPONSE: {
376 const struct dccp_hdr_response *dhr =
377 (const struct dccp_hdr_response *)(bp + fixed_hdrlen);
378 fixed_hdrlen += 12;
379 if (len < fixed_hdrlen) {
380 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
381 tok2str(dccp_pkt_type_str, "", dccph_type),
382 len - fixed_hdrlen));
383 return;
384 }
385 ND_TCHECK(*dhr);
386 ND_PRINT((ndo, "%s (service=%d) ",
387 tok2str(dccp_pkt_type_str, "", dccph_type),
388 EXTRACT_32BITS(&dhr->dccph_resp_service)));
389 break;
390 }
391 case DCCP_PKT_DATA:
392 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
393 break;
394 case DCCP_PKT_ACK: {
395 fixed_hdrlen += 8;
396 if (len < fixed_hdrlen) {
397 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
398 tok2str(dccp_pkt_type_str, "", dccph_type),
399 len - fixed_hdrlen));
400 return;
401 }
402 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
403 break;
404 }
405 case DCCP_PKT_DATAACK: {
406 fixed_hdrlen += 8;
407 if (len < fixed_hdrlen) {
408 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
409 tok2str(dccp_pkt_type_str, "", dccph_type),
410 len - fixed_hdrlen));
411 return;
412 }
413 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
414 break;
415 }
416 case DCCP_PKT_CLOSEREQ:
417 fixed_hdrlen += 8;
418 if (len < fixed_hdrlen) {
419 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
420 tok2str(dccp_pkt_type_str, "", dccph_type),
421 len - fixed_hdrlen));
422 return;
423 }
424 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
425 break;
426 case DCCP_PKT_CLOSE:
427 fixed_hdrlen += 8;
428 if (len < fixed_hdrlen) {
429 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
430 tok2str(dccp_pkt_type_str, "", dccph_type),
431 len - fixed_hdrlen));
432 return;
433 }
434 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
435 break;
436 case DCCP_PKT_RESET: {
437 const struct dccp_hdr_reset *dhr =
438 (const struct dccp_hdr_reset *)(bp + fixed_hdrlen);
439 fixed_hdrlen += 12;
440 if (len < fixed_hdrlen) {
441 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
442 tok2str(dccp_pkt_type_str, "", dccph_type),
443 len - fixed_hdrlen));
444 return;
445 }
446 ND_TCHECK(*dhr);
447 ND_PRINT((ndo, "%s (code=%s) ",
448 tok2str(dccp_pkt_type_str, "", dccph_type),
449 dccp_reset_code(dhr->dccph_reset_code)));
450 break;
451 }
452 case DCCP_PKT_SYNC:
453 fixed_hdrlen += 8;
454 if (len < fixed_hdrlen) {
455 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
456 tok2str(dccp_pkt_type_str, "", dccph_type),
457 len - fixed_hdrlen));
458 return;
459 }
460 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
461 break;
462 case DCCP_PKT_SYNCACK:
463 fixed_hdrlen += 8;
464 if (len < fixed_hdrlen) {
465 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
466 tok2str(dccp_pkt_type_str, "", dccph_type),
467 len - fixed_hdrlen));
468 return;
469 }
470 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
471 break;
472 default:
473 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "unknown-type-%u", dccph_type)));
474 break;
475 }
476
477 if ((DCCPH_TYPE(dh) != DCCP_PKT_DATA) &&
478 (DCCPH_TYPE(dh) != DCCP_PKT_REQUEST))
479 dccp_print_ack_no(ndo, bp);
480
481 if (ndo->ndo_vflag < 2)
482 return;
483
484 ND_PRINT((ndo, "seq %" PRIu64, dccp_seqno(bp)));
485
486 /* process options */
487 if (hlen > fixed_hdrlen){
488 u_int optlen;
489 cp = bp + fixed_hdrlen;
490 ND_PRINT((ndo, " <"));
491
492 hlen -= fixed_hdrlen;
493 while(1){
494 optlen = dccp_print_option(ndo, cp, hlen);
495 if (!optlen)
496 break;
497 if (hlen <= optlen)
498 break;
499 hlen -= optlen;
500 cp += optlen;
501 ND_PRINT((ndo, ", "));
502 }
503 ND_PRINT((ndo, ">"));
504 }
505 return;
506 trunc:
507 ND_PRINT((ndo, "%s", tstr));
508 return;
509 }
510
511 static const struct tok dccp_option_values[] = {
512 { 0, "nop" },
513 { 1, "mandatory" },
514 { 2, "slowreceiver" },
515 { 32, "change_l" },
516 { 33, "confirm_l" },
517 { 34, "change_r" },
518 { 35, "confirm_r" },
519 { 36, "initcookie" },
520 { 37, "ndp_count" },
521 { 38, "ack_vector0" },
522 { 39, "ack_vector1" },
523 { 40, "data_dropped" },
524 { 41, "timestamp" },
525 { 42, "timestamp_echo" },
526 { 43, "elapsed_time" },
527 { 44, "data_checksum" },
528 { 0, NULL }
529 };
530
531 static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen)
532 {
533 uint8_t optlen, i;
534
535 ND_TCHECK(*option);
536
537 if (*option >= 32) {
538 ND_TCHECK(*(option+1));
539 optlen = *(option +1);
540 if (optlen < 2) {
541 if (*option >= 128)
542 ND_PRINT((ndo, "CCID option %u optlen too short", *option));
543 else
544 ND_PRINT((ndo, "%s optlen too short",
545 tok2str(dccp_option_values, "Option %u", *option)));
546 return 0;
547 }
548 } else
549 optlen = 1;
550
551 if (hlen < optlen) {
552 if (*option >= 128)
553 ND_PRINT((ndo, "CCID option %u optlen goes past header length",
554 *option));
555 else
556 ND_PRINT((ndo, "%s optlen goes past header length",
557 tok2str(dccp_option_values, "Option %u", *option)));
558 return 0;
559 }
560 ND_TCHECK2(*option, optlen);
561
562 if (*option >= 128) {
563 ND_PRINT((ndo, "CCID option %d", *option));
564 switch (optlen) {
565 case 4:
566 ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2)));
567 break;
568 case 6:
569 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
570 break;
571 default:
572 break;
573 }
574 } else {
575 ND_PRINT((ndo, "%s", tok2str(dccp_option_values, "Option %u", *option)));
576 switch (*option) {
577 case 32:
578 case 33:
579 case 34:
580 case 35:
581 if (optlen < 3) {
582 ND_PRINT((ndo, " optlen too short"));
583 return optlen;
584 }
585 if (*(option + 2) < 10){
586 ND_PRINT((ndo, " %s", dccp_feature_nums[*(option + 2)]));
587 for (i = 0; i < optlen - 3; i++)
588 ND_PRINT((ndo, " %d", *(option + 3 + i)));
589 }
590 break;
591 case 36:
592 if (optlen > 2) {
593 ND_PRINT((ndo, " 0x"));
594 for (i = 0; i < optlen - 2; i++)
595 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
596 }
597 break;
598 case 37:
599 for (i = 0; i < optlen - 2; i++)
600 ND_PRINT((ndo, " %d", *(option + 2 + i)));
601 break;
602 case 38:
603 if (optlen > 2) {
604 ND_PRINT((ndo, " 0x"));
605 for (i = 0; i < optlen - 2; i++)
606 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
607 }
608 break;
609 case 39:
610 if (optlen > 2) {
611 ND_PRINT((ndo, " 0x"));
612 for (i = 0; i < optlen - 2; i++)
613 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
614 }
615 break;
616 case 40:
617 if (optlen > 2) {
618 ND_PRINT((ndo, " 0x"));
619 for (i = 0; i < optlen - 2; i++)
620 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
621 }
622 break;
623 case 41:
624 if (optlen == 4)
625 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
626 else
627 ND_PRINT((ndo, " optlen != 4"));
628 break;
629 case 42:
630 if (optlen == 4)
631 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
632 else
633 ND_PRINT((ndo, " optlen != 4"));
634 break;
635 case 43:
636 if (optlen == 6)
637 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
638 else if (optlen == 4)
639 ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2)));
640 else
641 ND_PRINT((ndo, " optlen != 4 or 6"));
642 break;
643 case 44:
644 if (optlen > 2) {
645 ND_PRINT((ndo, " "));
646 for (i = 0; i < optlen - 2; i++)
647 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
648 }
649 break;
650 }
651 }
652
653 return optlen;
654 trunc:
655 ND_PRINT((ndo, "%s", tstr));
656 return 0;
657 }