4 * Copyright (C) 2012 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
14 * This is meant to work without the IPv6 header files being present or
15 * the inet_ntop() library.
27 buf = (u_char *)m->mb_data;
28 tcp = (tcphdr_t *)(buf + 40);
30 flow = ntohl(*(u_32_t *)buf);
32 plen = ntohs(*((u_short *)buf +2));
33 addrs = (u_short *)buf + 4;
40 PRINTF("%s ", IFNAME(m->mb_ifp));
42 PRINTF("ip6/%d %d %#x %d", buf[0] & 0xf, plen, flow, p);
43 PRINTF(" %x:%x:%x:%x:%x:%x:%x:%x",
44 ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
45 ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
46 ntohs(addrs[6]), ntohs(addrs[7]));
48 if (p == IPPROTO_TCP || p == IPPROTO_UDP)
49 (void)PRINTF(",%d", ntohs(tcp->th_sport));
52 PRINTF(" %x:%x:%x:%x:%x:%x:%x:%x",
53 ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
54 ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
55 ntohs(addrs[6]), ntohs(addrs[7]));
57 if (p == IPPROTO_TCP || p == IPPROTO_UDP)
58 PRINTF(",%d", ntohs(tcp->th_dport));