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