H A D | nf_tables_api.c | 29 * @afi: address family info to register 34 int nft_register_afinfo(struct net *net, struct nft_af_info *afi) nft_register_afinfo() argument 36 INIT_LIST_HEAD(&afi->tables); nft_register_afinfo() 38 list_add_tail_rcu(&afi->list, &net->nft.af_info); nft_register_afinfo() 47 * @afi: address family info to unregister 51 void nft_unregister_afinfo(struct nft_af_info *afi) nft_unregister_afinfo() argument 54 list_del_rcu(&afi->list); nft_unregister_afinfo() 61 struct nft_af_info *afi; nft_afinfo_lookup() local 63 list_for_each_entry(afi, &net->nft.af_info, list) { nft_afinfo_lookup() 64 if (afi->family == family) nft_afinfo_lookup() 65 return afi; nft_afinfo_lookup() 73 struct nft_af_info *afi; nf_tables_afinfo_lookup() local 75 afi = nft_afinfo_lookup(net, family); nf_tables_afinfo_lookup() 76 if (afi != NULL) nf_tables_afinfo_lookup() 77 return afi; nf_tables_afinfo_lookup() 83 afi = nft_afinfo_lookup(net, family); nf_tables_afinfo_lookup() 84 if (afi != NULL) nf_tables_afinfo_lookup() 95 struct nft_af_info *afi, nft_ctx_init() 101 ctx->afi = afi; nft_ctx_init() 365 static struct nft_table *nft_table_lookup(const struct nft_af_info *afi, nft_table_lookup() argument 370 list_for_each_entry(table, &afi->tables, list) { nft_table_lookup() 377 static struct nft_table *nf_tables_table_lookup(const struct nft_af_info *afi, nf_tables_table_lookup() argument 385 table = nft_table_lookup(afi, nla); nf_tables_table_lookup() 413 nf_tables_chain_type_lookup(const struct nft_af_info *afi, nf_tables_chain_type_lookup() argument 419 type = __nf_tables_chain_type_lookup(afi->family, nla); nf_tables_chain_type_lookup() 425 request_module("nft-chain-%u-%.*s", afi->family, nf_tables_chain_type_lookup() 428 type = __nf_tables_chain_type_lookup(afi->family, nla); nf_tables_chain_type_lookup() 487 event, 0, ctx->afi->family, ctx->table); nf_tables_table_notify() 507 const struct nft_af_info *afi; nf_tables_dump_tables() local 516 list_for_each_entry_rcu(afi, &net->nft.af_info, list) { nf_tables_dump_tables() 517 if (family != NFPROTO_UNSPEC && family != afi->family) nf_tables_dump_tables() 520 list_for_each_entry_rcu(table, &afi->tables, list) { nf_tables_dump_tables() 531 afi->family, table) < 0) nf_tables_dump_tables() 550 const struct nft_af_info *afi; nf_tables_gettable() local 564 afi = nf_tables_afinfo_lookup(net, family, false); nf_tables_gettable() 565 if (IS_ERR(afi)) nf_tables_gettable() 566 return PTR_ERR(afi); nf_tables_gettable() 568 table = nf_tables_table_lookup(afi, nla[NFTA_TABLE_NAME]); nf_tables_gettable() 591 static int nf_tables_table_enable(const struct nft_af_info *afi, nf_tables_table_enable() argument 601 err = nft_register_basechain(nft_base_chain(chain), afi->nops); nf_tables_table_enable() 616 nft_unregister_basechain(nft_base_chain(chain), afi->nops); nf_tables_table_enable() 621 static void nf_tables_table_disable(const struct nft_af_info *afi, nf_tables_table_disable() argument 629 afi->nops); nf_tables_table_disable() 659 ret = nf_tables_table_enable(ctx->afi, ctx->table); nf_tables_updtable() 682 struct nft_af_info *afi; nf_tables_newtable() local 689 afi = nf_tables_afinfo_lookup(net, family, true); nf_tables_newtable() 690 if (IS_ERR(afi)) nf_tables_newtable() 691 return PTR_ERR(afi); nf_tables_newtable() 694 table = nf_tables_table_lookup(afi, name); nf_tables_newtable() 709 nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); nf_tables_newtable() 720 if (!try_module_get(afi->owner)) nf_tables_newtable() 733 nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); nf_tables_newtable() 738 list_add_tail_rcu(&table->list, &afi->tables); nf_tables_newtable() 743 module_put(afi->owner); nf_tables_newtable() 787 struct nft_af_info *afi; nft_flush() local 792 list_for_each_entry(afi, &ctx->net->nft.af_info, list) { nft_flush() 793 if (family != AF_UNSPEC && afi->family != family) nft_flush() 796 ctx->afi = afi; nft_flush() 797 list_for_each_entry_safe(table, nt, &afi->tables, list) { nft_flush() 818 struct nft_af_info *afi; nf_tables_deltable() local 827 afi = nf_tables_afinfo_lookup(net, family, false); nf_tables_deltable() 828 if (IS_ERR(afi)) nf_tables_deltable() 829 return PTR_ERR(afi); nf_tables_deltable() 831 table = nf_tables_table_lookup(afi, nla[NFTA_TABLE_NAME]); nf_tables_deltable() 837 ctx.afi = afi; nf_tables_deltable() 848 module_put(ctx->afi->owner); nf_tables_table_destroy() 1039 event, 0, ctx->afi->family, ctx->table, nf_tables_chain_notify() 1060 const struct nft_af_info *afi; nf_tables_dump_chains() local 1070 list_for_each_entry_rcu(afi, &net->nft.af_info, list) { nf_tables_dump_chains() 1071 if (family != NFPROTO_UNSPEC && family != afi->family) nf_tables_dump_chains() 1074 list_for_each_entry_rcu(table, &afi->tables, list) { nf_tables_dump_chains() 1086 afi->family, table, chain) < 0) nf_tables_dump_chains() 1106 const struct nft_af_info *afi; nf_tables_getchain() local 1121 afi = nf_tables_afinfo_lookup(net, family, false); nf_tables_getchain() 1122 if (IS_ERR(afi)) nf_tables_getchain() 1123 return PTR_ERR(afi); nf_tables_getchain() 1125 table = nf_tables_table_lookup(afi, nla[NFTA_CHAIN_TABLE]); nf_tables_getchain() 1229 struct nft_af_info *afi; nf_tables_newchain() local 1246 afi = nf_tables_afinfo_lookup(net, family, true); nf_tables_newchain() 1247 if (IS_ERR(afi)) nf_tables_newchain() 1248 return PTR_ERR(afi); nf_tables_newchain() 1250 table = nf_tables_table_lookup(afi, nla[NFTA_CHAIN_TABLE]); nf_tables_newchain() 1314 nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); nf_tables_newchain() 1349 type = nf_tables_chain_type_lookup(afi, nf_tables_newchain() 1365 if (hooknum >= afi->nhooks) nf_tables_newchain() 1375 if (afi->flags & NFT_AF_NEEDS_DEV) { nf_tables_newchain() 1431 for (i = 0; i < afi->nops; i++) { nf_tables_newchain() 1437 ops->hook = afi->hooks[ops->hooknum]; nf_tables_newchain() 1441 if (afi->hook_ops_init) nf_tables_newchain() 1442 afi->hook_ops_init(ops, i); nf_tables_newchain() 1458 err = nf_tables_register_hooks(table, chain, afi->nops); nf_tables_newchain() 1462 nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); nf_tables_newchain() 1471 nf_tables_unregister_hooks(table, chain, afi->nops); nf_tables_newchain() 1482 struct nft_af_info *afi; nf_tables_delchain() local 1488 afi = nf_tables_afinfo_lookup(net, family, false); nf_tables_delchain() 1489 if (IS_ERR(afi)) nf_tables_delchain() 1490 return PTR_ERR(afi); nf_tables_delchain() 1492 table = nf_tables_table_lookup(afi, nla[NFTA_CHAIN_TABLE]); nf_tables_delchain() 1506 nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); nf_tables_delchain() 1654 type = nft_expr_type_get(ctx->afi->family, tb[NFTA_EXPR_NAME]); nf_tables_expr_parse() 1864 event, 0, ctx->afi->family, ctx->table, nf_tables_rule_notify() 1885 const struct nft_af_info *afi; nf_tables_dump_rules() local 1896 list_for_each_entry_rcu(afi, &net->nft.af_info, list) { nf_tables_dump_rules() 1897 if (family != NFPROTO_UNSPEC && family != afi->family) nf_tables_dump_rules() 1900 list_for_each_entry_rcu(table, &afi->tables, list) { nf_tables_dump_rules() 1914 afi->family, table, chain, rule) < 0) nf_tables_dump_rules() 1936 const struct nft_af_info *afi; nf_tables_getrule() local 1952 afi = nf_tables_afinfo_lookup(net, family, false); nf_tables_getrule() 1953 if (IS_ERR(afi)) nf_tables_getrule() 1954 return PTR_ERR(afi); nf_tables_getrule() 1956 table = nf_tables_table_lookup(afi, nla[NFTA_RULE_TABLE]); nf_tables_getrule() 2015 struct nft_af_info *afi; nf_tables_newrule() local 2031 afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, create); nf_tables_newrule() 2032 if (IS_ERR(afi)) nf_tables_newrule() 2033 return PTR_ERR(afi); nf_tables_newrule() 2035 table = nf_tables_table_lookup(afi, nla[NFTA_RULE_TABLE]); nf_tables_newrule() 2074 nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); nf_tables_newrule() 2180 struct nft_af_info *afi; nf_tables_delrule() local 2187 afi = nf_tables_afinfo_lookup(net, family, false); nf_tables_delrule() 2188 if (IS_ERR(afi)) nf_tables_delrule() 2189 return PTR_ERR(afi); nf_tables_delrule() 2191 table = nf_tables_table_lookup(afi, nla[NFTA_RULE_TABLE]); nf_tables_delrule() 2203 nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); nf_tables_delrule() 2348 struct nft_af_info *afi = NULL; nft_ctx_init_from_setattr() local 2352 afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, false); nft_ctx_init_from_setattr() 2353 if (IS_ERR(afi)) nft_ctx_init_from_setattr() 2354 return PTR_ERR(afi); nft_ctx_init_from_setattr() 2358 if (afi == NULL) nft_ctx_init_from_setattr() 2361 table = nf_tables_table_lookup(afi, nla[NFTA_SET_TABLE]); nft_ctx_init_from_setattr() 2368 nft_ctx_init(ctx, net, skb, nlh, afi, table, NULL, nla); nft_ctx_init_from_setattr() 2462 nfmsg->nfgen_family = ctx->afi->family; nf_tables_fill_set() 2548 struct nft_af_info *afi; nf_tables_dump_sets() local 2560 list_for_each_entry_rcu(afi, &net->nft.af_info, list) { nf_tables_dump_sets() 2561 if (ctx->afi && ctx->afi != afi) nf_tables_dump_sets() 2565 if (afi->family != cur_family) nf_tables_dump_sets() 2570 list_for_each_entry_rcu(table, &afi->tables, list) { nf_tables_dump_sets() 2587 ctx_set.afi = afi; nf_tables_dump_sets() 2593 cb->args[3] = afi->family; nf_tables_dump_sets() 2697 struct nft_af_info *afi; nf_tables_newset() local 2787 afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, create); nf_tables_newset() 2788 if (IS_ERR(afi)) nf_tables_newset() 2789 return PTR_ERR(afi); nf_tables_newset() 2791 table = nf_tables_table_lookup(afi, nla[NFTA_SET_TABLE]); nf_tables_newset() 2795 nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); nf_tables_newset() 3028 struct nft_af_info *afi; nft_ctx_init_from_elemattr() local 3031 afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, false); nft_ctx_init_from_elemattr() 3032 if (IS_ERR(afi)) nft_ctx_init_from_elemattr() 3033 return PTR_ERR(afi); nft_ctx_init_from_elemattr() 3035 table = nf_tables_table_lookup(afi, nla[NFTA_SET_ELEM_LIST_TABLE]); nft_ctx_init_from_elemattr() 3041 nft_ctx_init(ctx, net, skb, nlh, afi, table, NULL, nla); nft_ctx_init_from_elemattr() 3169 nfmsg->nfgen_family = ctx.afi->family; nf_tables_dump_set() 3251 nfmsg->nfgen_family = ctx->afi->family; nf_tables_fill_setelem_info() 3455 .afi = ctx->afi, nft_add_set_elem() 3906 nf_tables_table_disable(trans->ctx.afi, nf_tables_commit() 3932 trans->ctx.afi->nops); nf_tables_commit() 4033 nf_tables_table_disable(trans->ctx.afi, nf_tables_abort() 4044 &trans->ctx.afi->tables); nf_tables_abort() 4057 trans->ctx.afi->nops); nf_tables_abort() 91 nft_ctx_init(struct nft_ctx *ctx, struct net *net, const struct sk_buff *skb, const struct nlmsghdr *nlh, struct nft_af_info *afi, struct nft_table *table, struct nft_chain *chain, const struct nlattr * const *nla) nft_ctx_init() argument
|