- len = ntohs(ip6->ip6_plen);
- if (length < len + advance)
- (void)printf("truncated-ip6 - %d bytes missing!",
- len + advance - length);
+ if (!eflag)
+ printf("IP6 ");
+
+ payload_len = EXTRACT_16BITS(&ip6->ip6_plen);
+ len = payload_len + sizeof(struct ip6_hdr);
+ if (length < len)
+ (void)printf("truncated-ip6 - %u bytes missing!",
+ len - length);
+
+ if (vflag) {
+ flow = EXTRACT_32BITS(&ip6->ip6_flow);
+ printf("(");
+#if 0
+ /* rfc1883 */
+ if (flow & 0x0f000000)
+ (void)printf("pri 0x%02x, ", (flow & 0x0f000000) >> 24);
+ if (flow & 0x00ffffff)
+ (void)printf("flowlabel 0x%06x, ", flow & 0x00ffffff);
+#else
+ /* RFC 2460 */
+ if (flow & 0x0ff00000)
+ (void)printf("class 0x%02x, ", (flow & 0x0ff00000) >> 20);
+ if (flow & 0x000fffff)
+ (void)printf("flowlabel 0x%05x, ", flow & 0x000fffff);
+#endif
+
+ (void)printf("hlim %u, next-header: %s (%u), length: %u) ",
+ ip6->ip6_hlim,
+ tok2str(ipproto_values,"unknown",ip6->ip6_nxt),
+ ip6->ip6_nxt,
+ payload_len);
+ }
+
+ /*
+ * Cut off the snapshot length to the end of the IP payload.
+ */
+ ipend = bp + len;
+ if (ipend < snapend)
+ snapend = ipend;