- break;
- case 36:
- printf("initcookie 0x");
- for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
- break;
- case 37:
- printf("ndp_count");
- for (i = 0; i < optlen -2; i ++) printf(" %d", *(option +2 + i));
- break;
- case 38:
- printf("ack_vector0 0x");
- for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
- break;
- case 39:
- printf("ack_vector1 0x");
- for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
- break;
- case 40:
- printf("data_dropped 0x");
- for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
- break;
- case 41:
- printf("timestamp %u", EXTRACT_32BITS(option + 2));
- break;
- case 42:
- printf("timestamp_echo %u", EXTRACT_32BITS(option + 2));
- break;
- case 43:
- printf("elapsed_time ");
- if (optlen == 6)
- printf("%u", EXTRACT_32BITS(option + 2));
- else
- printf("%u", EXTRACT_16BITS(option + 2));
- break;
- case 44:
- printf("data_checksum ");
- for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
- break;
- default :
- if (*option >= 128) {
- printf("CCID option %d",*option);
+ } else {
+ switch (option) {
+ case DCCP_OPTION_PADDING:
+ case DCCP_OPTION_MANDATORY:
+ case DCCP_OPTION_SLOW_RECEIVER:
+ ND_TCHECK_1(bp);
+ break;
+ case DCCP_OPTION_CHANGE_L:
+ case DCCP_OPTION_CHANGE_R:
+ ND_ICHECK_U(optlen, <, 4);
+ ND_PRINT(" %s", tok2str(dccp_feature_num_str,
+ "feature-number-%u (invalid)", GET_U_1(bp + 2)));
+ for (i = 0; i < optlen - 3; i++)
+ ND_PRINT(" %u", GET_U_1(bp + 3 + i));
+ break;
+ case DCCP_OPTION_CONFIRM_L:
+ case DCCP_OPTION_CONFIRM_R:
+ ND_ICHECK_U(optlen, <, 3);
+ ND_PRINT(" %s", tok2str(dccp_feature_num_str,
+ "feature-number-%u (invalid)", GET_U_1(bp + 2)));
+ for (i = 0; i < optlen - 3; i++)
+ ND_PRINT(" %u", GET_U_1(bp + 3 + i));
+ break;
+ case DCCP_OPTION_INIT_COOKIE:
+ ND_ICHECK_U(optlen, <, 3);
+ ND_PRINT(" 0x");
+ for (i = 0; i < optlen - 2; i++)
+ ND_PRINT("%02x", GET_U_1(bp + 2 + i));
+ break;
+ case DCCP_OPTION_NDP_COUNT:
+ ND_ICHECK_U(optlen, <, 3);
+ ND_ICHECK_U(optlen, >, 8);
+ for (i = 0; i < optlen - 2; i++)
+ ND_PRINT(" %u", GET_U_1(bp + 2 + i));
+ break;
+ case DCCP_OPTION_ACK_VECTOR_NONCE_0:
+ case DCCP_OPTION_ACK_VECTOR_NONCE_1:
+ ND_ICHECK_U(optlen, <, 3);
+ ND_PRINT(" 0x");
+ for (i = 0; i < optlen - 2; i++)
+ ND_PRINT("%02x", GET_U_1(bp + 2 + i));
+ break;
+ case DCCP_OPTION_DATA_DROPPED:
+ ND_ICHECK_U(optlen, <, 3);
+ ND_PRINT(" 0x");
+ for (i = 0; i < optlen - 2; i++)
+ ND_PRINT("%02x", GET_U_1(bp + 2 + i));
+ break;
+ case DCCP_OPTION_TIMESTAMP:
+ /*
+ * 13.1. Timestamp Option
+ *
+ * +--------+--------+--------+--------+--------+--------+
+ * |00101001|00000110| Timestamp Value |
+ * +--------+--------+--------+--------+--------+--------+
+ * Type=41 Length=6
+ */
+ ND_ICHECK_U(optlen, !=, 6);
+ ND_PRINT(" %u", GET_BE_U_4(bp + 2));
+ break;
+ case DCCP_OPTION_TIMESTAMP_ECHO:
+ /*
+ * 13.3. Timestamp Echo Option
+ *
+ * +--------+--------+--------+--------+--------+--------+
+ * |00101010|00000110| Timestamp Echo |
+ * +--------+--------+--------+--------+--------+--------+
+ * Type=42 Len=6
+ *
+ * +--------+--------+------- ... -------+--------+--------+
+ * |00101010|00001000| Timestamp Echo | Elapsed Time |
+ * +--------+--------+------- ... -------+--------+--------+
+ * Type=42 Len=8 (4 bytes)
+ *
+ * +--------+--------+------- ... -------+------- ... -------+
+ * |00101010|00001010| Timestamp Echo | Elapsed Time |
+ * +--------+--------+------- ... -------+------- ... -------+
+ * Type=42 Len=10 (4 bytes) (4 bytes)
+ */
+ switch (optlen) {
+ case 6:
+ ND_PRINT(" %u", GET_BE_U_4(bp + 2));
+ break;
+ case 8:
+ ND_PRINT(" %u", GET_BE_U_4(bp + 2));
+ ND_PRINT(" (elapsed time %u)",
+ GET_BE_U_2(bp + 6));
+ break;
+ case 10:
+ ND_PRINT(" %u", GET_BE_U_4(bp + 2));
+ ND_PRINT(" (elapsed time %u)",
+ GET_BE_U_4(bp + 6));
+ break;
+ default:
+ ND_PRINT(" [optlen != 6 or 8 or 10]");
+ goto invalid;
+ }
+ break;
+ case DCCP_OPTION_ELAPSED_TIME: