summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2003-05-10 22:33:34 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2003-05-10 22:33:34 +0000
commit046af80b0d9bccf54d60a52e689521aa7880f461 (patch)
tree276b082cabfd087bd5b6675378340433d5bcb3d2 /sys/net/pf.c
parent67d6dfb7f35375050c6b59763b0a638b4a493058 (diff)
Prepare pf_change_icmp() for parameter ip == NULL use.
ok frantzen@, henning@, pb@
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index a1095fbf00f..a8f2d74ccf9 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.340 2003/05/06 21:21:23 dhartmei Exp $ */
+/* $OpenBSD: pf.c,v 1.341 2003/05/10 22:33:33 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -945,23 +945,26 @@ pf_change_icmp(struct pf_addr *ia, u_int16_t *ip, struct pf_addr *oa,
u_int16_t *ic, u_int16_t *hc, u_int8_t u, sa_family_t af)
{
struct pf_addr oia, ooa;
- u_int32_t opc;
- u_int16_t oip = *ip;
PF_ACPY(&oia, ia, af);
PF_ACPY(&ooa, oa, af);
- if (pc != NULL)
- opc = *pc;
/* Change inner protocol port, fix inner protocol checksum. */
- *ip = np;
- if (pc != NULL)
- *pc = pf_cksum_fixup(*pc, oip, *ip, u);
- *ic = pf_cksum_fixup(*ic, oip, *ip, 0);
- if (pc != NULL)
- *ic = pf_cksum_fixup(*ic, opc, *pc, 0);
+ if (ip != NULL) {
+ u_int16_t oip = *ip;
+ u_int32_t opc;
+
+ if (pc != NULL)
+ opc = *pc;
+ *ip = np;
+ if (pc != NULL)
+ *pc = pf_cksum_fixup(*pc, oip, *ip, u);
+ *ic = pf_cksum_fixup(*ic, oip, *ip, 0);
+ if (pc != NULL)
+ *ic = pf_cksum_fixup(*ic, opc, *pc, 0);
+ }
+ /* Change inner ip address, fix inner ip and icmp checksums. */
PF_ACPY(ia, na, af);
- /* Change inner ip address, fix inner ipv4 and icmp checksums. */
switch (af) {
#ifdef INET
case AF_INET: {