summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2001-09-19 11:10:00 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2001-09-19 11:10:00 +0000
commitb9db33145250dcbd571b4fed4e5ef762283401d5 (patch)
tree1e8f9f364d22d11890c580d331022dc6ff54883c /sys/net/pf.c
parent821b44d46013d29fc1daf88c252cd2ffcb67dcae (diff)
Patch from Ryan McBride. Compile without INET6, remove unnecessary
rewrite++.
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index c4ecec2848b..028e42fa26c 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.153 2001/09/17 17:16:27 dhartmei Exp $ */
+/* $OpenBSD: pf.c,v 1.154 2001/09/19 11:09:59 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -3124,7 +3124,9 @@ pf_test_icmp(int direction, struct ifnet *ifp, struct mbuf *m,
u_short reason;
u_int16_t icmpid, af = pd->af;
u_int8_t icmptype, icmpcode;
+#ifdef INET6
int rewrite = 0;
+#endif /* INET6 */
switch (pd->proto) {
#ifdef INET
@@ -3308,10 +3310,12 @@ pf_test_icmp(int direction, struct ifnet *ifp, struct mbuf *m,
pf_insert_state(s);
}
+#ifdef INET6
/* copy back packet headers if we performed IPv6 NAT operations */
if (rewrite)
m_copyback(m, off, ICMP_MINLEN,
(caddr_t)pd->hdr.icmp6);
+#endif /* INET6 */
return (PF_PASS);
}
@@ -3796,7 +3800,6 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
* Search for an ICMP state.
*/
struct pf_tree_key key;
- int rewrite = 0;
key.af = pd->af;
key.proto = pd->proto;
@@ -3832,7 +3835,8 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
pf_change_a6(saddr,
&pd->hdr.icmp6->icmp6_cksum,
&(*state)->gwy.addr, 0);
- rewrite++;
+ m_copyback(m, off, ICMP_MINLEN,
+ (caddr_t)pd->hdr.icmp6);
break;
#endif /* INET6 */
}
@@ -3850,19 +3854,14 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
pf_change_a6(daddr,
&pd->hdr.icmp6->icmp6_cksum,
&(*state)->lan.addr, 0);
- rewrite++;
+ m_copyback(m, off, ICMP_MINLEN,
+ (caddr_t)pd->hdr.icmp6);
break;
#endif /* INET6 */
}
}
}
- /* copy back packet headers if we performed IPv6 NAT */
- if (rewrite)
- m_copyback(m, off, ICMP_MINLEN,
- (caddr_t)pd->hdr.icmp6);
-
-
return (PF_PASS);
} else {