summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2013-06-04 18:58:28 +0000
committerhenning <henning@openbsd.org>2013-06-04 18:58:28 +0000
commit17f48161654a0ffe95896c5752fa5d784d6a9720 (patch)
tree6f1e84b2cecff073c1ac909b8ce83cc174a375f0
parentAdd "length" attribute to "weird" class instructions of small length: user (diff)
downloadwireguard-openbsd-17f48161654a0ffe95896c5752fa5d784d6a9720.tar.xz
wireguard-openbsd-17f48161654a0ffe95896c5752fa5d784d6a9720.zip
make pf_change_ap() usable without a port. if the port pointer is NULL,
just return after being done with the address. ok bluhm ryan mikeb
-rw-r--r--sys/net/pf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 735592445af..dce0faeee34 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.830 2013/06/03 16:57:05 bluhm Exp $ */
+/* $OpenBSD: pf.c,v 1.831 2013/06/04 18:58:28 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1688,12 +1688,15 @@ pf_change_ap(struct pf_addr *a, u_int16_t *p, u_int16_t *pc,
sa_family_t naf)
{
struct pf_addr ao;
- u_int16_t po = *p;
+ u_int16_t po;
PF_ACPY(&ao, a, af);
if (af == naf)
PF_ACPY(a, an, naf);
+ if (p == NULL) /* no port -> done. no cksum to worry about. */
+ return;
+ po = *p;
*p = pn;
switch (af) {