head 1.3; access; symbols pkgsrc-2026Q1:1.3.0.122 pkgsrc-2026Q1-base:1.3 pkgsrc-2025Q4:1.3.0.120 pkgsrc-2025Q4-base:1.3 pkgsrc-2025Q3:1.3.0.118 pkgsrc-2025Q3-base:1.3 pkgsrc-2025Q2:1.3.0.116 pkgsrc-2025Q2-base:1.3 pkgsrc-2025Q1:1.3.0.114 pkgsrc-2025Q1-base:1.3 pkgsrc-2024Q4:1.3.0.112 pkgsrc-2024Q4-base:1.3 pkgsrc-2024Q3:1.3.0.110 pkgsrc-2024Q3-base:1.3 pkgsrc-2024Q2:1.3.0.108 pkgsrc-2024Q2-base:1.3 pkgsrc-2024Q1:1.3.0.106 pkgsrc-2024Q1-base:1.3 pkgsrc-2023Q4:1.3.0.104 pkgsrc-2023Q4-base:1.3 pkgsrc-2023Q3:1.3.0.102 pkgsrc-2023Q3-base:1.3 pkgsrc-2023Q2:1.3.0.100 pkgsrc-2023Q2-base:1.3 pkgsrc-2023Q1:1.3.0.98 pkgsrc-2023Q1-base:1.3 pkgsrc-2022Q4:1.3.0.96 pkgsrc-2022Q4-base:1.3 pkgsrc-2022Q3:1.3.0.94 pkgsrc-2022Q3-base:1.3 pkgsrc-2022Q2:1.3.0.92 pkgsrc-2022Q2-base:1.3 pkgsrc-2022Q1:1.3.0.90 pkgsrc-2022Q1-base:1.3 pkgsrc-2021Q4:1.3.0.88 pkgsrc-2021Q4-base:1.3 pkgsrc-2021Q3:1.3.0.86 pkgsrc-2021Q3-base:1.3 pkgsrc-2021Q2:1.3.0.84 pkgsrc-2021Q2-base:1.3 pkgsrc-2021Q1:1.3.0.82 pkgsrc-2021Q1-base:1.3 pkgsrc-2020Q4:1.3.0.80 pkgsrc-2020Q4-base:1.3 pkgsrc-2020Q3:1.3.0.78 pkgsrc-2020Q3-base:1.3 pkgsrc-2020Q2:1.3.0.74 pkgsrc-2020Q2-base:1.3 pkgsrc-2020Q1:1.3.0.54 pkgsrc-2020Q1-base:1.3 pkgsrc-2019Q4:1.3.0.76 pkgsrc-2019Q4-base:1.3 pkgsrc-2019Q3:1.3.0.72 pkgsrc-2019Q3-base:1.3 pkgsrc-2019Q2:1.3.0.70 pkgsrc-2019Q2-base:1.3 pkgsrc-2019Q1:1.3.0.68 pkgsrc-2019Q1-base:1.3 pkgsrc-2018Q4:1.3.0.66 pkgsrc-2018Q4-base:1.3 pkgsrc-2018Q3:1.3.0.64 pkgsrc-2018Q3-base:1.3 pkgsrc-2018Q2:1.3.0.62 pkgsrc-2018Q2-base:1.3 pkgsrc-2018Q1:1.3.0.60 pkgsrc-2018Q1-base:1.3 pkgsrc-2017Q4:1.3.0.58 pkgsrc-2017Q4-base:1.3 pkgsrc-2017Q3:1.3.0.56 pkgsrc-2017Q3-base:1.3 pkgsrc-2017Q2:1.3.0.52 pkgsrc-2017Q2-base:1.3 pkgsrc-2017Q1:1.3.0.50 pkgsrc-2017Q1-base:1.3 pkgsrc-2016Q4:1.3.0.48 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.46 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.44 pkgsrc-2016Q2-base:1.3 pkgsrc-2016Q1:1.3.0.42 pkgsrc-2016Q1-base:1.3 pkgsrc-2015Q4:1.3.0.40 pkgsrc-2015Q4-base:1.3 pkgsrc-2015Q3:1.3.0.38 pkgsrc-2015Q3-base:1.3 pkgsrc-2015Q2:1.3.0.36 pkgsrc-2015Q2-base:1.3 pkgsrc-2015Q1:1.3.0.34 pkgsrc-2015Q1-base:1.3 pkgsrc-2014Q4:1.3.0.32 pkgsrc-2014Q4-base:1.3 pkgsrc-2014Q3:1.3.0.30 pkgsrc-2014Q3-base:1.3 pkgsrc-2014Q2:1.3.0.28 pkgsrc-2014Q2-base:1.3 pkgsrc-2014Q1:1.3.0.26 pkgsrc-2014Q1-base:1.3 pkgsrc-2013Q4:1.3.0.24 pkgsrc-2013Q4-base:1.3 pkgsrc-2013Q3:1.3.0.22 pkgsrc-2013Q3-base:1.3 pkgsrc-2013Q2:1.3.0.20 pkgsrc-2013Q2-base:1.3 pkgsrc-2013Q1:1.3.0.18 pkgsrc-2013Q1-base:1.3 pkgsrc-2012Q4:1.3.0.16 pkgsrc-2012Q4-base:1.3 pkgsrc-2012Q3:1.3.0.14 pkgsrc-2012Q3-base:1.3 pkgsrc-2012Q2:1.3.0.12 pkgsrc-2012Q2-base:1.3 pkgsrc-2012Q1:1.3.0.10 pkgsrc-2012Q1-base:1.3 pkgsrc-2011Q4:1.3.0.8 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q3:1.3.0.6 pkgsrc-2011Q3-base:1.3 pkgsrc-2011Q2:1.3.0.4 pkgsrc-2011Q2-base:1.3 pkgsrc-2011Q1:1.3.0.2 pkgsrc-2011Q1-base:1.3 pkgsrc-2010Q4:1.2.0.4 pkgsrc-2010Q4-base:1.2 pkgsrc-2010Q3:1.2.0.2 pkgsrc-2010Q3-base:1.2 pkgsrc-2010Q2:1.1.0.22 pkgsrc-2010Q2-base:1.1 pkgsrc-2010Q1:1.1.0.20 pkgsrc-2010Q1-base:1.1 pkgsrc-2009Q4:1.1.0.18 pkgsrc-2009Q4-base:1.1 pkgsrc-2009Q3:1.1.0.16 pkgsrc-2009Q3-base:1.1 pkgsrc-2009Q2:1.1.0.14 pkgsrc-2009Q2-base:1.1 pkgsrc-2009Q1:1.1.0.12 pkgsrc-2009Q1-base:1.1 pkgsrc-2008Q4:1.1.0.10 pkgsrc-2008Q4-base:1.1 pkgsrc-2008Q3:1.1.0.8 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.6 cube-native-xorg-base:1.1 pkgsrc-2008Q2:1.1.0.4 pkgsrc-2008Q2-base:1.1 cwrapper:1.1.0.2; locks; strict; comment @# @; 1.3 date 2011.02.09.22.51.38; author rumko; state Exp; branches; next 1.2; 1.2 date 2010.09.18.20.48.23; author wiz; state Exp; branches; next 1.1; 1.1 date 2008.06.15.14.09.04; author peter; state Exp; branches; next ; desc @@ 1.3 log @sysutils/pftop: support newer PF and depend on osabi * In order for pftop to be built successfully with newer PF versions (> 4.1), additional patches are necessary which were taken from OpenBSD's ports as seen in PR pkg/44339 * Pftop compiled for another PF version will not work (properly), so to avoid any problems we must depend on the OS version ok@@ wiz @ text @$NetBSD: patch-ag,v 1.2 2010/09/18 20:48:23 wiz Exp $ $OpenBSD: patch-pftop_c,v 1.13 2009/12/02 22:59:29 sthen Exp $ * DragonFly compatibility * Patches to support PF > 4.1 taken from OpenBSD's ports. --- pftop.c.orig 2007-11-07 07:36:46 +0100 +++ pftop.c 2009-11-16 23:37:03 +0100 @@@@ -40,21 +40,41 @@@@ #include #define TCPSTATES #include +#ifdef __DragonFly__ +#include +#else #include +#endif /* !__DragonFly__ */ #include #ifdef HAVE_ALTQ +#ifdef __DragonFly__ +#include +#include +#include +#include +#else #include #include #include #include #endif +#ifdef ALTQT_FAIRQ +#ifdef __DragonFly__ +#include +#else +#include +#endif +#endif +#endif + #include #include #include #include #include +#include #include #include #include @@@@ -127,6 +147,13 @@@@ #define PT_NOROUTE(x) (0) #endif +#ifdef HAVE_NETWORK_ORDER +#define PF_TSTAMP(x) ntohl(x) +#else +#define PF_TSTAMP(x) (x) +#endif + + /* view management */ int select_states(void); int read_states(void); @@@@ -371,6 +398,9 @@@@ class_stats_t cbq_stats; struct priq_classstats priq_stats; struct hfsc_classstats hfsc_stats; +#ifdef ALTQT_FAIRQ + struct fairq_classstats fairq_stats; +#endif }; struct queue_stats { @@@@ -445,11 +475,11 @@@@ int sort_age_callback(const void *s1, const void *s2) { - if (state_buf[* (u_int32_t *) s2].creation > - state_buf[* (u_int32_t *) s1].creation) + if (PF_TSTAMP(state_buf[* (u_int32_t *) s2].creation) > + PF_TSTAMP(state_buf[* (u_int32_t *) s1].creation)) return sortdir; - if (state_buf[* (u_int32_t *) s2].creation < - state_buf[* (u_int32_t *) s1].creation) + if (PF_TSTAMP(state_buf[* (u_int32_t *) s2].creation) < + PF_TSTAMP(state_buf[* (u_int32_t *) s1].creation)) return -sortdir; return 0; } @@@@ -457,11 +487,11 @@@@ int sort_exp_callback(const void *s1, const void *s2) { - if (state_buf[* (u_int32_t *) s2].expire > - state_buf[* (u_int32_t *) s1].expire) + if (PF_TSTAMP(state_buf[* (u_int32_t *) s2].expire) > + PF_TSTAMP(state_buf[* (u_int32_t *) s1].expire)) return sortdir; - if (state_buf[* (u_int32_t *) s2].expire < - state_buf[* (u_int32_t *) s1].expire) + if (PF_TSTAMP(state_buf[* (u_int32_t *) s2].expire) < + PF_TSTAMP(state_buf[* (u_int32_t *) s1].expire)) return -sortdir; return 0; } @@@@ -535,6 +565,115 @@@@ return 0; } +#ifdef HAVE_PFSYNC_KEY + +#ifdef __GNUC__ +__inline__ +#endif +int +sort_addr_callback(const pf_state_t *s1, + const pf_state_t *s2, int dir) +{ + const struct pf_addr *aa, *ab; + u_int16_t pa, pb; + int af, ret, ii, io; + + af = s1->af; + + + if (af > s2->af) + return sortdir; + if (af < s2->af) + return -sortdir; + + ii = io = 0; + + if (dir == PF_OUT) /* looking for source addr */ + io = 1; + else /* looking for dest addr */ + ii = 1; + + if (s1->direction == PF_IN) { + aa = &s1->key[PF_SK_STACK].addr[ii]; + pa = s1->key[PF_SK_STACK].port[ii]; + } else { + aa = &s1->key[PF_SK_WIRE].addr[io]; + pa = s1->key[PF_SK_WIRE].port[io]; + } + + if (s2->direction == PF_IN) { + ab = &s2->key[PF_SK_STACK].addr[ii];; + pb = s2->key[PF_SK_STACK].port[ii]; + } else { + ab = &s2->key[PF_SK_WIRE].addr[io];; + pb = s2->key[PF_SK_WIRE].port[io]; + } + + ret = compare_addr(af, aa, ab); + if (ret) + return ret * sortdir; + + if (ntohs(pa) > ntohs(pb)) + return sortdir; + return -sortdir; +} + +#ifdef __GNUC__ +__inline__ +#endif +int +sort_port_callback(const pf_state_t *s1, + const pf_state_t *s2, int dir) +{ + const struct pf_addr *aa, *ab; + u_int16_t pa, pb; + int af, ret, ii, io; + + af = s1->af; + + + if (af > s2->af) + return sortdir; + if (af < s2->af) + return -sortdir; + + ii = io = 0; + + if (dir == PF_OUT) /* looking for source addr */ + io = 1; + else /* looking for dest addr */ + ii = 1; + + if (s1->direction == PF_IN) { + aa = &s1->key[PF_SK_STACK].addr[ii]; + pa = s1->key[PF_SK_STACK].port[ii]; + } else { + aa = &s1->key[PF_SK_WIRE].addr[io]; + pa = s1->key[PF_SK_WIRE].port[io]; + } + + if (s2->direction == PF_IN) { + ab = &s2->key[PF_SK_STACK].addr[ii];; + pb = s2->key[PF_SK_STACK].port[ii]; + } else { + ab = &s2->key[PF_SK_WIRE].addr[io];; + pb = s2->key[PF_SK_WIRE].port[io]; + } + + + if (ntohs(pa) > ntohs(pb)) + return sortdir; + if (ntohs(pa) < ntohs(pb)) + return - sortdir; + + ret = compare_addr(af, aa, ab); + if (ret) + return ret * sortdir; + return -sortdir; +} + +#else /* HAVE_PFSYNC_KEY */ + #ifdef __GNUC__ __inline__ #endif @@@@ -573,20 +712,6 @@@@ return -sortdir; } -int sort_sa_callback(const void *p1, const void *p2) -{ - pf_state_t *s1 = state_buf + (* (u_int32_t *) p1); - pf_state_t *s2 = state_buf + (* (u_int32_t *) p2); - return sort_addr_callback(s1, s2, PF_OUT); -} - -int sort_da_callback(const void *p1, const void *p2) -{ - pf_state_t *s1 = state_buf + (* (u_int32_t *) p1); - pf_state_t *s2 = state_buf + (* (u_int32_t *) p2); - return sort_addr_callback(s1, s2, PF_IN); -} - #ifdef __GNUC__ __inline__ #endif @@@@ -625,6 +750,21 @@@@ return sortdir; return -sortdir; } +#endif /* HAVE_PFSYNC_KEY */ + +int sort_sa_callback(const void *p1, const void *p2) +{ + pf_state_t *s1 = state_buf + (* (u_int32_t *) p1); + pf_state_t *s2 = state_buf + (* (u_int32_t *) p2); + return sort_addr_callback(s1, s2, PF_OUT); +} + +int sort_da_callback(const void *p1, const void *p2) +{ + pf_state_t *s1 = state_buf + (* (u_int32_t *) p1); + pf_state_t *s2 = state_buf + (* (u_int32_t *) p2); + return sort_addr_callback(s1, s2, PF_IN); +} int sort_sp_callback(const void *p1, const void *p2) @@@@ -736,7 +876,7 @@@@ } else { num_states = 0; for (n = 0; n 0) state_ord[num_states++] = n; } @@@@ -828,7 +968,7 @@@@ tbprintf(" PAUSED"); if (rawmode) - printf("\n\n%s\n", tmp_buf); + printf("\n%s", tmp_buf); else mvprintw(0, 0, "%s", tmp_buf); @@@@ -843,7 +983,10 @@@@ len = columns - strlen(tmp_buf); if (len < 0) len = 0; - mvprintw(0, len, "%s", tmp_buf); + if (rawmode) + printf(" %s\n", tmp_buf); + else + mvprintw(0, len, "%s", tmp_buf); } tb_end(); @@@@ -865,7 +1008,48 @@@@ tbprintf("/%u", unmask(mask, af)); } } +#ifdef HAVE_PFSYNC_KEY +void +print_fld_host2(field_def *fld, struct pfsync_state_key *ks, + struct pfsync_state_key *kn, int idx, int af) +{ + struct pf_addr *as = &ks->addr[idx]; + struct pf_addr *an = &kn->addr[idx]; + + u_int16_t ps = ntohs(ks->port[idx]); + u_int16_t pn = ntohs(kn->port[idx]); + + if (fld == NULL) + return; + + if (fld->width < 3) { + print_fld_str(fld, "*"); + return; + } + + tb_start(); + tb_print_addr(as, NULL, af); + + if (af == AF_INET) + tbprintf(":%u", ps); + else + tbprintf("[%u]", ps); + + print_fld_tb(fld); + + if (PF_ANEQ(as, an, af) || ps != pn) { + tb_start(); + tb_print_addr(an, NULL, af); + if (af == AF_INET) + tbprintf(":%u", pn); + else + tbprintf("[%u]", pn); + print_fld_tb(FLD_GW); + } + +} +#else void print_fld_host(field_def *fld, pf_state_host_t * h, int af) { @@@@ -889,6 +1073,7 @@@@ print_fld_tb(fld); } +#endif void print_fld_state(field_def *fld, unsigned int proto, @@@@ -960,6 +1145,19 @@@@ else print_fld_uint(FLD_PROTO, s->proto); +#ifdef HAVE_PFSYNC_KEY + if (s->direction == PF_OUT) { + print_fld_host2(FLD_SRC, &s->key[PF_SK_WIRE], + &s->key[PF_SK_STACK], 1, s->af); + print_fld_host2(FLD_DEST, &s->key[PF_SK_WIRE], + &s->key[PF_SK_STACK], 0, s->af); + } else { + print_fld_host2(FLD_SRC, &s->key[PF_SK_STACK], + &s->key[PF_SK_WIRE], 0, s->af); + print_fld_host2(FLD_DEST, &s->key[PF_SK_STACK], + &s->key[PF_SK_WIRE], 1, s->af); + } +#else if (s->direction == PF_OUT) { print_fld_host(FLD_SRC, &s->lan, s->af); print_fld_host(FLD_DEST, &s->ext, s->af); @@@@ -972,6 +1170,7 @@@@ (s->lan.port != s->gwy.port)) { print_fld_host(FLD_GW, &s->gwy, s->af); } +#endif if (s->direction == PF_OUT) print_fld_str(FLD_DIR, "Out"); @@@@ -979,8 +1178,8 @@@@ print_fld_str(FLD_DIR, "In"); print_fld_state(FLD_STATE, s->proto, src->state, dst->state); - print_fld_age(FLD_AGE, s->creation); - print_fld_age(FLD_EXP, s->expire); + print_fld_age(FLD_AGE, PF_TSTAMP(s->creation)); + print_fld_age(FLD_EXP, PF_TSTAMP(s->expire)); #ifdef HAVE_INOUT_COUNT { u_int64_t sz = COUNTER(s->bytes[0]) + COUNTER(s->bytes[1]); @@@@ -988,14 +1187,14 @@@@ print_fld_size(FLD_PKTS, COUNTER(s->packets[0]) + COUNTER(s->packets[1])); print_fld_size(FLD_BYTES, sz); - print_fld_rate(FLD_SA, (s->creation > 0) ? - ((double)sz/(double)s->creation) : -1); + print_fld_rate(FLD_SA, (s->creation) ? + ((double)sz/PF_TSTAMP((double)s->creation)) : -1); } #else print_fld_size(FLD_PKTS, s->packets); print_fld_size(FLD_BYTES, s->bytes); - print_fld_rate(FLD_SA, (s->creation > 0) ? - ((double)s->bytes/(double)s->creation) : -1); + print_fld_rate(FLD_SA, (s->creation) ? + ((double)s->bytes/PF_TSTAMP((double)s->creation)) : -1); #endif #ifdef HAVE_PFSYNC_STATE @@@@ -1244,7 +1443,6 @@@@ FLD_ANCHOR->max_width = mx; FLD_ANCHOR->norm_width = nx; field_setup(); - need_update = 1; } } #endif @@@@ -1279,7 +1477,6 @@@@ FLD_LABEL->norm_width = nw; FLD_LABEL->max_width = mw; field_setup(); - need_update = 1; } } #endif @@@@ -1458,8 +1655,9 @@@@ void print_rule(struct pf_rule *pr) { - static const char *actiontypes[] = { "Pass", "Block", "Scrub", "Nat", - "no Nat", "Binat", "no Binat", "Rdr", "no Rdr" }; + static const char *actiontypes[] = { "Pass", "Block", "Scrub", + "no Scrub", "Nat", "no Nat", "Binat", "no Binat", "Rdr", + "no Rdr", "SynProxy Block", "Defer", "Match" }; int numact = sizeof(actiontypes) / sizeof(char *); #ifdef HAVE_PF_ROUTE @@@@ -1475,8 +1673,12 @@@@ print_fld_str(FLD_LABEL, pr->label); #endif #ifdef HAVE_RULE_STATES +#ifdef HAVE_PFSYNC_KEY + print_fld_size(FLD_STATS, pr->states_tot); +#else print_fld_size(FLD_STATS, pr->states); #endif +#endif #ifdef HAVE_INOUT_COUNT_RULES print_fld_size(FLD_PKTS, pr->packets[0] + pr->packets[1]); @@@@ -1486,7 +1688,13 @@@@ print_fld_size(FLD_BYTES, pr->bytes); #endif print_fld_uint(FLD_RULE, pr->nr); - print_fld_str(FLD_DIR, pr->direction == PF_OUT ? "Out" : "In"); + if (pr->direction == PF_OUT) + print_fld_str(FLD_DIR, "Out"); + else if (pr->direction == PF_IN) + print_fld_str(FLD_DIR, "In"); + else + print_fld_str(FLD_DIR, "Any"); + if (pr->quick) print_fld_str(FLD_QUICK, "Quick"); @@@@ -1729,12 +1937,19 @@@@ prev->next = node; } } - if (*root != node) { - struct pf_altq_node *prev_flat = *root; - while (prev_flat->next_flat != NULL) { - prev_flat = prev_flat->next_flat; - } - prev_flat->next_flat = node; +} + +void +pfctl_set_next_flat(struct pf_altq_node *node, struct pf_altq_node *up) +{ + while (node) { + struct pf_altq_node *next = node->next ? node->next : up; + if (node->children) { + node->next_flat = node->children; + pfctl_set_next_flat(node->children, next); + } else + node->next_flat = next; + node = node->next; } } @@@@ -1747,6 +1962,7 @@@@ u_int32_t nr; struct queue_stats qstats; u_int32_t nr_queues; + int ret = 0; *inserts = 0; memset(&pa, 0, sizeof(pa)); @@@@ -1757,13 +1973,15 @@@@ strerror(errno)); return (-1); } + num_queues = nr_queues = pa.nr; for (nr = 0; nr < nr_queues; ++nr) { pa.nr = nr; if (ioctl(pf_dev, DIOCGETALTQ, &pa)) { msgprintf("Error Reading Queue (DIOCGETALTQ): %s", strerror(errno)); - return (-1); + ret = -1; + break; } if (pa.altq.qid > 0) { pq.nr = nr; @@@@ -1773,7 +1991,8 @@@@ if (ioctl(pf_dev, DIOCGETQSTATS, &pq)) { msgprintf("Error Reading Queue (DIOCGETQSTATS): %s", strerror(errno)); - return (-1); + ret = -1; + break; } qstats.valid = 1; gettimeofday(&qstats.timestamp, NULL); @@@@ -1794,7 +2013,10 @@@@ else --num_queues; } - return (0); + + pfctl_set_next_flat(*root, NULL); + + return (ret); } void @@@@ -1924,6 +2146,10 @@@@ node->altq.scheduler == ALTQT_HFSC ) print_fld_bw(FLD_BANDW, (double)node->altq.bandwidth); +#ifdef ALTQT_FAIRQ + if (node->altq.scheduler == ALTQT_FAIRQ) + print_fld_bw(FLD_BANDW, (double)node->altq.bandwidth); +#endif if (node->altq.priority != DEFAULT_PRIORITY) print_fld_uint(FLD_PRIO, @@@@ -1992,6 +2218,26 @@@@ node->qstats_last.data.hfsc_stats.xmit_cnt.bytes, interval); } break; +#ifdef ALTQT_FAIRQ + case ALTQT_FAIRQ: + print_fld_str(FLD_SCHED, "fairq"); + print_fld_size(FLD_PKTS, + node->qstats.data.fairq_stats.xmit_cnt.packets); + print_fld_size(FLD_BYTES, + node->qstats.data.fairq_stats.xmit_cnt.bytes); + print_fld_size(FLD_DROPP, + node->qstats.data.fairq_stats.drop_cnt.packets); + print_fld_size(FLD_DROPB, + node->qstats.data.fairq_stats.drop_cnt.bytes); + print_fld_size(FLD_QLEN, node->qstats.data.fairq_stats.qlength); + if (interval > 0) { + pps = calc_pps(node->qstats.data.fairq_stats.xmit_cnt.packets, + node->qstats_last.data.fairq_stats.xmit_cnt.packets, interval); + bps = calc_rate(node->qstats.data.fairq_stats.xmit_cnt.bytes, + node->qstats_last.data.fairq_stats.xmit_cnt.bytes, interval); + } + break; +#endif } /* if (node->altq.scheduler != ALTQT_HFSC && interval > 0) { */ @@@@ -2041,11 +2287,9 @@@@ if (cachestates) { show_field(FLD_SI); show_field(FLD_SP); - gotsig_alarm = 1; } else { hide_field(FLD_SI); hide_field(FLD_SP); - need_update = 1; } field_setup(); } @@@@ -2105,8 +2349,10 @@@@ line++; mvprintw(line++, 6, "press any key to continue ..."); - while (getch() == ERR); - + timeout(-1); + while (getch() == ERR) + continue; + timeout(0); } @@@@ -2142,7 +2388,6 @@@@ del = atoi(cmdbuf); if (del > 0) { delay = del; - gotsig_alarm = 1; } } @@@@ -2175,7 +2420,6 @@@@ /* FALLTHROUGH */ case 'h': show_help(); - need_update = 1; break; case 'n': command_set(&cm_count, NULL); @@@@ -2349,8 +2593,6 @@@@ if (rawmode && countmax == 0) countmax = 1; - gotsig_alarm = 1; - engine_loop(countmax); close(pf_dev); @ 1.2 log @DragonFly fixes from Rumko in PR 42345. @ text @d1 5 a5 1 $NetBSD: patch-ag,v 1.1 2008/06/15 14:09:04 peter Exp $ d51 15 a65 1 @@@@ -371,6 +391,9 @@@@ d75 192 a266 1 @@@@ -736,7 +759,7 @@@@ d275 1 a275 1 @@@@ -828,7 +851,7 @@@@ d284 1 a284 1 @@@@ -843,7 +866,10 @@@@ d296 116 a411 1 @@@@ -1244,7 +1270,6 @@@@ d419 1 a419 1 @@@@ -1279,7 +1304,6 @@@@ d427 114 a540 1 @@@@ -1924,6 +1948,10 @@@@ d551 1 a551 1 @@@@ -1992,6 +2020,26 @@@@ d578 1 a578 1 @@@@ -2041,11 +2089,9 @@@@ d590 1 a590 1 @@@@ -2105,8 +2151,10 @@@@ d603 1 a603 1 @@@@ -2142,7 +2190,6 @@@@ d611 1 a611 1 @@@@ -2175,7 +2222,6 @@@@ d619 1 a619 1 @@@@ -2349,8 +2395,6 @@@@ @ 1.1 log @Update pftop to version 0.7. Tested on NetBSD 3.1, 4.0 and yamt-pf42. Changes in version 0.7: This version adds state filtering, which is funded by backcountry.com, many thanks. It is now possible to select which states are displayed using a tcpdump(8) like filtering language. The filter can be specified on the command line, using the '-f' switch. It is also possible to change the filter interactively using the 'f' command key. Some sample, not necessarily practical, filters are given below: - Do not show pfsync or carp traffic: not (pfsync or carp) not pfsync and not carp - DNS traffic not going to or coming from the DNS servers: port 53 and not host (10.0.0.10 or 10.0.0.11) - States with input bytes greater than 1M: inb > 1000000 - Traffic with very small average packet size: ((inb / inp) + (outb / outp))/2 < 100 inb / inp + outb / outp < 200 Changes in version 0.6: No functional changes. It now compiles and runs on OpenBSD 4.1-current after pf interface changes. This version also contains separated pf and display code. This should make adding new views easier. Changes in version 0.5: This version displays all active pf rules by traversing the ruleset tree. In addition HFSC queues are now displayed correctly thanks to Jared Spiegel. This version also incorporates other patches and comments I have received since the previous release. Many thanks to all who have contributed. - New command-line switch 'S' to start the display at a given state. - Display HFCS statistics in the queue page. - Fixed state and rule byte and packet counters - Fixed state sorting by packets and bytes - Fixed some minor display problems - The rule view now traverses all rulesets, and displays all active rules, together with anchor (ruleset) names. - Anchor and Label fields dynamically resize themselves @ text @d1 1 a1 1 $NetBSD$ d3 3 a5 3 --- pftop.c.old 2008-06-14 17:41:08.000000000 +0200 +++ pftop.c 2008-06-15 12:42:06.000000000 +0200 @@@@ -40,7 +40,11 @@@@ d17 23 a39 1 @@@@ -55,6 +59,7 @@@@ d47 11 a57 1 @@@@ -736,7 +741,7 @@@@ d66 1 a66 1 @@@@ -828,7 +833,7 @@@@ d75 1 a75 1 @@@@ -843,7 +848,10 @@@@ d87 1 a87 1 @@@@ -1244,7 +1252,6 @@@@ d95 1 a95 1 @@@@ -1279,7 +1286,6 @@@@ d103 39 a141 1 @@@@ -2041,11 +2047,9 @@@@ d153 1 a153 1 @@@@ -2105,8 +2109,10 @@@@ d166 1 a166 1 @@@@ -2142,7 +2148,6 @@@@ d174 1 a174 1 @@@@ -2175,7 +2180,6 @@@@ d182 1 a182 1 @@@@ -2349,8 +2353,6 @@@@ @