]> The Tcpdump Group git mirrors - tcpdump/blob - print-dccp.c
RSVP: squelch a compiler warning
[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(const struct ip6_hdr *ip6, const struct dccp_hdr *dh, u_int len)
206 {
207 return nextproto6_cksum(ip6, (const uint8_t *)(const void *)dh, len,
208 dccp_csum_coverage(dh, len), IPPROTO_DCCP);
209 }
210
211 static const char *dccp_reset_code(uint8_t code)
212 {
213 if (code >= __DCCP_RESET_CODE_LAST)
214 return "invalid";
215 return dccp_reset_codes[code];
216 }
217
218 static uint64_t dccp_seqno(const u_char *bp)
219 {
220 const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;
221 uint64_t seqno;
222
223 if (DCCPH_X(dh) != 0) {
224 const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp;
225 seqno = EXTRACT_48BITS(dhx->dccph_seq);
226 } else {
227 seqno = EXTRACT_24BITS(dh->dccph_seq);
228 }
229
230 return seqno;
231 }
232
233 static inline unsigned int dccp_basic_hdr_len(const struct dccp_hdr *dh)
234 {
235 return DCCPH_X(dh) ? sizeof(struct dccp_hdr_ext) : sizeof(struct dccp_hdr);
236 }
237
238 static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp)
239 {
240 const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;
241 const u_char *ackp = bp + dccp_basic_hdr_len(dh);
242 uint64_t ackno;
243
244 if (DCCPH_X(dh) != 0) {
245 ND_TCHECK2(*ackp, 8);
246 ackno = EXTRACT_48BITS(ackp + 2);
247 } else {
248 ND_TCHECK2(*ackp, 4);
249 ackno = EXTRACT_24BITS(ackp + 1);
250 }
251
252 ND_PRINT((ndo, "(ack=%" PRIu64 ") ", ackno));
253 trunc:
254 return;
255 }
256
257 static int dccp_print_option(netdissect_options *, const u_char *, u_int);
258
259 /**
260 * dccp_print - show dccp packet
261 * @bp - beginning of dccp packet
262 * @data2 - beginning of enclosing
263 * @len - lenght of ip packet
264 */
265 void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
266 u_int len)
267 {
268 const struct dccp_hdr *dh;
269 const struct ip *ip;
270 const struct ip6_hdr *ip6;
271 const u_char *cp;
272 u_short sport, dport;
273 u_int hlen;
274 u_int fixed_hdrlen;
275 uint8_t dccph_type;
276
277 dh = (const struct dccp_hdr *)bp;
278
279 ip = (const struct ip *)data2;
280 if (IP_V(ip) == 6)
281 ip6 = (const struct ip6_hdr *)data2;
282 else
283 ip6 = NULL;
284
285 /* make sure we have enough data to look at the X bit */
286 cp = (const u_char *)(dh + 1);
287 if (cp > ndo->ndo_snapend) {
288 ND_PRINT((ndo, "[Invalid packet|dccp]"));
289 return;
290 }
291 if (len < sizeof(struct dccp_hdr)) {
292 ND_PRINT((ndo, "truncated-dccp - %u bytes missing!",
293 len - (u_int)sizeof(struct dccp_hdr)));
294 return;
295 }
296
297 /* get the length of the generic header */
298 fixed_hdrlen = dccp_basic_hdr_len(dh);
299 if (len < fixed_hdrlen) {
300 ND_PRINT((ndo, "truncated-dccp - %u bytes missing!",
301 len - fixed_hdrlen));
302 return;
303 }
304 ND_TCHECK2(*dh, fixed_hdrlen);
305
306 sport = EXTRACT_16BITS(&dh->dccph_sport);
307 dport = EXTRACT_16BITS(&dh->dccph_dport);
308 hlen = dh->dccph_doff * 4;
309
310 if (ip6) {
311 ND_PRINT((ndo, "%s.%d > %s.%d: ",
312 ip6addr_string(ndo, &ip6->ip6_src), sport,
313 ip6addr_string(ndo, &ip6->ip6_dst), dport));
314 } else {
315 ND_PRINT((ndo, "%s.%d > %s.%d: ",
316 ipaddr_string(ndo, &ip->ip_src), sport,
317 ipaddr_string(ndo, &ip->ip_dst), dport));
318 }
319
320 ND_PRINT((ndo, "DCCP"));
321
322 if (ndo->ndo_qflag) {
323 ND_PRINT((ndo, " %d", len - hlen));
324 if (hlen > len) {
325 ND_PRINT((ndo, " [bad hdr length %u - too long, > %u]",
326 hlen, len));
327 }
328 return;
329 }
330
331 /* other variables in generic header */
332 if (ndo->ndo_vflag) {
333 ND_PRINT((ndo, " (CCVal %d, CsCov %d, ", DCCPH_CCVAL(dh), DCCPH_CSCOV(dh)));
334 }
335
336 /* checksum calculation */
337 if (ndo->ndo_vflag && ND_TTEST2(bp[0], len)) {
338 uint16_t sum = 0, dccp_sum;
339
340 dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);
341 ND_PRINT((ndo, "cksum 0x%04x ", dccp_sum));
342 if (IP_V(ip) == 4)
343 sum = dccp_cksum(ndo, ip, dh, len);
344 else if (IP_V(ip) == 6)
345 sum = dccp6_cksum(ip6, dh, len);
346 if (sum != 0)
347 ND_PRINT((ndo, "(incorrect -> 0x%04x)",in_cksum_shouldbe(dccp_sum, sum)));
348 else
349 ND_PRINT((ndo, "(correct)"));
350 }
351
352 if (ndo->ndo_vflag)
353 ND_PRINT((ndo, ")"));
354 ND_PRINT((ndo, " "));
355
356 dccph_type = DCCPH_TYPE(dh);
357 switch (dccph_type) {
358 case DCCP_PKT_REQUEST: {
359 const struct dccp_hdr_request *dhr =
360 (const struct dccp_hdr_request *)(bp + fixed_hdrlen);
361 fixed_hdrlen += 4;
362 if (len < fixed_hdrlen) {
363 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
364 tok2str(dccp_pkt_type_str, "", dccph_type),
365 len - fixed_hdrlen));
366 return;
367 }
368 ND_TCHECK(*dhr);
369 ND_PRINT((ndo, "%s (service=%d) ",
370 tok2str(dccp_pkt_type_str, "", dccph_type),
371 EXTRACT_32BITS(&dhr->dccph_req_service)));
372 break;
373 }
374 case DCCP_PKT_RESPONSE: {
375 const struct dccp_hdr_response *dhr =
376 (const struct dccp_hdr_response *)(bp + fixed_hdrlen);
377 fixed_hdrlen += 12;
378 if (len < fixed_hdrlen) {
379 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
380 tok2str(dccp_pkt_type_str, "", dccph_type),
381 len - fixed_hdrlen));
382 return;
383 }
384 ND_TCHECK(*dhr);
385 ND_PRINT((ndo, "%s (service=%d) ",
386 tok2str(dccp_pkt_type_str, "", dccph_type),
387 EXTRACT_32BITS(&dhr->dccph_resp_service)));
388 break;
389 }
390 case DCCP_PKT_DATA:
391 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
392 break;
393 case DCCP_PKT_ACK: {
394 fixed_hdrlen += 8;
395 if (len < fixed_hdrlen) {
396 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
397 tok2str(dccp_pkt_type_str, "", dccph_type),
398 len - fixed_hdrlen));
399 return;
400 }
401 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
402 break;
403 }
404 case DCCP_PKT_DATAACK: {
405 fixed_hdrlen += 8;
406 if (len < fixed_hdrlen) {
407 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
408 tok2str(dccp_pkt_type_str, "", dccph_type),
409 len - fixed_hdrlen));
410 return;
411 }
412 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
413 break;
414 }
415 case DCCP_PKT_CLOSEREQ:
416 fixed_hdrlen += 8;
417 if (len < fixed_hdrlen) {
418 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
419 tok2str(dccp_pkt_type_str, "", dccph_type),
420 len - fixed_hdrlen));
421 return;
422 }
423 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
424 break;
425 case DCCP_PKT_CLOSE:
426 fixed_hdrlen += 8;
427 if (len < fixed_hdrlen) {
428 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
429 tok2str(dccp_pkt_type_str, "", dccph_type),
430 len - fixed_hdrlen));
431 return;
432 }
433 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
434 break;
435 case DCCP_PKT_RESET: {
436 const struct dccp_hdr_reset *dhr =
437 (const struct dccp_hdr_reset *)(bp + fixed_hdrlen);
438 fixed_hdrlen += 12;
439 if (len < fixed_hdrlen) {
440 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
441 tok2str(dccp_pkt_type_str, "", dccph_type),
442 len - fixed_hdrlen));
443 return;
444 }
445 ND_TCHECK(*dhr);
446 ND_PRINT((ndo, "%s (code=%s) ",
447 tok2str(dccp_pkt_type_str, "", dccph_type),
448 dccp_reset_code(dhr->dccph_reset_code)));
449 break;
450 }
451 case DCCP_PKT_SYNC:
452 fixed_hdrlen += 8;
453 if (len < fixed_hdrlen) {
454 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
455 tok2str(dccp_pkt_type_str, "", dccph_type),
456 len - fixed_hdrlen));
457 return;
458 }
459 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
460 break;
461 case DCCP_PKT_SYNCACK:
462 fixed_hdrlen += 8;
463 if (len < fixed_hdrlen) {
464 ND_PRINT((ndo, "truncated-%s - %u bytes missing!",
465 tok2str(dccp_pkt_type_str, "", dccph_type),
466 len - fixed_hdrlen));
467 return;
468 }
469 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "", dccph_type)));
470 break;
471 default:
472 ND_PRINT((ndo, "%s ", tok2str(dccp_pkt_type_str, "unknown-type-%u", dccph_type)));
473 break;
474 }
475
476 if ((DCCPH_TYPE(dh) != DCCP_PKT_DATA) &&
477 (DCCPH_TYPE(dh) != DCCP_PKT_REQUEST))
478 dccp_print_ack_no(ndo, bp);
479
480 if (ndo->ndo_vflag < 2)
481 return;
482
483 ND_PRINT((ndo, "seq %" PRIu64, dccp_seqno(bp)));
484
485 /* process options */
486 if (hlen > fixed_hdrlen){
487 u_int optlen;
488 cp = bp + fixed_hdrlen;
489 ND_PRINT((ndo, " <"));
490
491 hlen -= fixed_hdrlen;
492 while(1){
493 optlen = dccp_print_option(ndo, cp, hlen);
494 if (!optlen)
495 break;
496 if (hlen <= optlen)
497 break;
498 hlen -= optlen;
499 cp += optlen;
500 ND_PRINT((ndo, ", "));
501 }
502 ND_PRINT((ndo, ">"));
503 }
504 return;
505 trunc:
506 ND_PRINT((ndo, "%s", tstr));
507 return;
508 }
509
510 static const struct tok dccp_option_values[] = {
511 { 0, "nop" },
512 { 1, "mandatory" },
513 { 2, "slowreceiver" },
514 { 32, "change_l" },
515 { 33, "confirm_l" },
516 { 34, "change_r" },
517 { 35, "confirm_r" },
518 { 36, "initcookie" },
519 { 37, "ndp_count" },
520 { 38, "ack_vector0" },
521 { 39, "ack_vector1" },
522 { 40, "data_dropped" },
523 { 41, "timestamp" },
524 { 42, "timestamp_echo" },
525 { 43, "elapsed_time" },
526 { 44, "data_checksum" },
527 { 0, NULL }
528 };
529
530 static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen)
531 {
532 uint8_t optlen, i;
533
534 ND_TCHECK(*option);
535
536 if (*option >= 32) {
537 ND_TCHECK(*(option+1));
538 optlen = *(option +1);
539 if (optlen < 2) {
540 if (*option >= 128)
541 ND_PRINT((ndo, "CCID option %u optlen too short", *option));
542 else
543 ND_PRINT((ndo, "%s optlen too short",
544 tok2str(dccp_option_values, "Option %u", *option)));
545 return 0;
546 }
547 } else
548 optlen = 1;
549
550 if (hlen < optlen) {
551 if (*option >= 128)
552 ND_PRINT((ndo, "CCID option %u optlen goes past header length",
553 *option));
554 else
555 ND_PRINT((ndo, "%s optlen goes past header length",
556 tok2str(dccp_option_values, "Option %u", *option)));
557 return 0;
558 }
559 ND_TCHECK2(*option, optlen);
560
561 if (*option >= 128) {
562 ND_PRINT((ndo, "CCID option %d", *option));
563 switch (optlen) {
564 case 4:
565 ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2)));
566 break;
567 case 6:
568 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
569 break;
570 default:
571 break;
572 }
573 } else {
574 ND_PRINT((ndo, "%s", tok2str(dccp_option_values, "Option %u", *option)));
575 switch (*option) {
576 case 32:
577 case 33:
578 case 34:
579 case 35:
580 if (optlen < 3) {
581 ND_PRINT((ndo, " optlen too short"));
582 return optlen;
583 }
584 if (*(option + 2) < 10){
585 ND_PRINT((ndo, " %s", dccp_feature_nums[*(option + 2)]));
586 for (i = 0; i < optlen - 3; i++)
587 ND_PRINT((ndo, " %d", *(option + 3 + i)));
588 }
589 break;
590 case 36:
591 if (optlen > 2) {
592 ND_PRINT((ndo, " 0x"));
593 for (i = 0; i < optlen - 2; i++)
594 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
595 }
596 break;
597 case 37:
598 for (i = 0; i < optlen - 2; i++)
599 ND_PRINT((ndo, " %d", *(option + 2 + i)));
600 break;
601 case 38:
602 if (optlen > 2) {
603 ND_PRINT((ndo, " 0x"));
604 for (i = 0; i < optlen - 2; i++)
605 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
606 }
607 break;
608 case 39:
609 if (optlen > 2) {
610 ND_PRINT((ndo, " 0x"));
611 for (i = 0; i < optlen - 2; i++)
612 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
613 }
614 break;
615 case 40:
616 if (optlen > 2) {
617 ND_PRINT((ndo, " 0x"));
618 for (i = 0; i < optlen - 2; i++)
619 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
620 }
621 break;
622 case 41:
623 if (optlen == 4)
624 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
625 else
626 ND_PRINT((ndo, " optlen != 4"));
627 break;
628 case 42:
629 if (optlen == 4)
630 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
631 else
632 ND_PRINT((ndo, " optlen != 4"));
633 break;
634 case 43:
635 if (optlen == 6)
636 ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
637 else if (optlen == 4)
638 ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2)));
639 else
640 ND_PRINT((ndo, " optlen != 4 or 6"));
641 break;
642 case 44:
643 if (optlen > 2) {
644 ND_PRINT((ndo, " "));
645 for (i = 0; i < optlen - 2; i++)
646 ND_PRINT((ndo, "%02x", *(option + 2 + i)));
647 }
648 break;
649 }
650 }
651
652 return optlen;
653 trunc:
654 ND_PRINT((ndo, "%s", tstr));
655 return 0;
656 }