@@ -106,6 +106,9 @@ int main(int argc, char *argv[])
cmp_nftnl_rule(a,b);
+ nftnl_rule_unset(a, NFTNL_RULE_TABLE);
+ nftnl_rule_unset(a, NFTNL_RULE_CHAIN);
+ nftnl_rule_unset(a, NFTNL_RULE_USERDATA);
nftnl_rule_free(a);
nftnl_rule_free(b);
if (!test_ok)
@@ -35,6 +35,12 @@ static void cmp_nftnl_table(struct nftnl_table *a, struct nftnl_table *b)
if (nftnl_table_get_u32(a, NFTNL_TABLE_FAMILY) !=
nftnl_table_get_u32(b, NFTNL_TABLE_FAMILY))
print_err("table family mismatches");
+ if (nftnl_table_get_u64(a, NFTNL_TABLE_HANDLE) !=
+ nftnl_table_get_u64(b, NFTNL_TABLE_HANDLE))
+ print_err("tabke handle mismatches");
+ if (strcmp(nftnl_table_get_str(a, NFTNL_TABLE_USERDATA),
+ nftnl_table_get_str(b, NFTNL_TABLE_USERDATA)) != 0)
+ print_err("table userdata mismatches");
}
int main(int argc, char *argv[])
@@ -53,6 +59,8 @@ int main(int argc, char *argv[])
nftnl_table_set_str(a, NFTNL_TABLE_NAME, "test");
nftnl_table_set_u32(a, NFTNL_TABLE_FAMILY, AF_INET);
nftnl_table_set_u32(a, NFTNL_TABLE_FLAGS, 0);
+ nftnl_table_set_u64(a, NFTNL_TABLE_HANDLE, 0x12345678);
+ nftnl_table_set_str(a, NFTNL_TABLE_USERDATA, "test for userdata");
/* cmd extracted from include/linux/netfilter/nf_tables.h */
nlh = nftnl_nlmsg_build_hdr(buf, NFT_MSG_NEWTABLE, AF_INET, 0, 1234);
From: shixuantong <tongxiaoge1001@126.com> --- tests/nft-rule-test.c | 3 +++ tests/nft-table-test.c | 8 ++++++++ 2 files changed, 11 insertions(+)