xref: /netbsd-src/external/bsd/ipf/dist/lib/printfraginfo.c (revision b757af438b42b93f8c6571f026d8b8ef3eaf5fc9)
1 /*	$NetBSD: printfraginfo.c,v 1.1.1.1 2012/03/23 21:20:09 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2011 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * Id
9  */
10 #include "ipf.h"
11 #include "kmem.h"
12 
13 
14 void
15 printfraginfo(prefix, ifr)
16 	char *prefix;
17 	struct ipfr *ifr;
18 {
19 	frentry_t fr;
20 	int family;
21 
22 	PRINTF("%s", prefix);
23 	if (ifr->ipfr_v == 6) {
24 		PRINTF("inet6");
25 		family = AF_INET6;
26 	} else {
27 		PRINTF("inet");
28 		family = AF_INET;
29 	}
30 	fr.fr_flags = 0xffffffff;
31 
32 	PRINTF(" %s -> ", hostname(family, &ifr->ipfr_src));
33 /*
34 	if (kmemcpy((char *)&fr, (u_long)ifr->ipfr_rule,
35 		    sizeof(fr)) == -1)
36 		return;
37  */
38 	PRINTF("%s id %x ttl %lu pr %d pkts %u bytes %u seen0 %d ref %d\n",
39 		hostname(family, &ifr->ipfr_dst), ifr->ipfr_id,
40 		ifr->ipfr_ttl, ifr->ipfr_p, ifr->ipfr_pkts, ifr->ipfr_bytes,
41 		ifr->ipfr_seen0, ifr->ipfr_ref);
42 }
43