summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_fw.h
diff options
context:
space:
mode:
authorticso <ticso@FreeBSD.org>2003-06-04 01:17:37 +0000
committerticso <ticso@FreeBSD.org>2003-06-04 01:17:37 +0000
commitbb00c59c79a3aceacb0bb3712668d1a80352481f (patch)
tree886cc6b03c4460c9eed8881a0a71205b05c17d1c /sys/netinet/ip_fw.h
parent16f34ab41364565ebcc08fe935fb3ed7646887aa (diff)
downloadFreeBSD-src-bb00c59c79a3aceacb0bb3712668d1a80352481f.zip
FreeBSD-src-bb00c59c79a3aceacb0bb3712668d1a80352481f.tar.gz
Change handling to support strong alignment architectures such as alpha and
sparc64. PR: alpha/50658 Submitted by: rizzo Tested on: alpha
Diffstat (limited to 'sys/netinet/ip_fw.h')
-rw-r--r--sys/netinet/ip_fw.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h
index f2b932e..3aa2799 100644
--- a/sys/netinet/ip_fw.h
+++ b/sys/netinet/ip_fw.h
@@ -32,11 +32,16 @@
* The kernel representation of ipfw rules is made of a list of
* 'instructions' (for all practical purposes equivalent to BPF
* instructions), which specify which fields of the packet
- * (or its metatada) should be analysed.
+ * (or its metadata) should be analysed.
*
* Each instruction is stored in a structure which begins with
* "ipfw_insn", and can contain extra fields depending on the
* instruction type (listed below).
+ * Note that the code is written so that individual instructions
+ * have a size which is a multiple of 32 bits. This means that, if
+ * such structures contain pointers or other 64-bit entities,
+ * (there is just one instance now) they may end up unaligned on
+ * 64-bit architectures, so the must be handled with care.
*
* "enum ipfw_opcodes" are the opcodes supported. We can have up
* to 256 different opcodes.
@@ -211,7 +216,7 @@ typedef struct _ipfw_insn_if {
ipfw_insn o;
union {
struct in_addr ip;
- int unit;
+ int32_t unit;
} p;
char name[IFNAMSIZ];
} ipfw_insn_if;
@@ -220,10 +225,13 @@ typedef struct _ipfw_insn_if {
* This is used for pipe and queue actions, which need to store
* a single pointer (which can have different size on different
* architectures.
+ * Note that, because of previous instructions, pipe_ptr might
+ * be unaligned in the overall structure, so it needs to be
+ * manipulated with care.
*/
typedef struct _ipfw_insn_pipe {
ipfw_insn o;
- void *pipe_ptr;
+ void *pipe_ptr; /* XXX */
} ipfw_insn_pipe;
/*
@@ -278,7 +286,9 @@ typedef struct _ipfw_insn_log {
struct ip_fw {
struct ip_fw *next; /* linked list of rules */
struct ip_fw *next_rule; /* ptr to next [skipto] rule */
+#if 0 /* passed up using 'next_rule' */
u_int32_t set_disable; /* disabled sets (for userland) */
+#endif
u_int16_t act_ofs; /* offset of action in 32-bit units */
u_int16_t cmd_len; /* # of 32-bit words in cmd */
u_int16_t rulenum; /* rule number */
@@ -319,12 +329,12 @@ typedef struct _ipfw_dyn_rule ipfw_dyn_rule;
struct _ipfw_dyn_rule {
ipfw_dyn_rule *next; /* linked list of rules. */
- struct ipfw_flow_id id; /* (masked) flow id */
struct ip_fw *rule; /* pointer to rule */
ipfw_dyn_rule *parent; /* pointer to parent rule */
- u_int32_t expire; /* expire time */
u_int64_t pcnt; /* packet match counter */
u_int64_t bcnt; /* byte match counter */
+ struct ipfw_flow_id id; /* (masked) flow id */
+ u_int32_t expire; /* expire time */
u_int32_t bucket; /* which bucket in hash table */
u_int32_t state; /* state of this rule (typically a
* combination of TCP flags)
@@ -334,7 +344,9 @@ struct _ipfw_dyn_rule {
/* to generate keepalives) */
u_int16_t dyn_type; /* rule type */
u_int16_t count; /* refcount */
+#if 0 /* passed up with 'rule' */
u_int16_t rulenum; /* rule number (for userland) */
+#endif
};
/*
OpenPOWER on IntegriCloud