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
should fix
@@ -545,18 +545,16 @@ table_cb(const struct nlmsghdr *nlh, void *data)
result = MNL_CB_ERROR;
} else {
const char *chain;
- uint32_t len;
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 ||
strcmp(chain, nft_postrouting_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->family = *(uint32_t *) nftnl_rule_get_data(rule, NFTNL_RULE_FAMILY,
- &len);
+ r->family = nftnl_rule_get_u32(rule, NFTNL_RULE_FAMILY);
if (nftnl_rule_is_set(rule, NFTNL_RULE_USERDATA)) {
const char *descr;
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,
- NFTNL_RULE_HANDLE,
- &len);
+ r->handle = nftnl_rule_get_u64(rule, NFTNL_RULE_HANDLE);
r->type = CB_DATA(type);
itr = nftnl_expr_iter_create(rule);
