summaryrefslogtreecommitdiffstats
path: root/src/conntrack/grp_getter.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-01-04 11:50:28 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-01-04 12:08:22 +0100
commit00c2c9dca32eb8eb8687b42fc6d135f35eaa5ff8 (patch)
tree165dc4759be70221168fe401c8c7b8114ea3039e /src/conntrack/grp_getter.c
parentac39464a7619955adf9b317c829a0de0379d7c04 (diff)
src: put nf_expect and nf_conntrack into diet
Now, struct nf_expect takes only 192 bytes, instead of 1KB. struct nf_conntrack takes 296 bytes instead of 328 bytes. The size of the nf_expect structure has been reduced by rearranging the layout of the nf_conntrack structure. For the nf_conntrack case, this removes the allocation of room for attributes that the master tuple does not use (more specifically, the NATseq bytes). This patch modifies the binary layout of struct nf_conntrack. This should not be a problem since the definition of this object is opaque (it can be only accessed via get/set API). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/conntrack/grp_getter.c')
-rw-r--r--src/conntrack/grp_getter.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/conntrack/grp_getter.c b/src/conntrack/grp_getter.c
index db5b67d..a8d43cf 100644
--- a/src/conntrack/grp_getter.c
+++ b/src/conntrack/grp_getter.c
@@ -12,72 +12,72 @@
static void get_attr_grp_orig_ipv4(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_ipv4 *this = data;
- this->src = ct->tuple[__DIR_ORIG].src.v4;
- this->dst = ct->tuple[__DIR_ORIG].dst.v4;
+ this->src = ct->head.orig.src.v4;
+ this->dst = ct->head.orig.dst.v4;
}
static void get_attr_grp_repl_ipv4(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_ipv4 *this = data;
- this->src = ct->tuple[__DIR_REPL].src.v4;
- this->dst = ct->tuple[__DIR_REPL].dst.v4;
+ this->src = ct->repl.src.v4;
+ this->dst = ct->repl.dst.v4;
}
static void get_attr_grp_orig_ipv6(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_ipv6 *this = data;
- memcpy(this->src, &ct->tuple[__DIR_ORIG].src.v6, sizeof(u_int32_t)*4);
- memcpy(this->dst, &ct->tuple[__DIR_ORIG].dst.v6, sizeof(u_int32_t)*4);
+ memcpy(this->src, &ct->head.orig.src.v6, sizeof(u_int32_t)*4);
+ memcpy(this->dst, &ct->head.orig.dst.v6, sizeof(u_int32_t)*4);
}
static void get_attr_grp_repl_ipv6(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_ipv6 *this = data;
- memcpy(this->src, &ct->tuple[__DIR_REPL].src.v6, sizeof(u_int32_t)*4);
- memcpy(this->dst, &ct->tuple[__DIR_REPL].dst.v6, sizeof(u_int32_t)*4);
+ memcpy(this->src, &ct->repl.src.v6, sizeof(u_int32_t)*4);
+ memcpy(this->dst, &ct->repl.dst.v6, sizeof(u_int32_t)*4);
}
static void get_attr_grp_orig_port(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_port *this = data;
- this->sport = ct->tuple[__DIR_ORIG].l4src.all;
- this->dport = ct->tuple[__DIR_ORIG].l4dst.all;
+ this->sport = ct->head.orig.l4src.all;
+ this->dport = ct->head.orig.l4dst.all;
}
static void get_attr_grp_repl_port(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_port *this = data;
- this->sport = ct->tuple[__DIR_REPL].l4src.all;
- this->dport = ct->tuple[__DIR_REPL].l4dst.all;
+ this->sport = ct->repl.l4src.all;
+ this->dport = ct->repl.l4dst.all;
}
static void get_attr_grp_icmp(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_icmp *this = data;
- this->type = ct->tuple[__DIR_ORIG].l4dst.icmp.type;
- this->code = ct->tuple[__DIR_ORIG].l4dst.icmp.code;
- this->id = ct->tuple[__DIR_ORIG].l4src.icmp.id;
+ this->type = ct->head.orig.l4dst.icmp.type;
+ this->code = ct->head.orig.l4dst.icmp.code;
+ this->id = ct->head.orig.l4src.icmp.id;
}
static void get_attr_grp_master_ipv4(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_ipv4 *this = data;
- this->src = ct->tuple[__DIR_MASTER].src.v4;
- this->dst = ct->tuple[__DIR_MASTER].dst.v4;
+ this->src = ct->master.src.v4;
+ this->dst = ct->master.dst.v4;
}
static void get_attr_grp_master_ipv6(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_ipv6 *this = data;
- memcpy(this->src, &ct->tuple[__DIR_MASTER].src.v6, sizeof(u_int32_t)*4);
- memcpy(this->dst, &ct->tuple[__DIR_MASTER].dst.v6, sizeof(u_int32_t)*4);
+ memcpy(this->src, &ct->master.src.v6, sizeof(u_int32_t)*4);
+ memcpy(this->dst, &ct->master.dst.v6, sizeof(u_int32_t)*4);
}
static void get_attr_grp_master_port(const struct nf_conntrack *ct, void *data)
{
struct nfct_attr_grp_port *this = data;
- this->sport = ct->tuple[__DIR_MASTER].l4src.all;
- this->dport = ct->tuple[__DIR_MASTER].l4dst.all;
+ this->sport = ct->master.l4src.all;
+ this->dport = ct->master.l4dst.all;
}
static void get_attr_grp_orig_ctrs(const struct nf_conntrack *ct, void *data)