summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2015-04-15 14:46:45 +0000
committergnn <gnn@FreeBSD.org>2015-04-15 14:46:45 +0000
commit5d97cb9c5e3ddd08cf73f996fcaa4d918adb3852 (patch)
tree8d7328d5a1b501e0c117f8fe74aa0a594083e8d6
parent835458073d5dc951ee7f51d404305851c1538a3d (diff)
downloadFreeBSD-src-5d97cb9c5e3ddd08cf73f996fcaa4d918adb3852.zip
FreeBSD-src-5d97cb9c5e3ddd08cf73f996fcaa4d918adb3852.tar.gz
Minor change to the macros to make sure that if an AF is passed that is neither AF_INET6 nor AF_INET that we don't touch random bits of memory.
Differential Revision: https://reviews.freebsd.org/D2291
-rw-r--r--sys/net/pfvar.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index a79f412..4a5f2a0 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -192,21 +192,20 @@ extern struct rwlock pf_rules_lock;
#define PF_AEQ(a, b, c) \
((c == AF_INET && (a)->addr32[0] == (b)->addr32[0]) || \
- ((a)->addr32[3] == (b)->addr32[3] && \
+ (c == AF_INET6 && (a)->addr32[3] == (b)->addr32[3] && \
(a)->addr32[2] == (b)->addr32[2] && \
(a)->addr32[1] == (b)->addr32[1] && \
(a)->addr32[0] == (b)->addr32[0])) \
#define PF_ANEQ(a, b, c) \
- ((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \
- ((a)->addr32[3] != (b)->addr32[3] || \
- (a)->addr32[2] != (b)->addr32[2] || \
+ ((a)->addr32[0] != (b)->addr32[0] || \
(a)->addr32[1] != (b)->addr32[1] || \
- (a)->addr32[0] != (b)->addr32[0])) \
+ (a)->addr32[2] != (b)->addr32[2] || \
+ (a)->addr32[3] != (b)->addr32[3]) \
#define PF_AZERO(a, c) \
((c == AF_INET && !(a)->addr32[0]) || \
- (!(a)->addr32[0] && !(a)->addr32[1] && \
+ (c == AF_INET6 && !(a)->addr32[0] && !(a)->addr32[1] && \
!(a)->addr32[2] && !(a)->addr32[3] )) \
#define PF_MATCHA(n, a, m, b, f) \
OpenPOWER on IntegriCloud