summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-12-27 15:20:31 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-12-27 15:20:31 +0000
commit096cd01a243d5e2b532ed9b5220949f0bb021021 (patch)
tree801f4a7237d7597eab0d7c9ef2ead22517614fae /sys/net/pf.c
parentbaa77e1557a24fc534e3d546ef31d6d82f32d65a (diff)
Initialize rt_ifp in newly allocated pf_state objects to NULL.
Solves the crashes in pf_route() with -current. Reports from Michael Lucas and Bjorn Runaker.
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index a65574b0150..457f34f8d8d 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.284 2002/12/26 16:21:37 mcbride Exp $ */
+/* $OpenBSD: pf.c,v 1.285 2002/12/27 15:20:30 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1933,6 +1933,7 @@ pf_test_tcp(struct pf_rule **rm, int direction, struct ifnet *ifp,
REASON_SET(&reason, PFRES_MEMORY);
return (PF_DROP);
}
+ bzero(s, sizeof(*s));
if (rs != NULL)
rs->states++;
@@ -2178,6 +2179,7 @@ pf_test_udp(struct pf_rule **rm, int direction, struct ifnet *ifp,
s = pool_get(&pf_state_pl, PR_NOWAIT);
if (s == NULL)
return (PF_DROP);
+ bzero(s, sizeof(*s));
if (rs != NULL)
rs->states++;
@@ -2424,6 +2426,7 @@ pf_test_icmp(struct pf_rule **rm, int direction, struct ifnet *ifp,
s = pool_get(&pf_state_pl, PR_NOWAIT);
if (s == NULL)
return (PF_DROP);
+ bzero(s, sizeof(*s));
if (rs != NULL)
rs->states++;
@@ -2617,6 +2620,7 @@ pf_test_other(struct pf_rule **rm, int direction, struct ifnet *ifp,
s = pool_get(&pf_state_pl, PR_NOWAIT);
if (s == NULL)
return (PF_DROP);
+ bzero(s, sizeof(*s));
if (rs != NULL)
rs->states++;
@@ -3869,7 +3873,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
}
/* Copied from ip_output. */
- if ((u_int16_t)ip->ip_len <= ifp->if_mtu) {
+ if (ip->ip_len <= ifp->if_mtu) {
ip->ip_len = htons((u_int16_t)ip->ip_len);
ip->ip_off = htons((u_int16_t)ip->ip_off);
if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) &&