diff --git a/sysutils/pftop/Makefile b/sysutils/pftop/Makefile index fabc231849d8..a48c78026d7c 100644 --- a/sysutils/pftop/Makefile +++ b/sysutils/pftop/Makefile @@ -1,6 +1,5 @@ PORTNAME= pftop -PORTVERSION= 0.8 -PORTREVISION= 4 +PORTVERSION= 0.9 CATEGORIES= sysutils net MAINTAINER= grembo@FreeBSD.org @@ -9,68 +8,33 @@ WWW= https://github.com/grembo/pftop/ LICENSE= BSD2CLAUSE +LIB_DEPENDS= libpfctl.so:net/libpfctl + USE_GITHUB= yes GH_ACCOUNT= grembo +CFLAGS+= -I${LOCALBASE}/include +LDFLAGS+= -L${LOCALBASE}/lib -lpfctl + OPTIONS_DEFINE= ALTQ ALTQ_DESC= ALTQ support for queue statistics .include -EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bpf_dump.c \ - ${FILESDIR}/extra-patch-sf-gencode.h - -MAKE_ARGS= LOCALBASE="${PREFIX}" \ - -.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400090 -MAKE_ARGS+= OSLEVEL=46 -.else -MAKE_ARGS+= OSLEVEL=45 -.endif +MAKE_ARGS= LOCALBASE="${PREFIX}" -CFLAGS+= -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1 \ - -DHAVE_FINE_GRAINED_LOCKING=1 +CFLAGS+= -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1 .if ${PORT_OPTIONS:MALTQ} CFLAGS+= -DHAVE_ALTQ=1 .endif -EXTRA_PATCHES+= ${FILESDIR}/extra-patch-cache.c ${FILESDIR}/extra-patch-cache.h \ - ${FILESDIR}/extra-patch-config.h \ - ${FILESDIR}/extra-patch-pftop.c \ - ${FILESDIR}/extra-patch-sf-gencode.c - -EXTRA_PATCHES+= ${FILESDIR}/extra-patch-engine.c - MAKE_ARGS+= CSTD=gnu89 MAKE_ENV+= __MAKE_CONF=/dev/null -PLIST_FILES= sbin/pftop \ - man/man8/pftop.8.gz - -post-patch: - @${ECHO_MSG} "===> Applying FairQ/Codel patches to ${PORTNAME}." - @${CAT} ${FILESDIR}/extra-patch-fairq_codel.diff | \ - ${PATCH} -d ${PATCH_WRKSRC} ${PATCH_ARGS} - @${REINPLACE_CMD} -e 's||"${FILESDIR}/queue.h"|g' \ - ${WRKSRC}/engine.c - @${REINPLACE_CMD} -e 's|__dead|__dead2|g' \ - ${WRKSRC}/sf-gencode.h - @${REINPLACE_CMD} -e 's|__dead|__dead2|g' \ - ${WRKSRC}/sf-gencode.c - @${REINPLACE_CMD} -e 's|#include ||g' \ - ${WRKSRC}/sf-gencode.c - @${REINPLACE_CMD} -e 's|altq/|net/&|' \ - ${WRKSRC}/pftop.c - @${REINPLACE_CMD} -e 's|#include .pcap-int.h.|#include |g' \ - ${WRKSRC}/bpf_image.c \ - ${WRKSRC}/bpf_optimize.c \ - ${WRKSRC}/pcap-nametoaddr.c \ - ${WRKSRC}/sf-gencode.c \ - ${WRKSRC}/sf-gencode.h \ - ${WRKSRC}/sf-grammer.y \ - ${WRKSRC}/sf-scanner.l +PLIST_FILES= man/man8/pftop.8.gz \ + sbin/pftop do-install: ${INSTALL_PROGRAM} ${WRKSRC}/pftop \ diff --git a/sysutils/pftop/distinfo b/sysutils/pftop/distinfo index 945fc7dc87e6..cdc0c5c4a12a 100644 --- a/sysutils/pftop/distinfo +++ b/sysutils/pftop/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1654618929 -SHA256 (grembo-pftop-0.8_GH0.tar.gz) = 72b2ed39664771c22689ccb5ec7098792335717d926a8b87d987d8b628902d65 -SIZE (grembo-pftop-0.8_GH0.tar.gz) = 59599 +TIMESTAMP = 1699105116 +SHA256 (grembo-pftop-0.9_GH0.tar.gz) = 9b2dd44dba66c228ae03a88d65e6424f42872d2d73be776e055c5005998731d9 +SIZE (grembo-pftop-0.9_GH0.tar.gz) = 62612 diff --git a/sysutils/pftop/files/extra-patch-bpf_dump.c b/sysutils/pftop/files/extra-patch-bpf_dump.c deleted file mode 100644 index cc31af8c928a..000000000000 --- a/sysutils/pftop/files/extra-patch-bpf_dump.c +++ /dev/null @@ -1,15 +0,0 @@ ---- bpf_dump.c.orig 2007-11-07 07:34:18.000000000 +0100 -+++ bpf_dump.c 2014-10-17 12:39:01.000000000 +0200 -@@ -33,10 +33,10 @@ - #include - - --extern void bpf_dump(struct bpf_program *, int); -+extern void bpf_dump(const struct bpf_program *, int); - - void --bpf_dump(struct bpf_program *p, int option) -+bpf_dump(const struct bpf_program *p, int option) - { - struct bpf_insn *insn; - int i; diff --git a/sysutils/pftop/files/extra-patch-cache.c b/sysutils/pftop/files/extra-patch-cache.c deleted file mode 100644 index 8a345a3f3d8b..000000000000 --- a/sysutils/pftop/files/extra-patch-cache.c +++ /dev/null @@ -1,84 +0,0 @@ -# Adjusted to work with the changes in r240233. -$OpenBSD: patch-cache_c,v 1.1 2008/06/13 00:38:12 canacar Exp $ ---- cache.c.orig Tue Nov 6 23:34:18 2007 -+++ cache.c Wed Jun 11 19:50:07 2008 -@@ -118,12 +118,21 @@ - - cache_size--; - -+#ifdef HAVE_PFSYNC_STATE -+#ifdef HAVE_FINE_GRAINED_LOCKING -+ ent->id = st->id; -+#else -+ ent->id[0] = st->id[0]; -+ ent->id[1] = st->id[1]; -+#endif -+#else - ent->addr[0] = st->lan.addr; - ent->port[0] = st->lan.port; - ent->addr[1] = st->ext.addr; - ent->port[1] = st->ext.port; - ent->af = st->af; - ent->proto = st->proto; -+#endif - #ifdef HAVE_INOUT_COUNT - ent->bytes = COUNTER(st->bytes[0]) + COUNTER(st->bytes[1]); - #else -@@ -147,13 +156,21 @@ - if (cache_max == 0) - return (NULL); - -+#ifdef HAVE_PFSYNC_STATE -+#ifdef HAVE_FINE_GRAINED_LOCKING -+ ent.id = st->id; -+#else -+ ent.id[0] = st->id[0]; -+ ent.id[1] = st->id[1]; -+#endif -+#else - ent.addr[0] = st->lan.addr; - ent.port[0] = st->lan.port; - ent.addr[1] = st->ext.addr; - ent.port[1] = st->ext.port; - ent.af = st->af; - ent.proto = st->proto; -- -+#endif - old = RB_FIND(sc_tree, &sctree, &ent); - - if (old == NULL) { -@@ -210,8 +227,25 @@ - static __inline int - sc_cmp(struct sc_ent *a, struct sc_ent *b) - { -+#ifdef HAVE_PFSYNC_STATE -+#ifdef HAVE_FINE_GRAINED_LOCKING -+ if (a->id > b->id) -+ return (1); -+ if (a->id < b->id) -+ return (-1); -+#else -+ if (a->id[0] > b->id[0]) -+ return (1); -+ if (a->id[0] < b->id[0]) -+ return (-1); -+ if (a->id[1] > b->id[1]) -+ return (1); -+ if (a->id[1] < b->id[1]) -+ return (-1); -+#endif -+#else - int diff; -- -+ - if ((diff = a->proto - b->proto) != 0) - return (diff); - if ((diff = a->af - b->af) != 0) -@@ -269,6 +303,6 @@ - return (diff); - if ((diff = a->port[1] - b->port[1]) != 0) - return (diff); -- -+#endif - return (0); - } diff --git a/sysutils/pftop/files/extra-patch-cache.h b/sysutils/pftop/files/extra-patch-cache.h deleted file mode 100644 index 4d6e3ac9d82d..000000000000 --- a/sysutils/pftop/files/extra-patch-cache.h +++ /dev/null @@ -1,29 +0,0 @@ -# Adjusted to work with FreeBSD r240233. -$OpenBSD: patch-cache_h,v 1.1 2008/06/13 00:38:12 canacar Exp $ ---- cache.h.orig Tue Nov 6 23:34:18 2007 -+++ cache.h Wed Jun 11 19:50:07 2008 -@@ -31,14 +31,24 @@ - struct sc_ent { - RB_ENTRY(sc_ent) tlink; - TAILQ_ENTRY(sc_ent) qlink; -+#ifdef HAVE_PFSYNC_STATE -+#ifdef HAVE_FINE_GRAINED_LOCKING -+ u_int64_t id; -+#else -+ u_int32_t id[2]; -+#endif -+#else - struct pf_addr addr[2]; -+#endif - double peak; - double rate; - time_t t; - u_int32_t bytes; -+#ifndef HAVE_PFSYNC_STATE - u_int16_t port[2]; - u_int8_t af; - u_int8_t proto; -+#endif - }; - - int cache_init(int); diff --git a/sysutils/pftop/files/extra-patch-config.h b/sysutils/pftop/files/extra-patch-config.h deleted file mode 100644 index ecd30c862dad..000000000000 --- a/sysutils/pftop/files/extra-patch-config.h +++ /dev/null @@ -1,28 +0,0 @@ -$OpenBSD: patch-config_h,v 1.4 2008/12/20 04:36:11 canacar Exp $ ---- config.h.orig Tue Nov 6 22:34:18 2007 -+++ config.h Fri Dec 19 20:28:01 2008 -@@ -74,11 +74,24 @@ - #define HAVE_PFSYNC_STATE - #endif - -+#if OS_LEVEL > 43 -+#define HAVE_PFSYNC_KEY -+#define HAVE_NETWORK_ORDER -+#endif -+ - #ifdef HAVE_PFSYNC_STATE -+#if OS_LEVEL > 45 -+typedef struct pfsync_state_1301 pf_state_t; -+#else - typedef struct pfsync_state pf_state_t; -+#endif - typedef struct pfsync_state_host pf_state_host_t; - typedef struct pfsync_state_peer pf_state_peer_t; -+#ifdef HAVE_NETWORK_ORDER -+#define COUNTER(c) ((((u_int64_t) ntohl(c[0]))<<32) + ntohl(c[1])) -+#else - #define COUNTER(c) ((((u_int64_t) c[0])<<32) + c[1]) -+#endif - #define pfs_ifname ifname - #else - typedef struct pf_state pf_state_t; diff --git a/sysutils/pftop/files/extra-patch-engine.c b/sysutils/pftop/files/extra-patch-engine.c deleted file mode 100644 index 329d307fc1fc..000000000000 --- a/sysutils/pftop/files/extra-patch-engine.c +++ /dev/null @@ -1,13 +0,0 @@ -$OpenBSD: patch-engine_c,v 1.1 2008/06/13 00:38:12 canacar Exp $ ---- engine.c.orig Tue Nov 6 23:35:44 2007 -+++ engine.c Thu Jun 12 17:49:32 2008 -@@ -809,6 +809,9 @@ next_order(void) - { - order_type *o, *oc; - -+ if (curr_view->mgr->order_list == NULL) -+ return; -+ - oc = curr_view->mgr->order_curr; - - for (o = curr_view->mgr->order_list; o->name != NULL; o++) { diff --git a/sysutils/pftop/files/extra-patch-fairq_codel.diff b/sysutils/pftop/files/extra-patch-fairq_codel.diff deleted file mode 100644 index 3c501b15f501..000000000000 --- a/sysutils/pftop/files/extra-patch-fairq_codel.diff +++ /dev/null @@ -1,102 +0,0 @@ ---- pftop.c.orig 2013-05-11 12:53:55.000000000 +0000 -+++ pftop.c 2013-05-11 12:54:00.000000000 +0000 -@@ -48,6 +48,8 @@ - #include - #include - #include -+#include -+#include - #endif - - #include -@@ -371,6 +373,8 @@ - class_stats_t cbq_stats; - struct priq_classstats priq_stats; - struct hfsc_classstats hfsc_stats; -+ struct fairq_classstats fairq_stats; -+ struct codel_ifstats codel_stats; - }; - - struct queue_stats { -@@ -1764,6 +1768,8 @@ - return (-1); - } - num_queues = nr_queues = pa.nr; -+ if (pa.altq.scheduler == ALTQT_CODEL) -+ num_queues = 1; - for (nr = 0; nr < nr_queues; ++nr) { - pa.nr = nr; - if (ioctl(pf_dev, DIOCGETALTQ, &pa)) { -@@ -1772,10 +1778,10 @@ - return (-1); - } - #ifdef PFALTQ_FLAG_IF_REMOVED -- if (pa.altq.qid > 0 && -+ if ((pa.altq.qid > 0 || pa.altq.scheduler == ALTQT_CODEL) && - !(pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED)) { - #else -- if (pa.altq.qid > 0) { -+ if (pa.altq.qid > 0 || pa.altq.scheduler == ALTQT_CODEL) { - #endif - pq.nr = nr; - pq.ticket = pa.ticket; -@@ -1928,11 +1934,14 @@ - tb_start(); - for (d = 0; d < node->depth; d++) - tbprintf(" "); -- tbprintf(node->altq.qname); -+ if (node->altq.qname[0] != '\0') -+ tbprintf(node->altq.qname); -+ else -+ tbprintf("root"); - print_fld_tb(FLD_QUEUE); - - if (node->altq.scheduler == ALTQT_CBQ || -- node->altq.scheduler == ALTQT_HFSC -+ node->altq.scheduler == ALTQT_HFSC || node->altq.scheduler == ALTQT_FAIRQ || node->altq.scheduler == ALTQT_CODEL - ) - print_fld_bw(FLD_BANDW, (double)node->altq.bandwidth); - -@@ -2003,6 +2012,42 @@ - node->qstats_last.data.hfsc_stats.xmit_cnt.bytes, interval); - } - break; -+ 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; -+ case ALTQT_CODEL: -+ print_fld_str(FLD_SCHED, "codel"); -+ print_fld_size(FLD_PKTS, -+ node->qstats.data.codel_stats.cl_xmitcnt.packets); -+ print_fld_size(FLD_BYTES, -+ node->qstats.data.codel_stats.cl_xmitcnt.bytes); -+ print_fld_size(FLD_DROPP, -+ node->qstats.data.codel_stats.cl_dropcnt.packets); -+ print_fld_size(FLD_DROPB, -+ node->qstats.data.codel_stats.cl_dropcnt.bytes); -+ print_fld_size(FLD_QLEN, node->qstats.data.codel_stats.qlength); -+ if (interval > 0) { -+ pps = calc_pps(node->qstats.data.codel_stats.cl_xmitcnt.packets, -+ node->qstats_last.data.codel_stats.cl_xmitcnt.packets, interval); -+ bps = calc_rate(node->qstats.data.codel_stats.cl_xmitcnt.bytes, -+ node->qstats_last.data.codel_stats.cl_xmitcnt.bytes, interval); -+ } -+ break; - } - - /* if (node->altq.scheduler != ALTQT_HFSC && interval > 0) { */ diff --git a/sysutils/pftop/files/extra-patch-pftop.c b/sysutils/pftop/files/extra-patch-pftop.c deleted file mode 100644 index c066876c4b5c..000000000000 --- a/sysutils/pftop/files/extra-patch-pftop.c +++ /dev/null @@ -1,426 +0,0 @@ -# One chunk of this OpenBSD patch has been removed as it's -# already part of patch-pftop.c, another one has been extended -# to fix the rule display in some views. -$OpenBSD: patch-pftop_c,v 1.12 2009/12/02 21:16:10 sthen Exp $ ---- pftop.c.orig Wed Nov 7 06:36:46 2007 -+++ pftop.c Wed Dec 2 21:14:56 2009 -@@ -127,6 +127,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); -@@ -445,11 +452,11 @@ sort_pkt_callback(const void *s1, const void *s2) - 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 +464,11 @@ sort_age_callback(const void *s1, const void *s2) - 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 +542,8 @@ compare_addr(int af, const struct pf_addr *a, const st - return 0; - } - -+#ifdef HAVE_PFSYNC_KEY -+ - #ifdef __GNUC__ - __inline__ - #endif -@@ -542,6 +551,113 @@ 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 -+int -+sort_addr_callback(const pf_state_t *s1, -+ const pf_state_t *s2, int dir) -+{ - const pf_state_host_t *a, *b; - int af, ret; - -@@ -573,20 +689,6 @@ sort_addr_callback(const pf_state_t *s1, - 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,7 +727,22 @@ sort_port_callback(const pf_state_t *s1, - 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) - { -@@ -865,7 +982,48 @@ tb_print_addr(struct pf_addr * addr, struct pf_addr * - 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 +1047,7 @@ print_fld_host(field_def *fld, pf_state_host_t * h, in - - print_fld_tb(fld); - } -+#endif - - void - print_fld_state(field_def *fld, unsigned int proto, -@@ -960,7 +1119,20 @@ print_state(pf_state_t * s, struct sc_ent * ent) - 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); - } else { -@@ -972,6 +1144,7 @@ print_state(pf_state_t * s, struct sc_ent * ent) - (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 +1152,8 @@ print_state(pf_state_t * s, struct sc_ent * ent) - 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,18 +1161,18 @@ print_state(pf_state_t * s, struct sc_ent * ent) - 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(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(s->creation)) : -1); - - #endif - #ifdef HAVE_PFSYNC_STATE -- print_fld_uint(FLD_RULE, s->rule); -+ print_fld_uint(FLD_RULE, ntohl(s->rule)); - #else - #ifdef HAVE_RULE_NUMBER - print_fld_uint(FLD_RULE, s->rule.nr); -@@ -1475,8 +1648,12 @@ print_rule(struct pf_rule *pr) - print_fld_str(FLD_LABEL, pr->label); - #endif - #ifdef HAVE_RULE_STATES -+#ifdef HAVE_PFSYNC_KEY -+ print_fld_size(FLD_STATS, pr->u_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]); -@@ -1729,12 +1912,19 @@ pfctl_insert_altq_node(struct pf_altq_node **root, - 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 +1937,7 @@ pfctl_update_qstats(struct pf_altq_node **root, int *i - 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 +1948,15 @@ pfctl_update_qstats(struct pf_altq_node **root, int *i - 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 +1966,8 @@ pfctl_update_qstats(struct pf_altq_node **root, int *i - 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 +1988,10 @@ pfctl_update_qstats(struct pf_altq_node **root, int *i - else - --num_queues; - } -- return (0); -+ -+ pfctl_set_next_flat(*root, NULL); -+ -+ return (ret); - } - - void diff --git a/sysutils/pftop/files/extra-patch-sf-gencode.c b/sysutils/pftop/files/extra-patch-sf-gencode.c deleted file mode 100644 index b9155667393a..000000000000 --- a/sysutils/pftop/files/extra-patch-sf-gencode.c +++ /dev/null @@ -1,352 +0,0 @@ -$OpenBSD: patch-sf-gencode_c,v 1.1 2008/06/13 00:38:12 canacar Exp $ ---- sf-gencode.c.orig Tue Nov 6 23:34:18 2007 -+++ sf-gencode.c Wed Jun 11 19:50:10 2008 -@@ -474,9 +474,107 @@ gen_proto(int proto) - (bpf_int32)proto)); - } - -+#ifdef HAVE_PFSYNC_KEY - static struct block * - gen_hostop(bpf_u_int32 addr, bpf_u_int32 mask, int dir) - { -+ struct block *b0, *b1, *b2, *bi, *bo; -+ const static int isrc_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[0].v4); -+ const static int osrc_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[1].v4); -+ const static int idst_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[1].v4); -+ const static int odst_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[0].v4); -+ -+ const static int igwy1_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[0].v4); -+ const static int ogwy1_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[1].v4); -+ const static int igwy2_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[1].v4); -+ const static int ogwy2_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[0].v4); -+ -+ addr = ntohl(addr); -+ mask = ntohl(mask); -+ -+ bi = gen_cmp(offsetof(pf_state_t, direction), BPF_B, (bpf_int32)PF_IN); -+ bo = gen_cmp(offsetof(pf_state_t, direction), BPF_B, (bpf_int32)PF_OUT); -+ -+ switch (dir) { -+ -+ case Q_SRC: -+ b1 = gen_mcmp(osrc_off, BPF_W, addr, mask); -+ gen_and(bo, b1); -+ b0 = gen_mcmp(isrc_off, BPF_W, addr, mask); -+ gen_and(bi, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_DST: -+ b1 = gen_mcmp(odst_off, BPF_W, addr, mask); -+ gen_and(bo, b1); -+ b0 = gen_mcmp(idst_off, BPF_W, addr, mask); -+ gen_and(bi, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_GATEWAY: -+ /* (in && (addr == igwy1 || addr == igwy2)) || -+ (out && (addr == ogwy1 || addr == ogwy2)) phew! */ -+ b1 = gen_mcmp(igwy1_off, BPF_W, addr, mask); -+ b0 = gen_mcmp(igwy2_off, BPF_W, addr, mask); -+ gen_or(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_mcmp(ogwy1_off, BPF_W, addr, mask); -+ b0 = gen_mcmp(ogwy2_off, BPF_W, addr, mask); -+ gen_or(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_AND: -+ b1 = gen_mcmp(isrc_off, BPF_W, addr, mask); -+ b0 = gen_mcmp(idst_off, BPF_W, addr, mask); -+ gen_and(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_mcmp(osrc_off, BPF_W, addr, mask); -+ b0 = gen_mcmp(odst_off, BPF_W, addr, mask); -+ gen_and(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_OR: -+ b1 = gen_mcmp(isrc_off, BPF_W, addr, mask); -+ b0 = gen_mcmp(idst_off, BPF_W, addr, mask); -+ gen_or(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_mcmp(osrc_off, BPF_W, addr, mask); -+ b0 = gen_mcmp(odst_off, BPF_W, addr, mask); -+ gen_or(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_DEFAULT: -+ b1 = gen_mcmp(isrc_off, BPF_W, addr, mask); -+ b0 = gen_mcmp(idst_off, BPF_W, addr, mask); -+ gen_or(b0, b1); -+ b0 = gen_mcmp(osrc_off, BPF_W, addr, mask); -+ gen_or(b0, b1); -+ b0 = gen_mcmp(odst_off, BPF_W, addr, mask); -+ gen_or(b0, b1); -+ break; -+ -+ default: -+ sf_error("Internal error: Invalid direcion specifier: %d", dir); -+ } -+ -+ b0 = gen_linktype(ETHERTYPE_IP); -+ gen_and(b0, b1); -+ -+ return b1; -+} -+ -+#else -+static struct block * -+gen_hostop(bpf_u_int32 addr, bpf_u_int32 mask, int dir) -+{ - struct block *b0, *b1, *b2; - const static int lan_off = offsetof(pf_state_t, lan.addr.v4); - const static int gwy_off = offsetof(pf_state_t, gwy.addr.v4); -@@ -542,6 +640,7 @@ gen_hostop(bpf_u_int32 addr, bpf_u_int32 mask, int dir - - return b1; - } -+#endif - - static struct block * - gen_hostcmp6(u_int off, u_int32_t *a, u_int32_t *m) -@@ -560,9 +659,108 @@ gen_hostcmp6(u_int off, u_int32_t *a, u_int32_t *m) - return b1; - } - -+#ifdef HAVE_PFSYNC_KEY - static struct block * - gen_hostop6(struct in6_addr *addr, struct in6_addr *mask, int dir) -+ - { -+ struct block *b0, *b1, *b2, *bi, *bo; -+ u_int32_t *a, *m; -+ const static int isrc_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[0].v6); -+ const static int osrc_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[1].v6); -+ const static int idst_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[1].v6); -+ const static int odst_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[0].v6); -+ -+ const static int igwy1_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[0].v6); -+ const static int ogwy1_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[1].v6); -+ const static int igwy2_off = offsetof(pf_state_t, key[PF_SK_WIRE].addr[1].v6); -+ const static int ogwy2_off = offsetof(pf_state_t, key[PF_SK_STACK].addr[0].v6); -+ -+ a = (u_int32_t *)addr; -+ m = (u_int32_t *)mask; -+ -+ bi = gen_cmp(offsetof(pf_state_t, direction), BPF_B, (bpf_int32)PF_IN); -+ bo = gen_cmp(offsetof(pf_state_t, direction), BPF_B, (bpf_int32)PF_OUT); -+ -+ switch (dir) { -+ -+ case Q_SRC: -+ b1 = gen_hostcmp6(osrc_off, a, m); -+ gen_and(bo, b1); -+ b0 = gen_hostcmp6(isrc_off, a, m); -+ gen_and(bi, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_DST: -+ b1 = gen_hostcmp6(odst_off, a, m); -+ gen_and(bo, b1); -+ b0 = gen_hostcmp6(idst_off, a, m); -+ gen_and(bi, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_GATEWAY: -+ /* (in && (addr == igwy1 || addr == igwy2)) || -+ (out && (addr == ogwy1 || addr == ogwy2)) phew! */ -+ b1 = gen_hostcmp6(igwy1_off, a, m); -+ b0 = gen_hostcmp6(igwy2_off, a, m); -+ gen_or(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_hostcmp6(ogwy1_off, a, m); -+ b0 = gen_hostcmp6(ogwy2_off, a, m); -+ gen_or(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_AND: -+ b1 = gen_hostcmp6(isrc_off, a, m); -+ b0 = gen_hostcmp6(idst_off, a, m); -+ gen_and(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_hostcmp6(osrc_off, a, m); -+ b0 = gen_hostcmp6(odst_off, a, m); -+ gen_and(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_OR: -+ b1 = gen_hostcmp6(isrc_off, a, m); -+ b0 = gen_hostcmp6(idst_off, a, m); -+ gen_or(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_hostcmp6(osrc_off, a, m); -+ b0 = gen_hostcmp6(odst_off, a, m); -+ gen_or(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_DEFAULT: -+ b1 = gen_hostcmp6(isrc_off, a, m); -+ b0 = gen_hostcmp6(idst_off, a, m); -+ gen_or(b0, b1); -+ b0 = gen_hostcmp6(osrc_off, a, m); -+ gen_or(b0, b1); -+ b0 = gen_hostcmp6(odst_off, a, m); -+ gen_or(b0, b1); -+ break; -+ -+ default: -+ sf_error("Internal error: Invalid direcion specifier: %d", dir); -+ } -+ -+ b0 = gen_linktype(ETHERTYPE_IPV6); -+ gen_and(b0, b1); -+ -+ return b1; -+} -+#else -+static struct block * -+gen_hostop6(struct in6_addr *addr, struct in6_addr *mask, int dir) -+{ - struct block *b0, *b1, *b2; - u_int32_t *a, *m; - -@@ -630,6 +828,7 @@ gen_hostop6(struct in6_addr *addr, struct in6_addr *ma - gen_and(b0, b1); - return b1; - } -+#endif - - static const char * - get_modifier_by_id(int id) -@@ -748,9 +947,107 @@ gen_proto_abbrev(proto) - return b1; - } - -+#ifdef HAVE_PFSYNC_KEY - struct block * - gen_portop(int port, int proto, int dir) - { -+ struct block *b0, *b1, *b2, *bi, *bo; -+ const static int isrc_off = offsetof(pf_state_t, key[PF_SK_STACK].port[0]); -+ const static int osrc_off = offsetof(pf_state_t, key[PF_SK_WIRE].port[1]); -+ const static int idst_off = offsetof(pf_state_t, key[PF_SK_STACK].port[1]); -+ const static int odst_off = offsetof(pf_state_t, key[PF_SK_WIRE].port[0]); -+ -+ const static int igwy1_off = offsetof(pf_state_t, key[PF_SK_WIRE].port[0]); -+ const static int ogwy1_off = offsetof(pf_state_t, key[PF_SK_STACK].port[1]); -+ const static int igwy2_off = offsetof(pf_state_t, key[PF_SK_WIRE].port[1]); -+ const static int ogwy2_off = offsetof(pf_state_t, key[PF_SK_STACK].port[0]); -+ -+ port = ntohs(port); -+ -+ bi = gen_cmp(offsetof(pf_state_t, direction), BPF_B, (bpf_int32)PF_IN); -+ bo = gen_cmp(offsetof(pf_state_t, direction), BPF_B, (bpf_int32)PF_OUT); -+ -+ switch (dir) { -+ -+ case Q_SRC: -+ b1 = gen_cmp(osrc_off, BPF_H, (bpf_int32)port); -+ gen_and(bo, b1); -+ b0 = gen_cmp(isrc_off, BPF_H, (bpf_int32)port); -+ gen_and(bi, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_DST: -+ b1 = gen_cmp(odst_off, BPF_H, (bpf_int32)port); -+ gen_and(bo, b1); -+ b0 = gen_cmp(idst_off, BPF_H, (bpf_int32)port); -+ gen_and(bi, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_GATEWAY: -+ /* (in && (addr == igwy1 || addr == igwy2)) || -+ (out && (addr == ogwy1 || addr == ogwy2)) phew! */ -+ b1 = gen_cmp(igwy1_off, BPF_H, (bpf_int32)port); -+ b0 = gen_cmp(igwy2_off, BPF_H, (bpf_int32)port); -+ gen_or(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_cmp(ogwy1_off, BPF_H, (bpf_int32)port); -+ b0 = gen_cmp(ogwy2_off, BPF_H, (bpf_int32)port); -+ gen_or(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_AND: -+ b1 = gen_cmp(isrc_off, BPF_H, (bpf_int32)port); -+ b0 = gen_cmp(idst_off, BPF_H, (bpf_int32)port); -+ gen_and(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_cmp(osrc_off, BPF_H, (bpf_int32)port); -+ b0 = gen_cmp(odst_off, BPF_H, (bpf_int32)port); -+ gen_and(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_OR: -+ b1 = gen_cmp(isrc_off, BPF_H, (bpf_int32)port); -+ b0 = gen_cmp(idst_off, BPF_H, (bpf_int32)port); -+ gen_or(b0, b1); -+ gen_and(bi, b1); -+ b2 = gen_cmp(osrc_off, BPF_H, (bpf_int32)port); -+ b0 = gen_cmp(odst_off, BPF_H, (bpf_int32)port); -+ gen_or(b2, b0); -+ gen_and(bo, b0); -+ gen_or(b0, b1); -+ break; -+ -+ case Q_DEFAULT: -+ b1 = gen_cmp(isrc_off, BPF_H, (bpf_int32)port); -+ b0 = gen_cmp(idst_off, BPF_H, (bpf_int32)port); -+ gen_or(b0, b1); -+ b0 = gen_cmp(osrc_off, BPF_H, (bpf_int32)port); -+ gen_or(b0, b1); -+ b0 = gen_cmp(odst_off, BPF_H, (bpf_int32)port); -+ gen_or(b0, b1); -+ break; -+ -+ default: -+ sf_error("Internal error: Invalid direcion specifier: %d", dir); -+ } -+ -+ -+ -+ b0 = gen_proto(proto); -+ gen_and(b0, b1); -+ -+ return b1; -+} -+#else -+struct block * -+gen_portop(int port, int proto, int dir) -+{ - struct block *b0, *b1, *b2; - const static int lan_off = offsetof(pf_state_t, lan.port); - const static int gwy_off = offsetof(pf_state_t, gwy.port); -@@ -815,6 +1112,7 @@ gen_portop(int port, int proto, int dir) - - return b1; - } -+#endif - - static struct block * - gen_port(int port, int ip_proto, int dir) diff --git a/sysutils/pftop/files/extra-patch-sf-gencode.h b/sysutils/pftop/files/extra-patch-sf-gencode.h deleted file mode 100644 index c516cc075265..000000000000 --- a/sysutils/pftop/files/extra-patch-sf-gencode.h +++ /dev/null @@ -1,10 +0,0 @@ ---- sf-gencode.h 2014-10-17 12:39:16.000000000 +0200 -+++ sf-gencode.h.orig 2014-10-17 12:39:01.000000000 +0200 -@@ -188,7 +188,7 @@ - const char *sf_get_error(void); - int sf_compile(struct bpf_program *, char *, int, bpf_u_int32); - void sf_freecode(struct bpf_program *); --void bpf_dump(struct bpf_program *, int); -+void bpf_dump(const struct bpf_program *, int); - - extern int no_optimize; diff --git a/sysutils/pftop/files/patch-bpf_filter.c b/sysutils/pftop/files/patch-bpf_filter.c deleted file mode 100644 index bda75e514c76..000000000000 --- a/sysutils/pftop/files/patch-bpf_filter.c +++ /dev/null @@ -1,13 +0,0 @@ ---- bpf_filter.c.orig 2022-06-07 16:20:35 UTC -+++ bpf_filter.c -@@ -143,8 +143,8 @@ bpf_filter(pc, p, wirelen, buflen) - */ - u_int - bpf_filter(pc, p, wirelen, buflen) -- struct bpf_insn *pc; -- u_char *p; -+ const struct bpf_insn *pc; -+ const u_char *p; - u_int wirelen; - u_int buflen; - { diff --git a/sysutils/pftop/files/patch-bpf_image.c b/sysutils/pftop/files/patch-bpf_image.c deleted file mode 100644 index 2f5ce5e7fd24..000000000000 --- a/sysutils/pftop/files/patch-bpf_image.c +++ /dev/null @@ -1,11 +0,0 @@ ---- bpf_image.c.orig 2022-06-07 16:20:35 UTC -+++ bpf_image.c -@@ -36,7 +36,7 @@ bpf_image(p, n) - - char * - bpf_image(p, n) -- struct bpf_insn *p; -+ const struct bpf_insn *p; - int n; - { - int v; diff --git a/sysutils/pftop/files/patch-config.h b/sysutils/pftop/files/patch-config.h deleted file mode 100644 index 8916971c854d..000000000000 --- a/sysutils/pftop/files/patch-config.h +++ /dev/null @@ -1,11 +0,0 @@ ---- config.h.orig 2016-11-02 12:16:30 UTC -+++ config.h -@@ -42,7 +42,7 @@ - #if OS_LEVEL > 32 - #define HAVE_ADDR_MASK - #define HAVE_ADDR_TYPE --#define HAVE_ALTQ -+/* #define HAVE_ALTQ */ - #define HAVE_RULE_TOS - #define HAVE_OP_RRG - #endif diff --git a/sysutils/pftop/files/patch-pftop.c b/sysutils/pftop/files/patch-pftop.c deleted file mode 100644 index 83fe44673db5..000000000000 --- a/sysutils/pftop/files/patch-pftop.c +++ /dev/null @@ -1,43 +0,0 @@ ---- pftop.c.orig 2023-09-29 17:36:57 UTC -+++ pftop.c -@@ -1663,7 +1663,13 @@ print_rule(struct pf_rule *pr) - 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_IN) -+ print_fld_str(FLD_DIR, "In"); -+ else if (pr->direction == PF_OUT) -+ print_fld_str(FLD_DIR, "Out"); -+ else -+ print_fld_str(FLD_DIR, "Any"); -+ - if (pr->quick) - print_fld_str(FLD_QUICK, "Quick"); - -@@ -1747,10 +1753,10 @@ print_rule(struct pf_rule *pr) - #ifdef HAVE_RULE_UGID - if (pr->uid.op) - tb_print_ugid(pr->uid.op, pr->uid.uid[0], pr->uid.uid[1], -- "user", UID_MAX); -+ "user", UINT_MAX); - if (pr->gid.op) - tb_print_ugid(pr->gid.op, pr->gid.gid[0], pr->gid.gid[1], -- "group", GID_MAX); -+ "group", UINT_MAX); - #endif - - if (pr->flags || pr->flagset) { -@@ -1952,7 +1958,12 @@ pfctl_update_qstats(struct pf_altq_node **root, int *i - ret = -1; - break; - } -+#ifdef PFALTQ_FLAG_IF_REMOVED -+ if (pa.altq.qid > 0 && -+ !(pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED)) { -+#else - if (pa.altq.qid > 0) { -+#endif - pq.nr = nr; - pq.ticket = pa.ticket; - pq.buf = &qstats; diff --git a/sysutils/pftop/files/patch-sf-scanner.l b/sysutils/pftop/files/patch-sf-scanner.l deleted file mode 100644 index 47c443d2a8bc..000000000000 --- a/sysutils/pftop/files/patch-sf-scanner.l +++ /dev/null @@ -1,11 +0,0 @@ ---- sf-scanner.l.orig 2022-06-07 16:20:35 UTC -+++ sf-scanner.l -@@ -233,7 +233,7 @@ rnr|rulenum return RNR; - size_t len = strlen(yytext) * 4 + 1; - char *v = malloc(len); - if (v != NULL) -- strnvis(v, yytext, len, 0); -+ strvis(v, yytext, 0); - sf_error("illegal token: %s", v); - free(v); - } diff --git a/sysutils/pftop/files/queue.h b/sysutils/pftop/files/queue.h deleted file mode 100644 index 38130e081528..000000000000 --- a/sysutils/pftop/files/queue.h +++ /dev/null @@ -1,527 +0,0 @@ -/* $OpenBSD: queue.h,v 1.32 2007/04/30 18:42:34 pedro Exp $ */ -/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines five types of data structures: singly-linked lists, - * lists, simple queues, tail queues, and circular queues. - * - * - * A singly-linked list is headed by a single forward pointer. The elements - * are singly linked for minimum space and pointer manipulation overhead at - * the expense of O(n) removal for arbitrary elements. New elements can be - * added to the list after an existing element or at the head of the list. - * Elements being removed from the head of the list should use the explicit - * macro for this purpose for optimum efficiency. A singly-linked list may - * only be traversed in the forward direction. Singly-linked lists are ideal - * for applications with large datasets and few or no removals or for - * implementing a LIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A simple queue is headed by a pair of pointers, one the head of the - * list and the other to the tail of the list. The elements are singly - * linked to save space, so elements can only be removed from the - * head of the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the - * list. A simple queue may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - */ - -#if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC)) -#define _Q_INVALIDATE(a) (a) = ((void *)-1) -#else -#define _Q_INVALIDATE(a) -#endif - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List access methods. - */ -#define SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_END(head) NULL -#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - -#define SLIST_FOREACH(var, head, field) \ - for((var) = SLIST_FIRST(head); \ - (var) != SLIST_END(head); \ - (var) = SLIST_NEXT(var, field)) - -#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ - for ((varp) = &SLIST_FIRST((head)); \ - ((var) = *(varp)) != SLIST_END(head); \ - (varp) = &SLIST_NEXT((var), field)) - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) { \ - SLIST_FIRST(head) = SLIST_END(head); \ -} - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ -} while (0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ -} while (0) - -#define SLIST_REMOVE_NEXT(head, elm, field) do { \ - (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ -} while (0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ -} while (0) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->slh_first; \ - \ - while (curelm->field.sle_next != (elm)) \ - curelm = curelm->field.sle_next; \ - curelm->field.sle_next = \ - curelm->field.sle_next->field.sle_next; \ - _Q_INVALIDATE((elm)->field.sle_next); \ - } \ -} while (0) - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -/* - * List access methods - */ -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_END(head) NULL -#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head)) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - -#define LIST_FOREACH(var, head, field) \ - for((var) = LIST_FIRST(head); \ - (var)!= LIST_END(head); \ - (var) = LIST_NEXT(var, field)) - -/* - * List functions. - */ -#define LIST_INIT(head) do { \ - LIST_FIRST(head) = LIST_END(head); \ -} while (0) - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = \ - &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ -} while (0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} while (0) - -#define LIST_REMOVE(elm, field) do { \ - if ((elm)->field.le_next != NULL) \ - (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ - _Q_INVALIDATE((elm)->field.le_prev); \ - _Q_INVALIDATE((elm)->field.le_next); \ -} while (0) - -#define LIST_REPLACE(elm, elm2, field) do { \ - if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ - (elm2)->field.le_next->field.le_prev = \ - &(elm2)->field.le_next; \ - (elm2)->field.le_prev = (elm)->field.le_prev; \ - *(elm2)->field.le_prev = (elm2); \ - _Q_INVALIDATE((elm)->field.le_prev); \ - _Q_INVALIDATE((elm)->field.le_next); \ -} while (0) - -/* - * Simple queue definitions. - */ -#define SIMPLEQ_HEAD(name, type) \ -struct name { \ - struct type *sqh_first; /* first element */ \ - struct type **sqh_last; /* addr of last next element */ \ -} - -#define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } - -#define SIMPLEQ_ENTRY(type) \ -struct { \ - struct type *sqe_next; /* next element */ \ -} - -/* - * Simple queue access methods. - */ -#define SIMPLEQ_FIRST(head) ((head)->sqh_first) -#define SIMPLEQ_END(head) NULL -#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) -#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) - -#define SIMPLEQ_FOREACH(var, head, field) \ - for((var) = SIMPLEQ_FIRST(head); \ - (var) != SIMPLEQ_END(head); \ - (var) = SIMPLEQ_NEXT(var, field)) - -/* - * Simple queue functions. - */ -#define SIMPLEQ_INIT(head) do { \ - (head)->sqh_first = NULL; \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (0) - -#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (head)->sqh_first = (elm); \ -} while (0) - -#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.sqe_next = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->field.sqe_next; \ -} while (0) - -#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (listelm)->field.sqe_next = (elm); \ -} while (0) - -#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ - if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (0) - -/* - * Tail queue definitions. - */ -#define TAILQ_HEAD(name, type) \ -struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ -} - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define TAILQ_ENTRY(type) \ -struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ -} - -/* - * tail queue access methods - */ -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_END(head) NULL -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -/* XXX */ -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -#define TAILQ_EMPTY(head) \ - (TAILQ_FIRST(head) == TAILQ_END(head)) - -#define TAILQ_FOREACH(var, head, field) \ - for((var) = TAILQ_FIRST(head); \ - (var) != TAILQ_END(head); \ - (var) = TAILQ_NEXT(var, field)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for((var) = TAILQ_LAST(head, headname); \ - (var) != TAILQ_END(head); \ - (var) = TAILQ_PREV(var, headname, field)) - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} while (0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} while (0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (0) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ - _Q_INVALIDATE((elm)->field.tqe_prev); \ - _Q_INVALIDATE((elm)->field.tqe_next); \ -} while (0) - -#define TAILQ_REPLACE(head, elm, elm2, field) do { \ - if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ - (elm2)->field.tqe_next->field.tqe_prev = \ - &(elm2)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm2)->field.tqe_next; \ - (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ - *(elm2)->field.tqe_prev = (elm2); \ - _Q_INVALIDATE((elm)->field.tqe_prev); \ - _Q_INVALIDATE((elm)->field.tqe_next); \ -} while (0) - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ -struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ -} - -#define CIRCLEQ_HEAD_INITIALIZER(head) \ - { CIRCLEQ_END(&head), CIRCLEQ_END(&head) } - -#define CIRCLEQ_ENTRY(type) \ -struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ -} - -/* - * Circular queue access methods - */ -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_END(head) ((void *)(head)) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) -#define CIRCLEQ_EMPTY(head) \ - (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head)) - -#define CIRCLEQ_FOREACH(var, head, field) \ - for((var) = CIRCLEQ_FIRST(head); \ - (var) != CIRCLEQ_END(head); \ - (var) = CIRCLEQ_NEXT(var, field)) - -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ - for((var) = CIRCLEQ_LAST(head); \ - (var) != CIRCLEQ_END(head); \ - (var) = CIRCLEQ_PREV(var, field)) - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) do { \ - (head)->cqh_first = CIRCLEQ_END(head); \ - (head)->cqh_last = CIRCLEQ_END(head); \ -} while (0) - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ -} while (0) - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ -} while (0) - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = CIRCLEQ_END(head); \ - if ((head)->cqh_last == CIRCLEQ_END(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ -} while (0) - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.cqe_next = CIRCLEQ_END(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == CIRCLEQ_END(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ -} while (0) - -#define CIRCLEQ_REMOVE(head, elm, field) do { \ - if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = \ - (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = \ - (elm)->field.cqe_next; \ - _Q_INVALIDATE((elm)->field.cqe_prev); \ - _Q_INVALIDATE((elm)->field.cqe_next); \ -} while (0) - -#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ - if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \ - CIRCLEQ_END(head)) \ - (head).cqh_last = (elm2); \ - else \ - (elm2)->field.cqe_next->field.cqe_prev = (elm2); \ - if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \ - CIRCLEQ_END(head)) \ - (head).cqh_first = (elm2); \ - else \ - (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ - _Q_INVALIDATE((elm)->field.cqe_prev); \ - _Q_INVALIDATE((elm)->field.cqe_next); \ -} while (0) - -#endif /* !_SYS_QUEUE_H_ */ diff --git a/sysutils/pftop/pkg-descr b/sysutils/pftop/pkg-descr index 305a927786a9..32e4ebe63262 100644 --- a/sysutils/pftop/pkg-descr +++ b/sysutils/pftop/pkg-descr @@ -1,2 +1,2 @@ Pftop is a small, curses-based utility for real-time display of active -states and rule statistics for pf, the packet filter (for OpenBSD) +states and rule statistics for pf, the packet filter.