abd0900a99
4.1.34 - Release 11 March 2010
2964907 uninitialised use compile error
2959506 ipfstat does not display rules with compat
2949139 FR_T_BUILTIN masked out incorrectly
2937422
packets filtered with pools should not be cached
2935529 use of rules with tags leads to deadlock
2917501 whitespace cleanup required
2881514 in/out object functions not wired for compatibility
2841771 ipf/ippool rule maintenace bugs: memory leak, ref-counter bug
2839698 H.323 proxy does not clear fin_state/fin_nat
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
/* $NetBSD: printpacket6.c,v 1.1.1.3 2010/04/17 20:45:57 darrenr Exp $ */
|
|
|
|
/*
|
|
* Copyright (C) 2002 by Darren Reed.
|
|
*
|
|
* See the IPFILTER.LICENCE file for details on licencing.
|
|
*
|
|
* Id: printpacket6.c,v 1.3.4.2 2009/12/27 06:58:07 darrenr Exp
|
|
*/
|
|
|
|
#include "ipf.h"
|
|
|
|
/*
|
|
* This is meant to work without the IPv6 header files being present or
|
|
* the inet_ntop() library.
|
|
*/
|
|
void printpacket6(ip)
|
|
struct ip *ip;
|
|
{
|
|
u_char *buf, p;
|
|
u_short plen, *addrs;
|
|
tcphdr_t *tcp;
|
|
u_32_t flow;
|
|
|
|
buf = (u_char *)ip;
|
|
tcp = (tcphdr_t *)(buf + 40);
|
|
p = buf[6];
|
|
flow = ntohl(*(u_32_t *)buf);
|
|
flow &= 0xfffff;
|
|
plen = ntohs(*((u_short *)buf +2));
|
|
addrs = (u_short *)buf + 4;
|
|
|
|
printf("ip6/%d %d %#x %d", buf[0] & 0xf, plen, flow, p);
|
|
printf(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
|
ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
|
|
ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
|
|
ntohs(addrs[6]), ntohs(addrs[7]));
|
|
if (plen >= 4)
|
|
if (p == IPPROTO_TCP || p == IPPROTO_UDP)
|
|
(void)printf(",%d", ntohs(tcp->th_sport));
|
|
printf(" >");
|
|
addrs += 8;
|
|
printf(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
|
ntohs(addrs[0]), ntohs(addrs[1]), ntohs(addrs[2]),
|
|
ntohs(addrs[3]), ntohs(addrs[4]), ntohs(addrs[5]),
|
|
ntohs(addrs[6]), ntohs(addrs[7]));
|
|
if (plen >= 4)
|
|
if (p == IPPROTO_TCP || p == IPPROTO_UDP)
|
|
(void)printf(",%d", ntohs(tcp->th_dport));
|
|
putchar('\n');
|
|
}
|