When you try to change order on a view that doesn't have orders pftop segfaults. The extra-patch-engine.c fix the issue and should be applied to all versions instead of only for FreeBSD 9.x How-To-Repeat: 1. Start pftop 2. Change view to "Rules" 3. Press "o" to change order
Responsible Changed From-To: freebsd-ports-bugs->mlaier Over to maintainer
The patch: http://www.fabiankeil.de/sourcecode/freebsd/pftop-0.7_2.diff includes the patch from Renato and additionally unbreaks pftop on HEAD, fixes the rule display in a couple of views on 9 and 10 and makes me pftop maintainer. Renato, could you please check whether or not rules are currently shown correctly on FreeBSD 8, for example in the "long" view? Fabian
On Mon, Feb 25, 2013 at 09:00:20PM +0100, Fabian Keil wrote: > The patch: > http://www.fabiankeil.de/sourcecode/freebsd/pftop-0.7_2.diff > includes the patch from Renato and additionally unbreaks pftop > on HEAD, fixes the rule display in a couple of views on 9 and > 10 and makes me pftop maintainer. > > Renato, could you please check whether or not rules are currently > shown correctly on FreeBSD 8, for example in the "long" view? It looks ok on 8.3-REL. Thanks! -- Renato Botelho <garga @ FreeBSD.org> <garga.bsd @ gmail.com> GnuPG Key: http://www.FreeBSD.org/~garga/pubkey.asc
Renato Botelho <garga@FreeBSD.org> wrote: > On Mon, Feb 25, 2013 at 09:00:20PM +0100, Fabian Keil wrote: > > Renato, could you please check whether or not rules are currently > > shown correctly on FreeBSD 8, for example in the "long" view? > > It looks ok on 8.3-REL. Thanks! Great. Thanks for checking. Fabian
I can confirm that this patch fixes pftop on HEAD. There is still warnings but it compiles and works. Best regards, Thomas Steen Rasmussen
Author: garga Date: Sat May 18 15:42:52 2013 New Revision: 318433 URL: http://svnweb.freebsd.org/changeset/ports/318433 Log: - Unbreak pftop on HEAD > r240233 [1] . Reported by Sven Hazejager. - Unbreak on FreeBSD 9 without pf 4.5 [1] - Fix segfaults on FreeBSD 8 [2] - Fix rule display in a couple of views on FreeBSD 9 and 10 [1] . Reported and tested by Thomas Kinsey . Fix reported to OpenBSD by Robert Mills PR: ports/175927 Submitted by: [1] Fabian Keil <fk@fabiankeil.de>, [2] garga@ Approved by: maintainer timeout (over 60 days) Modified: head/sysutils/pftop/Makefile head/sysutils/pftop/files/extra-patch-cache.c head/sysutils/pftop/files/extra-patch-cache.h head/sysutils/pftop/files/extra-patch-pftop.c Modified: head/sysutils/pftop/Makefile ============================================================================== --- head/sysutils/pftop/Makefile Sat May 18 13:57:41 2013 (r318432) +++ head/sysutils/pftop/Makefile Sat May 18 15:42:52 2013 (r318433) @@ -7,7 +7,7 @@ PORTNAME= pftop PORTVERSION= 0.7 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils net MASTER_SITES= http://www.eee.metu.edu.tr/~canacar/ @@ -23,7 +23,7 @@ MANCOMPRESSED= no .if ${OSVERSION} < 700049 MAKE_ARGS= LOCALBASE="${PREFIX}" OSLEVEL=37 CFLAGS+= -DHAVE_ALTQ=1 -.elif ${OSVERSION} < 900000 +.elif ${OSVERSION} < 900039 MAKE_ARGS= LOCALBASE="${PREFIX}" OSLEVEL=41 CFLAGS+= -DHAVE_ALTQ=1 .else @@ -32,10 +32,14 @@ CFLAGS+= -DHAVE_ALTQ=1 -DHAVE_SNPRINTF=1 EXTRA_PATCHES+= ${FILESDIR}/extra-patch-cache.c \ ${FILESDIR}/extra-patch-cache.h \ ${FILESDIR}/extra-patch-config.h \ - ${FILESDIR}/extra-patch-engine.c \ ${FILESDIR}/extra-patch-pftop.c \ ${FILESDIR}/extra-patch-sf-gencode.c +.if ${OSVERSION} > 1000017 +CFLAGS+= -DHAVE_FINE_GRAINED_LOCKING=1 .endif +.endif + +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-engine.c MAKE_ENV+= __MAKE_CONF=/dev/null Modified: head/sysutils/pftop/files/extra-patch-cache.c ============================================================================== --- head/sysutils/pftop/files/extra-patch-cache.c Sat May 18 13:57:41 2013 (r318432) +++ head/sysutils/pftop/files/extra-patch-cache.c Sat May 18 15:42:52 2013 (r318433) @@ -1,13 +1,18 @@ +# 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,17 @@ add_state(pf_state_t *st) +@@ -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; @@ -19,13 +24,17 @@ $OpenBSD: patch-cache_c,v 1.1 2008/06/13 #ifdef HAVE_INOUT_COUNT ent->bytes = COUNTER(st->bytes[0]) + COUNTER(st->bytes[1]); #else -@@ -147,13 +152,17 @@ cache_state(pf_state_t *st) +@@ -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; @@ -38,11 +47,17 @@ $OpenBSD: patch-cache_c,v 1.1 2008/06/13 old = RB_FIND(sc_tree, &sctree, &ent); if (old == NULL) { -@@ -210,8 +219,18 @@ cache_endupdate(void) +@@ -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]) @@ -51,6 +66,7 @@ $OpenBSD: patch-cache_c,v 1.1 2008/06/13 + return (1); + if (a->id[1] < b->id[1]) + return (-1); ++#endif +#else int diff; - @@ -58,7 +74,7 @@ $OpenBSD: patch-cache_c,v 1.1 2008/06/13 if ((diff = a->proto - b->proto) != 0) return (diff); if ((diff = a->af - b->af) != 0) -@@ -269,6 +288,6 @@ sc_cmp(struct sc_ent *a, struct sc_ent *b) +@@ -269,6 +303,6 @@ return (diff); if ((diff = a->port[1] - b->port[1]) != 0) return (diff); Modified: head/sysutils/pftop/files/extra-patch-cache.h ============================================================================== --- head/sysutils/pftop/files/extra-patch-cache.h Sat May 18 13:57:41 2013 (r318432) +++ head/sysutils/pftop/files/extra-patch-cache.h Sat May 18 15:42:52 2013 (r318433) @@ -1,12 +1,17 @@ +# 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,20 @@ +@@ -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 Modified: head/sysutils/pftop/files/extra-patch-pftop.c ============================================================================== --- head/sysutils/pftop/files/extra-patch-pftop.c Sat May 18 13:57:41 2013 (r318432) +++ head/sysutils/pftop/files/extra-patch-pftop.c Sat May 18 15:42:52 2013 (r318433) @@ -1,5 +1,6 @@ -# One chunk of this OpenBSD patch has been removed -# as it's already part of patch-pftop.c +# 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 @@ -313,7 +314,7 @@ $OpenBSD: patch-pftop_c,v 1.12 2009/12/0 #ifdef HAVE_INOUT_COUNT { u_int64_t sz = COUNTER(s->bytes[0]) + COUNTER(s->bytes[1]); -@@ -988,14 +1161,14 @@ print_state(pf_state_t * s, struct sc_ent * ent) +@@ -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); @@ -332,6 +333,11 @@ $OpenBSD: patch-pftop_c,v 1.12 2009/12/0 #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 _______________________________________________ svn-ports-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-ports-all To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
State Changed From-To: open->closed Committed. Thanks!