summaryrefslogtreecommitdiffstats
path: root/src/expr/cmp.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-07-13 21:56:06 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-07-13 21:56:50 +0200
commit46439a3e8d6635a1461ff4c43665fb1425cadd1d (patch)
treef17038dee8b57cca27ca00ac3b5a25d151ba4791 /src/expr/cmp.c
parent4dd0772911a2c92a43d4e4aecf305fba498be106 (diff)
expr: add nft_expr_data to replace explicit casting to obtain expression data
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr/cmp.c')
-rw-r--r--src/expr/cmp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/expr/cmp.c b/src/expr/cmp.c
index f49261f..2fa9bf5 100644
--- a/src/expr/cmp.c
+++ b/src/expr/cmp.c
@@ -34,7 +34,7 @@ static int
nft_rule_expr_cmp_set(struct nft_rule_expr *e, uint16_t type,
const void *data, size_t data_len)
{
- struct nft_expr_cmp *cmp = (struct nft_expr_cmp *)e->data;
+ struct nft_expr_cmp *cmp = nft_expr_data(e);
switch(type) {
case NFT_EXPR_CMP_SREG:
@@ -57,7 +57,7 @@ static const void *
nft_rule_expr_cmp_get(const struct nft_rule_expr *e, uint16_t type,
size_t *data_len)
{
- struct nft_expr_cmp *cmp = (struct nft_expr_cmp *)e->data;
+ struct nft_expr_cmp *cmp = nft_expr_data(e);
switch(type) {
case NFT_EXPR_CMP_SREG:
@@ -118,7 +118,7 @@ static int nft_rule_expr_cmp_cb(const struct nlattr *attr, void *data)
static void
nft_rule_expr_cmp_build(struct nlmsghdr *nlh, struct nft_rule_expr *e)
{
- struct nft_expr_cmp *cmp = (struct nft_expr_cmp *)e->data;
+ struct nft_expr_cmp *cmp = nft_expr_data(e);
if (e->flags & (1 << NFT_EXPR_CMP_SREG))
mnl_attr_put_u32(nlh, NFTA_CMP_SREG, htonl(cmp->sreg));
@@ -136,7 +136,7 @@ nft_rule_expr_cmp_build(struct nlmsghdr *nlh, struct nft_rule_expr *e)
static int
nft_rule_expr_cmp_parse(struct nft_rule_expr *e, struct nlattr *attr)
{
- struct nft_expr_cmp *cmp = (struct nft_expr_cmp *)e->data;
+ struct nft_expr_cmp *cmp = nft_expr_data(e);
struct nlattr *tb[NFTA_CMP_MAX+1] = {};
int ret = 0;
@@ -171,7 +171,7 @@ static char *expr_cmp_str[] = {
static int nft_rule_expr_cmp_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree)
{
#ifdef XML_PARSING
- struct nft_expr_cmp *cmp = (struct nft_expr_cmp *)e->data;
+ struct nft_expr_cmp *cmp = nft_expr_data(e);
mxml_node_t *node = NULL;
int32_t reg;
@@ -280,7 +280,8 @@ static int
nft_rule_expr_cmp_snprintf(char *buf, size_t size, uint32_t type,
uint32_t flags, struct nft_rule_expr *e)
{
- struct nft_expr_cmp *cmp = (struct nft_expr_cmp *)e->data;
+ struct nft_expr_cmp *cmp = nft_expr_data(e);
+
switch(type) {
case NFT_RULE_O_DEFAULT:
return nft_rule_expr_cmp_snprintf_default(buf, size, cmp);