diff options
author | Dug Song <dugsong@cvs.openbsd.org> | 2001-06-26 22:56:04 +0000 |
---|---|---|
committer | Dug Song <dugsong@cvs.openbsd.org> | 2001-06-26 22:56:04 +0000 |
commit | 5443a9225a2606ca75ce32b901232279e960006d (patch) | |
tree | f842c72f391e57c7f2edfc3316e24e45918dddb3 /sys/net | |
parent | 86b92cfc6b5f945e91bb95b870808f2541a01b5b (diff) |
name comparison operators
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pf.c | 20 | ||||
-rw-r--r-- | sys/net/pfvar.h | 4 |
2 files changed, 13 insertions, 11 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index f00544f8fdb..00f554ce174 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.64 2001/06/26 22:26:12 deraadt Exp $ */ +/* $OpenBSD: pf.c,v 1.65 2001/06/26 22:56:02 dugsong Exp $ */ /* * Copyright (c) 2001, Daniel Hartmeier @@ -1165,19 +1165,19 @@ int match_port(u_int8_t op, u_int16_t a1, u_int16_t a2, u_int16_t p) { switch (op) { - case 1: + case PF_OP_GL: return (p >= a1) && (p <= a2); - case 2: + case PF_OP_EQ: return (p == a1); - case 3: + case PF_OP_NE: return (p != a1); - case 4: - return (p < a1); - case 5: + case PF_OP_LT: + return (p < a1); + case PF_OP_LE: return (p <= a1); - case 6: - return (p > a1); - case 7: + case PF_OP_GT: + return (p > a1); + case PF_OP_GE: return (p >= a1); } return (0); /* never reached */ diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 80a79a1b673..f4f72502024 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.20 2001/06/26 22:51:02 deraadt Exp $ */ +/* $OpenBSD: pfvar.h,v 1.21 2001/06/26 22:56:03 dugsong Exp $ */ /* * Copyright (c) 2001, Daniel Hartmeier @@ -38,6 +38,8 @@ enum { PF_IN=0, PF_OUT=1 }; enum { PF_PASS=0, PF_DROP=1, PF_DROP_RST=2 }; +enum { PF_OP_GL=1, PF_OP_EQ=2, PF_OP_NE=3, PF_OP_LT=4, + PF_OP_LE=5, PF_OP_GT=6, PF_OP_GE=7 }; struct pf_rule_addr { u_int32_t addr; |