Home | History | Annotate | Line # | Download | only in lib
printfraginfo.c revision 1.1
      1  1.1  christos /*	$NetBSD: printfraginfo.c,v 1.1 2012/03/23 21:20:09 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (C) 2011 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.1  christos  * Id
      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 	frentry_t fr;
     20  1.1  christos 	int family;
     21  1.1  christos 
     22  1.1  christos 	PRINTF("%s", prefix);
     23  1.1  christos 	if (ifr->ipfr_v == 6) {
     24  1.1  christos 		PRINTF("inet6");
     25  1.1  christos 		family = AF_INET6;
     26  1.1  christos 	} else {
     27  1.1  christos 		PRINTF("inet");
     28  1.1  christos 		family = AF_INET;
     29  1.1  christos 	}
     30  1.1  christos 	fr.fr_flags = 0xffffffff;
     31  1.1  christos 
     32  1.1  christos 	PRINTF(" %s -> ", hostname(family, &ifr->ipfr_src));
     33  1.1  christos /*
     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