summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMike Frantzen <frantzen@cvs.openbsd.org>2002-06-11 02:42:28 +0000
committerMike Frantzen <frantzen@cvs.openbsd.org>2002-06-11 02:42:28 +0000
commitfd36279ec65fd5e87bdc4f6f519aef14aa9d1e90 (patch)
tree1f993a1cd7effb421d18d8ca000493a2fd5384eb /sys/net
parent7923463712aeebd381606d84547c328d4e2d5a79 (diff)
enumerate UDP and OTHER state levels (similar to tcp_fsm.h)
ok dhartmei@, henning@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf.c30
-rw-r--r--sys/net/pfvar.h30
2 files changed, 44 insertions, 16 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 4d9558bb8ef..811b2f7f914 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.233 2002/06/11 02:12:37 dhartmei Exp $ */
+/* $OpenBSD: pf.c,v 1.234 2002/06/11 02:42:27 frantzen Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -2117,12 +2117,12 @@ pf_test_udp(struct pf_rule **rm, int direction, struct ifnet *ifp,
s->src.seqhi = 0;
s->src.seqdiff = 0;
s->src.max_win = 0;
- s->src.state = 1;
+ s->src.state = PFUDPS_SINGLE;
s->dst.seqlo = 0;
s->dst.seqhi = 0;
s->dst.seqdiff = 0;
s->dst.max_win = 0;
- s->dst.state = 0;
+ s->dst.state = PFUDPS_NO_TRAFFIC;
s->creation = time.tv_sec;
s->expire = s->creation + TIMEOUT(*rm, PFTM_UDP_FIRST_PACKET);
s->packets = 1;
@@ -2587,12 +2587,12 @@ pf_test_other(struct pf_rule **rm, int direction, struct ifnet *ifp,
s->src.seqhi = 0;
s->src.seqdiff = 0;
s->src.max_win = 0;
- s->src.state = 1;
+ s->src.state = PFOTHERS_SINGLE;
s->dst.seqlo = 0;
s->dst.seqhi = 0;
s->dst.seqdiff = 0;
s->dst.max_win = 0;
- s->dst.state = 0;
+ s->dst.state = PFOTHERS_NO_TRAFFIC;
s->creation = time.tv_sec;
s->expire = s->creation + TIMEOUT(*rm, PFTM_OTHER_FIRST_PACKET);
s->packets = 1;
@@ -2989,13 +2989,13 @@ pf_test_state_udp(struct pf_state **state, int direction, struct ifnet *ifp,
(*state)->bytes += pd->tot_len;
/* update states */
- if (src->state < 1)
- src->state = 1;
- if (dst->state == 1)
- dst->state = 2;
+ if (src->state < PFUDPS_SINGLE)
+ src->state = PFUDPS_SINGLE;
+ if (dst->state == PFUDPS_SINGLE)
+ dst->state = PFUDPS_MULTIPLE;
/* update expire time */
- if (src->state == 2 && dst->state == 2)
+ if (src->state == PFUDPS_MULTIPLE && dst->state == PFUDPS_MULTIPLE)
(*state)->expire = time.tv_sec +
TIMEOUT((*state)->rule.ptr, PFTM_UDP_MULTIPLE);
else
@@ -3532,13 +3532,13 @@ pf_test_state_other(struct pf_state **state, int direction, struct ifnet *ifp,
(*state)->bytes += pd->tot_len;
/* update states */
- if (src->state < 1)
- src->state = 1;
- if (dst->state == 1)
- dst->state = 2;
+ if (src->state < PFOTHERS_SINGLE)
+ src->state = PFOTHERS_SINGLE;
+ if (dst->state == PFOTHERS_SINGLE)
+ dst->state = PFOTHERS_MULTIPLE;
/* update expire time */
- if (src->state == 2 && dst->state == 2)
+ if (src->state == PFOTHERS_MULTIPLE && dst->state == PFOTHERS_MULTIPLE)
(*state)->expire = time.tv_sec +
TIMEOUT((*state)->rule.ptr, PFTM_OTHER_MULTIPLE);
else
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index d5fa79b158b..a7620286330 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfvar.h,v 1.85 2002/06/11 02:27:19 frantzen Exp $ */
+/* $OpenBSD: pfvar.h,v 1.86 2002/06/11 02:42:27 frantzen Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -429,6 +429,34 @@ struct pf_pdesc {
NULL \
}
+/* UDP state enumeration */
+#define PFUDPS_NO_TRAFFIC 0
+#define PFUDPS_SINGLE 1
+#define PFUDPS_MULTIPLE 2
+
+#define PFUDPS_NSTATES 3 /* number of state levels */
+
+#define PFUDPS_NAMES { \
+ "NO TRAFFIC", \
+ "SINGLE", \
+ "MULTIPLE", \
+ NULL \
+}
+
+/* Other protocol state enumeration */
+#define PFOTHERS_NO_TRAFFIC 0
+#define PFOTHERS_SINGLE 1
+#define PFOTHERS_MULTIPLE 2
+
+#define PFOTHERS_NSTATES 3 /* number of state levels */
+
+#define PFOTHERS_NAMES { \
+ "NO TRAFFIC", \
+ "SINGLE", \
+ "MULTIPLE", \
+ NULL \
+}
+
#define FCNT_STATE_SEARCH 0
#define FCNT_STATE_INSERT 1
#define FCNT_STATE_REMOVALS 2