nftnlrdr_misc.c: replace nftnl_rule_get_data() usage with specific nftnl_rule_get_*() functions
nftnl_rule_get_u32() nftnl_rule_get_u64() nftnl_rule_get_str() closes #641 should fix #582
This commit is contained in:
parent
67ea8c8bc3
commit
904dda47ed
|
@ -545,18 +545,16 @@ table_cb(const struct nlmsghdr *nlh, void *data)
|
||||||
result = MNL_CB_ERROR;
|
result = MNL_CB_ERROR;
|
||||||
} else {
|
} else {
|
||||||
const char *chain;
|
const char *chain;
|
||||||
uint32_t len;
|
|
||||||
|
|
||||||
memset(r, 0, sizeof(rule_t));
|
memset(r, 0, sizeof(rule_t));
|
||||||
|
|
||||||
chain = (const char *) nftnl_rule_get_data(rule, NFTNL_RULE_CHAIN, &len);
|
chain = nftnl_rule_get_str(rule, NFTNL_RULE_CHAIN);
|
||||||
if (strcmp(chain, nft_prerouting_chain) == 0 ||
|
if (strcmp(chain, nft_prerouting_chain) == 0 ||
|
||||||
strcmp(chain, nft_postrouting_chain) == 0 ||
|
strcmp(chain, nft_postrouting_chain) == 0 ||
|
||||||
strcmp(chain, nft_forward_chain) == 0) {
|
strcmp(chain, nft_forward_chain) == 0) {
|
||||||
r->table = strdup((const char *) nftnl_rule_get_data(rule, NFTNL_RULE_TABLE, &len));
|
r->table = strdup(nftnl_rule_get_str(rule, NFTNL_RULE_TABLE));
|
||||||
r->chain = strdup(chain);
|
r->chain = strdup(chain);
|
||||||
r->family = *(uint32_t *) nftnl_rule_get_data(rule, NFTNL_RULE_FAMILY,
|
r->family = nftnl_rule_get_u32(rule, NFTNL_RULE_FAMILY);
|
||||||
&len);
|
|
||||||
if (nftnl_rule_is_set(rule, NFTNL_RULE_USERDATA)) {
|
if (nftnl_rule_is_set(rule, NFTNL_RULE_USERDATA)) {
|
||||||
const char *descr;
|
const char *descr;
|
||||||
descr = (const char *) nftnl_rule_get_data(rule, NFTNL_RULE_USERDATA,
|
descr = (const char *) nftnl_rule_get_data(rule, NFTNL_RULE_USERDATA,
|
||||||
|
@ -572,9 +570,7 @@ table_cb(const struct nlmsghdr *nlh, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r->handle = *(uint32_t *) nftnl_rule_get_data(rule,
|
r->handle = nftnl_rule_get_u64(rule, NFTNL_RULE_HANDLE);
|
||||||
NFTNL_RULE_HANDLE,
|
|
||||||
&len);
|
|
||||||
r->type = CB_DATA(type);
|
r->type = CB_DATA(type);
|
||||||
|
|
||||||
itr = nftnl_expr_iter_create(rule);
|
itr = nftnl_expr_iter_create(rule);
|
||||||
|
|
Loading…
Reference in New Issue