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