CVS commit: src/dist/pf/sbin/pfctl

2020-04-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Apr 22 23:40:40 UTC 2020

Modified Files:
src/dist/pf/sbin/pfctl: pfctl.c

Log Message:
Externalize variables owned logically by pf_ruleset.c


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/dist/pf/sbin/pfctl/pfctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/pf/sbin/pfctl/pfctl.c
diff -u src/dist/pf/sbin/pfctl/pfctl.c:1.5 src/dist/pf/sbin/pfctl/pfctl.c:1.6
--- src/dist/pf/sbin/pfctl/pfctl.c:1.5	Wed Jun 18 09:06:26 2008
+++ src/dist/pf/sbin/pfctl/pfctl.c	Wed Apr 22 23:40:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfctl.c,v 1.5 2008/06/18 09:06:26 yamt Exp $	*/
+/*	$NetBSD: pfctl.c,v 1.6 2020/04/22 23:40:40 joerg Exp $	*/
 /*	$OpenBSD: pfctl.c,v 1.268 2007/06/30 18:25:08 henning Exp $ */
 
 /*
@@ -96,8 +96,8 @@ int	 pfctl_load_ruleset(struct pfctl *, 
 int	 pfctl_load_rule(struct pfctl *, char *, struct pf_rule *, int);
 const char	*pfctl_lookup_option(char *, const char **);
 
-struct pf_anchor_global	 pf_anchors;
-struct pf_anchor	 pf_main_anchor;
+extern struct pf_anchor_global	 pf_anchors;
+extern struct pf_anchor	 pf_main_anchor;
 
 const char	*clearopt;
 char		*rulesopt;



CVS commit: src/dist/pf/sbin/pfctl

2020-04-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Apr 22 23:40:40 UTC 2020

Modified Files:
src/dist/pf/sbin/pfctl: pfctl.c

Log Message:
Externalize variables owned logically by pf_ruleset.c


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/dist/pf/sbin/pfctl/pfctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/dist/pf/sbin/pfctl

2018-02-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb  4 08:44:36 UTC 2018

Modified Files:
src/dist/pf/sbin/pfctl: pfctl_altq.c pfctl_optimize.c

Log Message:
fix two issues found by GCC 6.4:
- cbq_compute_idletime() had a fprintf() not in the intended missing {}.
- skip_cmp_dst_addr() compared a vs a instead of a vs b.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/dist/pf/sbin/pfctl/pfctl_altq.c
cvs rdiff -u -r1.7 -r1.8 src/dist/pf/sbin/pfctl/pfctl_optimize.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/dist/pf/sbin/pfctl

2018-02-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb  4 08:44:36 UTC 2018

Modified Files:
src/dist/pf/sbin/pfctl: pfctl_altq.c pfctl_optimize.c

Log Message:
fix two issues found by GCC 6.4:
- cbq_compute_idletime() had a fprintf() not in the intended missing {}.
- skip_cmp_dst_addr() compared a vs a instead of a vs b.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/dist/pf/sbin/pfctl/pfctl_altq.c
cvs rdiff -u -r1.7 -r1.8 src/dist/pf/sbin/pfctl/pfctl_optimize.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/pf/sbin/pfctl/pfctl_altq.c
diff -u src/dist/pf/sbin/pfctl/pfctl_altq.c:1.9 src/dist/pf/sbin/pfctl/pfctl_altq.c:1.10
--- src/dist/pf/sbin/pfctl/pfctl_altq.c:1.9	Mon Mar  1 00:14:08 2010
+++ src/dist/pf/sbin/pfctl/pfctl_altq.c	Sun Feb  4 08:44:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfctl_altq.c,v 1.9 2010/03/01 00:14:08 joerg Exp $	*/
+/*	$NetBSD: pfctl_altq.c,v 1.10 2018/02/04 08:44:36 mrg Exp $	*/
 /*	$OpenBSD: pfctl_altq.c,v 1.92 2007/05/27 05:15:17 claudio Exp $	*/
 
 /*
@@ -450,12 +450,13 @@ cbq_compute_idletime(struct pfctl *pf, s
 		 * this causes integer overflow in kernel!
 		 * (bandwidth < 6Kbps when max_pkt_size=1500)
 		 */
-		if (pa->bandwidth != 0 && (pf->opts & PF_OPT_QUIET) == 0)
+		if (pa->bandwidth != 0 && (pf->opts & PF_OPT_QUIET) == 0) {
 			warnx("queue bandwidth must be larger than %s",
 			rate2str(ifnsPerByte * (double)opts->maxpktsize /
 			(double)INT_MAX * (double)pa->ifbandwidth));
 			fprintf(stderr, "cbq: queue %s is too slow!\n",
 			pa->qname);
+		}
 		nsPerByte = (double)(INT_MAX / opts->maxpktsize);
 	}
 

Index: src/dist/pf/sbin/pfctl/pfctl_optimize.c
diff -u src/dist/pf/sbin/pfctl/pfctl_optimize.c:1.7 src/dist/pf/sbin/pfctl/pfctl_optimize.c:1.8
--- src/dist/pf/sbin/pfctl/pfctl_optimize.c:1.7	Mon May 30 17:21:07 2016
+++ src/dist/pf/sbin/pfctl/pfctl_optimize.c	Sun Feb  4 08:44:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfctl_optimize.c,v 1.7 2016/05/30 17:21:07 dholland Exp $	*/
+/*	$NetBSD: pfctl_optimize.c,v 1.8 2018/02/04 08:44:36 mrg Exp $	*/
 /*	$OpenBSD: pfctl_optimize.c,v 1.13 2006/10/31 14:17:45 mcbride Exp $ */
 
 /*
@@ -1084,7 +1084,7 @@ skip_cmp_dst_addr(struct pf_rule *a, str
 		return (0);
 	case PF_ADDR_DYNIFTL:
 		if (strcmp(a->dst.addr.v.ifname, b->dst.addr.v.ifname) != 0 ||
-		a->dst.addr.iflags != a->dst.addr.iflags ||
+		a->dst.addr.iflags != b->dst.addr.iflags ||
 		memcmp(>dst.addr.v.a.mask, >dst.addr.v.a.mask,
 		sizeof(a->dst.addr.v.a.mask)))
 			return (1);
@@ -1156,7 +1156,7 @@ skip_cmp_src_addr(struct pf_rule *a, str
 		return (0);
 	case PF_ADDR_DYNIFTL:
 		if (strcmp(a->src.addr.v.ifname, b->src.addr.v.ifname) != 0 ||
-		a->src.addr.iflags != a->src.addr.iflags ||
+		a->src.addr.iflags != b->src.addr.iflags ||
 		memcmp(>src.addr.v.a.mask, >src.addr.v.a.mask,
 		sizeof(a->src.addr.v.a.mask)))
 			return (1);



CVS commit: src/dist/pf/sbin/pfctl

2016-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon May 30 17:21:07 UTC 2016

Modified Files:
src/dist/pf/sbin/pfctl: pfctl_optimize.c

Log Message:
PR 50709 David Binderman: memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/dist/pf/sbin/pfctl/pfctl_optimize.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/dist/pf/sbin/pfctl

2016-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon May 30 17:21:07 UTC 2016

Modified Files:
src/dist/pf/sbin/pfctl: pfctl_optimize.c

Log Message:
PR 50709 David Binderman: memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/dist/pf/sbin/pfctl/pfctl_optimize.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/pf/sbin/pfctl/pfctl_optimize.c
diff -u src/dist/pf/sbin/pfctl/pfctl_optimize.c:1.6 src/dist/pf/sbin/pfctl/pfctl_optimize.c:1.7
--- src/dist/pf/sbin/pfctl/pfctl_optimize.c:1.6	Wed Jun 18 09:06:26 2008
+++ src/dist/pf/sbin/pfctl/pfctl_optimize.c	Mon May 30 17:21:07 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfctl_optimize.c,v 1.6 2008/06/18 09:06:26 yamt Exp $	*/
+/*	$NetBSD: pfctl_optimize.c,v 1.7 2016/05/30 17:21:07 dholland Exp $	*/
 /*	$OpenBSD: pfctl_optimize.c,v 1.13 2006/10/31 14:17:45 mcbride Exp $ */
 
 /*
@@ -902,6 +902,7 @@ load_feedback_profile(struct pfctl *pf, 
 		pr.nr = nr;
 		if (ioctl(pf->dev, DIOCGETRULE, )) {
 			warn("DIOCGETRULES");
+			free(por);
 			return (1);
 		}
 		memcpy(>por_rule, , sizeof(por->por_rule));



CVS commit: src/dist/pf/sbin/pfctl

2010-02-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Mar  1 00:14:08 UTC 2010

Modified Files:
src/dist/pf/sbin/pfctl: pfctl_altq.c

Log Message:
Use HUGE_VAL instead of INFINITY as positive infinity (or maximum value)
is good enough and the side effects of ISO C99 7.12 (4) are not desired.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/dist/pf/sbin/pfctl/pfctl_altq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/dist/pf/sbin/pfctl

2010-02-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Mar  1 00:14:08 UTC 2010

Modified Files:
src/dist/pf/sbin/pfctl: pfctl_altq.c

Log Message:
Use HUGE_VAL instead of INFINITY as positive infinity (or maximum value)
is good enough and the side effects of ISO C99 7.12 (4) are not desired.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/dist/pf/sbin/pfctl/pfctl_altq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/pf/sbin/pfctl/pfctl_altq.c
diff -u src/dist/pf/sbin/pfctl/pfctl_altq.c:1.8 src/dist/pf/sbin/pfctl/pfctl_altq.c:1.9
--- src/dist/pf/sbin/pfctl/pfctl_altq.c:1.8	Wed Jun 18 09:06:26 2008
+++ src/dist/pf/sbin/pfctl/pfctl_altq.c	Mon Mar  1 00:14:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfctl_altq.c,v 1.8 2008/06/18 09:06:26 yamt Exp $	*/
+/*	$NetBSD: pfctl_altq.c,v 1.9 2010/03/01 00:14:08 joerg Exp $	*/
 /*	$OpenBSD: pfctl_altq.c,v 1.92 2007/05/27 05:15:17 claudio Exp $	*/
 
 /*
@@ -881,9 +881,6 @@
 /*
  * admission control using generalized service curve
  */
-#ifndef __NetBSD__
-#define	INFINITY	HUGE_VAL  /* positive infinity defined in math.h */
-#endif /* !__NetBSD__ */
 
 /* add a new service curve to a generalized service curve */
 static void
@@ -893,7 +890,7 @@
 		return;
 	if (sc-d != 0)
 		gsc_add_seg(gsc, 0.0, 0.0, (double)sc-d, (double)sc-m1);
-	gsc_add_seg(gsc, (double)sc-d, 0.0, INFINITY, (double)sc-m2);
+	gsc_add_seg(gsc, (double)sc-d, 0.0, HUGE_VAL, (double)sc-m2);
 }
 
 /*
@@ -917,10 +914,10 @@
 		return (1);
 	}
 	/*
-	 * gsc has a dummy entry at the end with x = INFINITY.
+	 * gsc has a dummy entry at the end with x = HUGE_VAL.
 	 * loop through up to this dummy entry.
 	 */
-	end = gsc_getentry(gsc, INFINITY);
+	end = gsc_getentry(gsc, HUGE_VAL);
 	if (end == NULL)
 		return (1);
 	last = NULL;
@@ -977,10 +974,10 @@
 		return (NULL);
 
 	new-x = x;
-	if (x == INFINITY || s == NULL)
+	if (x == HUGE_VAL || s == NULL)
 		new-d = 0;
-	else if (s-x == INFINITY)
-		new-d = INFINITY;
+	else if (s-x == HUGE_VAL)
+		new-d = HUGE_VAL;
 	else
 		new-d = s-x - x;
 	if (prev == NULL) {
@@ -993,12 +990,12 @@
 		 * the start point intersects with the segment pointed by
 		 * prev.  divide prev into 2 segments
 		 */
-		if (x == INFINITY) {
-			prev-d = INFINITY;
+		if (x == HUGE_VAL) {
+			prev-d = HUGE_VAL;
 			if (prev-m == 0)
 new-y = prev-y;
 			else
-new-y = INFINITY;
+new-y = HUGE_VAL;
 		} else {
 			prev-d = x - prev-x;
 			new-y = prev-d * prev-m + prev-y;
@@ -1016,8 +1013,8 @@
 	struct segment	*start, *end, *s;
 	double		 x2;
 
-	if (d == INFINITY)
-		x2 = INFINITY;
+	if (d == HUGE_VAL)
+		x2 = HUGE_VAL;
 	else
 		x2 = x + d;
 	start = gsc_getentry(gsc, x);
@@ -1030,7 +1027,7 @@
 		s-y += y + (s-x - x) * m;
 	}
 
-	end = gsc_getentry(gsc, INFINITY);
+	end = gsc_getentry(gsc, HUGE_VAL);
 	for (; s != end; s = LIST_NEXT(s, _next)) {
 		s-y += m * d;
 	}



CVS commit: src/dist/pf/sbin/pfctl

2009-06-15 Thread Min Sik Kim
Module Name:src
Committed By:   minskim
Date:   Tue Jun 16 05:16:52 UTC 2009

Modified Files:
src/dist/pf/sbin/pfctl: parse.y

Log Message:
Reduce diff with OpenBSD.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/dist/pf/sbin/pfctl/parse.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/pf/sbin/pfctl/parse.y
diff -u src/dist/pf/sbin/pfctl/parse.y:1.11 src/dist/pf/sbin/pfctl/parse.y:1.12
--- src/dist/pf/sbin/pfctl/parse.y:1.11	Wed Jun 18 09:06:26 2008
+++ src/dist/pf/sbin/pfctl/parse.y	Tue Jun 16 05:16:52 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.y,v 1.11 2008/06/18 09:06:26 yamt Exp $	*/
+/*	$NetBSD: parse.y,v 1.12 2009/06/16 05:16:52 minskim Exp $	*/
 /*	$OpenBSD: parse.y,v 1.519 2007/06/21 19:30:03 henning Exp $	*/
 
 /*
@@ -26,9 +26,6 @@
  * 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.
- *
- * This material is based upon work partially supported by NSF under
- * Contract No. NSF CNS-0626584.
  */
 %{
 #include sys/types.h