Deleted Added
full compact
1c1
< /* $OpenBSD: pfctl_table.c,v 1.62 2004/12/22 17:17:55 dhartmei Exp $ */
---
> /* $OpenBSD: pfctl_table.c,v 1.66 2007/03/01 17:20:54 deraadt Exp $ */
34c34
< __FBSDID("$FreeBSD: head/contrib/pf/pfctl/pfctl_table.c 145840 2005-05-03 16:55:20Z mlaier $");
---
> __FBSDID("$FreeBSD: head/contrib/pf/pfctl/pfctl_table.c 171172 2007-07-03 12:30:03Z mlaier $");
67,68c67
< static void print_iface(struct pfi_if *, int);
< static void oprintf(int, int, const char *, int *, int);
---
> static void print_iface(struct pfi_kif *, int);
181c180
< if (opts & PF_OPT_SHOWALL && b.pfrb_size > 0)
---
> if ((opts & PF_OPT_SHOWALL) && b.pfrb_size > 0)
259a259,294
> } else if (!strcmp(command, "expire")) {
> const char *errstr;
> u_int lifetime;
>
> b.pfrb_type = PFRB_ASTATS;
> b2.pfrb_type = PFRB_ADDRS;
> if (argc != 1 || file != NULL)
> usage();
> lifetime = strtonum(*argv, 0, UINT_MAX, &errstr);
> if (errstr)
> errx(1, "expiry time: %s", errstr);
> for (;;) {
> pfr_buf_grow(&b, b.pfrb_size);
> b.pfrb_size = b.pfrb_msize;
> RVTEST(pfr_get_astats(&table, b.pfrb_caddr,
> &b.pfrb_size, flags));
> if (b.pfrb_size <= b.pfrb_msize)
> break;
> }
> PFRB_FOREACH(p, &b)
> if (time(NULL) - ((struct pfr_astats *)p)->pfras_tzero >
> lifetime)
> if (pfr_buf_add(&b2,
> &((struct pfr_astats *)p)->pfras_a))
> err(1, "duplicate buffer");
>
> if (opts & PF_OPT_VERBOSE)
> flags |= PFR_FLAG_FEEDBACK;
> RVTEST(pfr_del_addrs(&table, b2.pfrb_caddr, b2.pfrb_size,
> &ndel, flags));
> xprintf(opts, "%d/%d addresses expired", ndel, b2.pfrb_size);
> if (opts & PF_OPT_VERBOSE)
> PFRB_FOREACH(a, &b2)
> if ((opts & PF_OPT_VERBOSE2) || a->pfra_fback)
> print_addrx(a, NULL,
> opts & PF_OPT_USEDNS);
297c332
< if (opts & PF_OPT_VERBOSE && !(opts & PF_OPT_VERBOSE2))
---
> if ((opts & PF_OPT_VERBOSE) && !(opts & PF_OPT_VERBOSE2))
545,546c580,581
< struct pfi_if *p;
< int i = 0, f = PFI_FLAG_GROUP|PFI_FLAG_INSTANCE;
---
> struct pfi_kif *p;
> int i = 0;
548,549d582
< if (filter != NULL && *filter && !isdigit(filter[strlen(filter)-1]))
< f &= ~PFI_FLAG_INSTANCE;
555c588
< if (pfi_get_ifaces(filter, b.pfrb_caddr, &b.pfrb_size, f)) {
---
> if (pfi_get_ifaces(filter, b.pfrb_caddr, &b.pfrb_size)) {
571c604
< print_iface(struct pfi_if *p, int opts)
---
> print_iface(struct pfi_kif *p, int opts)
573,575c606
< time_t tzero = p->pfif_tzero;
< int flags = (opts & PF_OPT_VERBOSE) ? p->pfif_flags : 0;
< int first = 1;
---
> time_t tzero = p->pfik_tzero;
578,588c609,613
< printf("%s", p->pfif_name);
< oprintf(flags, PFI_IFLAG_INSTANCE, "instance", &first, 0);
< oprintf(flags, PFI_IFLAG_GROUP, "group", &first, 0);
< oprintf(flags, PFI_IFLAG_CLONABLE, "clonable", &first, 0);
< oprintf(flags, PFI_IFLAG_DYNAMIC, "dynamic", &first, 0);
< oprintf(flags, PFI_IFLAG_ATTACHED, "attached", &first, 0);
< oprintf(flags, PFI_IFLAG_SKIP, "skipped", &first, 1);
< #ifdef __FreeBSD__
< first = 1;
< oprintf(flags, PFI_IFLAG_PLACEHOLDER, "placeholder", &first, 1);
< #endif
---
> printf("%s", p->pfik_name);
> if (opts & PF_OPT_VERBOSE) {
> if (p->pfik_flags & PFI_IFLAG_SKIP)
> printf(" (skip)");
> }
595c620
< p->pfif_states, p->pfif_rules);
---
> p->pfik_states, p->pfik_rules);
602,603c627,628
< (unsigned long long)p->pfif_packets[af][dir][act],
< (unsigned long long)p->pfif_bytes[af][dir][act]);
---
> (unsigned long long)p->pfik_packets[af][dir][act],
> (unsigned long long)p->pfik_bytes[af][dir][act]);
606,617d630
<
< void
< oprintf(int flags, int flag, const char *s, int *first, int last)
< {
< if (flags & flag) {
< printf(*first ? "\t(%s" : ", %s", s);
< *first = 0;
< }
< if (last && !*first)
< printf(")");
< }
<