summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2001-07-06 23:01:31 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2001-07-06 23:01:31 +0000
commit36abeb0e87f060d8e38074ae397eb3e64f23d64c (patch)
treedb3dae5c2f3b88654fd74ba55d1aaccd45146c4d /sys/net
parenta6902abd47381a1df2743ba2caf90f61fc48427c (diff)
style change #2, avoid (a == b) == c
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 85731a47212..5c186552d0d 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.104 2001/07/06 22:45:32 dhartmei Exp $ */
+/* $OpenBSD: pf.c,v 1.105 2001/07/06 23:01:30 dhartmei Exp $ */
/*
* Copyright (c) 2001, Daniel Hartmeier
@@ -1345,10 +1345,25 @@ pf_send_icmp(struct mbuf *m, u_int8_t type, u_int8_t code)
icmp_error(m0, type, code, 0, 0);
}
+/*
+ * Return 1 if the addresses a and b match (with mask m), otherwise return 0.
+ * If n is 0, they match if they are equal. If n is != 0, they match if they
+ * are different.
+ */
int
pf_match_addr(u_int8_t n, u_int32_t a, u_int32_t m, u_int32_t b)
{
- return (n == !((a & m) == (b & m)));
+ if (a & m == b & m) {
+ if (n)
+ return (0);
+ else
+ return (1);
+ } else {
+ if (n)
+ return (1);
+ else
+ return (0);
+ }
}
int