6 * This is meant to work without the IPv6 header files being present or
7 * the inet_ntop() library.
18 tcp = (tcphdr_t *)(buf + 40);
20 flow = ntohl(*(u_32_t *)buf);
22 plen = ntohs(*((u_short *)buf +2));
23 addrs = (u_short *)buf + 4;
25 printf("ip6/%d %d %#x %d", buf[0] & 0xf, plen, flow, p);
26 printf(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
27 ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
28 ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
29 ntohs(addrs[6]), ntohs(addrs[7]));
31 if (p == IPPROTO_TCP || p == IPPROTO_UDP)
32 (void)printf(",%d", ntohs(tcp->th_sport));
35 printf(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
36 ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
37 ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
38 ntohs(addrs[6]), ntohs(addrs[7]));
40 if (p == IPPROTO_TCP || p == IPPROTO_UDP)
41 (void)printf(",%d", ntohs(tcp->th_dport));