- if (mdss->M) {
- printf(" seq ");
- if (mdss->m)
- printf("%" PRIu64, EXTRACT_64BITS(opt));
- else
- printf("%" PRIu32, EXTRACT_32BITS(opt));
- opt += mdss->m ? 8 : 4;
- printf(" subseq %" PRIu32, EXTRACT_32BITS(opt));
+ if (mdss_flags & MP_DSS_M) {
+ /*
+ * Data Sequence Number (DSN), Subflow Sequence Number (SSN),
+ * Data-Level Length present, and Checksum possibly present.
+ */
+ ND_PRINT(" seq ");
+ /*
+ * If the m flag is set, we have an 8-byte NDS; if it's clear,
+ * we have a 4-byte DSN.
+ */
+ if (mdss_flags & MP_DSS_m) {
+ if (opt_len < 8)
+ return 0;
+ ND_PRINT("%" PRIu64, EXTRACT_BE_U_8(opt));
+ opt += 8;
+ opt_len -= 8;
+ } else {
+ if (opt_len < 4)
+ return 0;
+ ND_PRINT("%u", EXTRACT_BE_U_4(opt));
+ opt += 4;
+ opt_len -= 4;
+ }
+ if (opt_len < 4)
+ return 0;
+ ND_PRINT(" subseq %u", EXTRACT_BE_U_4(opt));