bool found = false;
nft_xt_builtin_init(h, table);
+ nft_assert_table_compatible(h, table, chain);
ops = nft_family_ops_lookup(h->family);
- if (!nft_is_table_compatible(h, table))
- xtables_error(OTHER_PROBLEM, "table `%s' is incompatible, use 'nft' tool.\n", table);
-
list = nft_chain_list_get(h, table, chain);
if (!list)
return 0;
int ret = 0;
nft_xt_builtin_init(h, table);
-
- if (!nft_is_table_compatible(h, table))
- xtables_error(OTHER_PROBLEM, "table `%s' is incompatible, use 'nft' tool.\n", table);
+ nft_assert_table_compatible(h, table, chain);
list = nft_chain_list_get(h, table, chain);
if (!list)
return 0;
}
-bool nft_is_table_compatible(struct nft_handle *h, const char *tablename)
+bool nft_is_table_compatible(struct nft_handle *h,
+ const char *table, const char *chain)
{
struct nftnl_chain_list *clist;
- clist = nft_chain_list_get(h, tablename, NULL);
+ clist = nft_chain_list_get(h, table, chain);
if (clist == NULL)
return false;
return true;
}
+
+void nft_assert_table_compatible(struct nft_handle *h,
+ const char *table, const char *chain)
+{
+ const char *pfx = "", *sfx = "";
+
+ if (nft_is_table_compatible(h, table, chain))
+ return;
+
+ if (chain) {
+ pfx = "chain `";
+ sfx = "' in ";
+ } else {
+ chain = "";
+ }
+ xtables_error(OTHER_PROBLEM,
+ "%s%s%stable `%s' is incompatible, use 'nft' tool.\n",
+ pfx, chain, sfx, table);
+}
void nft_rule_to_arpt_entry(struct nftnl_rule *r, struct arpt_entry *fw);
-bool nft_is_table_compatible(struct nft_handle *h, const char *name);
+bool nft_is_table_compatible(struct nft_handle *h,
+ const char *table, const char *chain);
+void nft_assert_table_compatible(struct nft_handle *h,
+ const char *table, const char *chain);
int ebt_set_user_chain_policy(struct nft_handle *h, const char *table,
const char *chain, const char *policy);