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