From owner-svn-ports-all@FreeBSD.ORG Sat May 18 15:42:53 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A76DBD14; Sat, 18 May 2013 15:42:53 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98127787; Sat, 18 May 2013 15:42:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4IFgrgi012666; Sat, 18 May 2013 15:42:53 GMT (envelope-from garga@svn.freebsd.org) Received: (from garga@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4IFgqVl012662; Sat, 18 May 2013 15:42:52 GMT (envelope-from garga@svn.freebsd.org) Message-Id: <201305181542.r4IFgqVl012662@svn.freebsd.org> From: Renato Botelho Date: Sat, 18 May 2013 15:42:52 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r318433 - in head/sysutils/pftop: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 May 2013 15:42:53 -0000 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 , [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