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.
18 printpacket6(int dir, mb_t *m)
25 buf = (u_char *)m->mb_data;
26 tcp = (tcphdr_t *)(buf + 40);
28 flow = ntohl(*(u_32_t *)buf);
30 plen = ntohs(*((u_short *)buf +2));
31 addrs = (u_short *)buf + 4;
38 PRINTF("%s ", IFNAME(m->mb_ifp));
40 PRINTF("ip6/%d %d %#x %d", buf[0] & 0xf, plen, flow, p);
41 PRINTF(" %x:%x:%x:%x:%x:%x:%x:%x",
42 ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
43 ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
44 ntohs(addrs[6]), ntohs(addrs[7]));
46 if (p == IPPROTO_TCP || p == IPPROTO_UDP)
47 (void)PRINTF(",%d", ntohs(tcp->th_sport));
50 PRINTF(" %x:%x:%x:%x:%x:%x:%x:%x",
51 ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
52 ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
53 ntohs(addrs[6]), ntohs(addrs[7]));
55 if (p == IPPROTO_TCP || p == IPPROTO_UDP)
56 PRINTF(",%d", ntohs(tcp->th_dport));