summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2005-07-29 06:26:44 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2005-07-29 06:26:44 +0000
commit53530ebaaab64f17d0d832ced4e25320f2a4fd6f (patch)
tree59f2c346d844d261b14a9d590610149e37afd318 /sys/net
parentc13e74faf0e3b2720bac52ed6b34e955c6c355d8 (diff)
Use one "struct pf_state key" declaration at top of pf_test_state_icmp,
instead of allocating it as a temp var in six mutually exclusive code paths. Saves 784 bytes of kernel stack (on i386).
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 04ad0904dfc..6d9e3583d21 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.495 2005/07/21 08:02:26 markus Exp $ */
+/* $OpenBSD: pf.c,v 1.496 2005/07/29 06:26:43 pascoe Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -4480,6 +4480,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
u_int16_t icmpid, *icmpsum;
u_int8_t icmptype;
int state_icmp = 0;
+ struct pf_state key;
switch (pd->proto) {
#ifdef INET
@@ -4517,8 +4518,6 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
* ICMP query/reply message not related to a TCP/UDP packet.
* Search for an ICMP state.
*/
- struct pf_state key;
-
key.af = pd->af;
key.proto = pd->proto;
if (direction == PF_IN) {
@@ -4694,7 +4693,6 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
case IPPROTO_TCP: {
struct tcphdr th;
u_int32_t seq;
- struct pf_state key;
struct pf_state_peer *src, *dst;
u_int8_t dws;
int copyback = 0;
@@ -4811,7 +4809,6 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
}
case IPPROTO_UDP: {
struct udphdr uh;
- struct pf_state key;
if (!pf_pull_hdr(m, off2, &uh, sizeof(uh),
NULL, reason, pd2.af)) {
@@ -4878,7 +4875,6 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
#ifdef INET
case IPPROTO_ICMP: {
struct icmp iih;
- struct pf_state key;
if (!pf_pull_hdr(m, off2, &iih, ICMP_MINLEN,
NULL, reason, pd2.af)) {
@@ -4930,7 +4926,6 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
#ifdef INET6
case IPPROTO_ICMPV6: {
struct icmp6_hdr iih;
- struct pf_state key;
if (!pf_pull_hdr(m, off2, &iih,
sizeof(struct icmp6_hdr), NULL, reason, pd2.af)) {
@@ -4982,8 +4977,6 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
}
#endif /* INET6 */
default: {
- struct pf_state key;
-
key.af = pd2.af;
key.proto = pd2.proto;
if (direction == PF_IN) {