Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
net/netfilter/nf_synproxy_core.c
static void synproxy_send_client_ack_ipv6(struct net *net, const struct sk_buff *skb, const struct tcphdr *th, const struct synproxy_options *opts) { struct sk_buff *nskb; struct ipv6hdr *i...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_validate_state_update(struct net *net, u8 new_validate_state) { struct nftables_pernet *nft_net = nft_pernet(net); switch (nft_net->validate_state) { case NFT_VALIDATE_SKIP: WARN_ON_ONCE(new_validate_state == NFT_VALIDATE_DO); break; case NFT_VALIDATE_NEED: break; case NFT_VALIDA...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_ctx_init(struct nft_ctx *ctx, struct net *net, const struct sk_buff *skb, const struct nlmsghdr *nlh, u8 family, struct nft_table *table, struct nft_chain *chain, const struct nlattr *const *nla) { ctx...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static struct nft_trans *nft_trans_alloc(const struct nft_ctx *ctx, int msg_type, u32 size) { return nft_trans_alloc_gfp(ctx, msg_type, size, GFP_KERNEL); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_netdev_unregister_hooks(struct net *net, struct list_head *hook_list, bool release_netdev) { struct nft_hook *hook, *next; list_for_each_entry_safe(hook, next, hook_list, list) { nf_unregister_net_hook(net, &hook->...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_unregister_hook(struct net *net, const struct nft_table *table, struct nft_chain *chain) { return __nf_tables_unregister_hook(net, table, chain, false); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_trans_commit_list_add_tail(struct net *net, struct nft_trans *trans) { struct nftables_pernet *nft_net = nft_pernet(net); list_add_tail(&trans->list, &nft_net->commit_list); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_trans_table_add(struct nft_ctx *ctx, int msg_type) { struct nft_trans *trans; trans = nft_trans_alloc(ctx, msg_type, sizeof(struct nft_trans_table)); if (trans == NULL) return -ENOMEM; if (msg_type == NFT_MSG_NEWTABLE) nft_activate_next(ctx->net, ctx->table); nft_trans_commit_list_a...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_rule_expr_activate(const struct nft_ctx *ctx, struct nft_rule *rule) { struct nft_expr *expr; expr = nft_expr_first(rule); while (nft_expr_more(rule, expr)) { if (expr->ops->activate) expr->ops->activate(ctx, expr); expr = nft_expr_next(expr); ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_rule_expr_deactivate(const struct nft_ctx *ctx, struct nft_rule *rule, enum nft_trans_phase phase) { struct nft_expr *expr; expr = nft_expr_first(rule); while (nft_expr_more(rule, expr)) { if (expr->ops->deactivate) ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_delrule_deactivate(struct nft_ctx *ctx, struct nft_rule *rule) { if (nft_is_active_next(ctx->net, rule)) { nft_deactivate_next(ctx->net, rule); ctx->chain->use--; return 0; } return -ENOENT; }
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_delset(const struct nft_ctx *ctx, struct nft_set *set) { int err; err = nft_trans_set_add(ctx, NFT_MSG_DELSET, set); if (err < 0) return err; nft_deactivate_next(ctx->net, set); ctx->table->use--; return err; }
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_trans_flowtable_add(struct nft_ctx *ctx, int msg_type, struct nft_flowtable *flowtable) { struct nft_trans *trans; trans = nft_trans_alloc(ctx, msg_type, sizeof(struct nft_trans_flowtable)); if (trans == NULL) return -ENOMEM; if (msg_type == NFT_MSG_NEWFL...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_delflowtable(struct nft_ctx *ctx, struct nft_flowtable *flowtable) { int err; err = nft_trans_flowtable_add(ctx, NFT_MSG_DELFLOWTABLE, flowtable); if (err < 0) return err; nft_deactivate_next(ctx->net, flowtable); ctx->table->use--; return err; }
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static struct nft_table *nft_table_lookup(const struct net *net, const struct nlattr *nla, u8 family, u8 genmask, u32 nlpid) { struct nftables_pernet *nft_net; struct nft_table *table; if (nla == NULL) return ERR_PTR(-EINVAL)...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static const struct nft_chain_type * __nft_chain_type_get(u8 family, enum nft_chain_types type) { if (family >= NFPROTO_NUMPROTO || type >= NFT_CHAIN_T_MAX) return NULL; return chain_type[family][type]; }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_dump_tables(struct sk_buff *skb, struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); struct nftables_pernet *nft_net; const struct nft_table *table; unsigned int idx = 0, s_idx = cb->args[0]; struct net *net = sock_net(skb->...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_netlink_dump_start_rcu(struct sock *nlsk, struct sk_buff *skb, const struct nlmsghdr *nlh, struct netlink_dump_control *c) { int err; if (!try_module_get(THIS_MODULE)) return -EINVAL; rcu_read_unlock(); err = netli...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_table_disable(struct net *net, struct nft_table *table) { table->flags &= ~NFT_TABLE_F_DORMANT; nft_table_disable(net, table, 0); table->flags |= NFT_TABLE_F_DORMANT; } #define __NFT_TABLE_F_INTERNAL (NFT_TABLE_F_MASK + 1) #define __NFT_TABLE_F_WAS_DORMANT (__NFT_TABLE_F_INTERNAL << 0) #de...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_flush_table(struct nft_ctx *ctx) { struct nft_flowtable *flowtable, *nft; struct nft_chain *chain, *nc; struct nft_object *obj, *ne; struct nft_set *set, *ns; int err; list_for_each_entry(chain, &ctx->table->chains, list) { if (!nft_is_active_next(ctx->net, chain)) continue; ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_flush(struct nft_ctx *ctx, int family) { struct nftables_pernet *nft_net = nft_pernet(ctx->net); const struct nlattr *const *nla = ctx->nla; struct nft_table *table, *nt; int err = 0; list_for_each_entry_safe(table, nt, &nft_net->tables, list) { if (family != AF_UNSPEC && table->family !=...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_table_destroy(struct nft_ctx *ctx) { if (WARN_ON(ctx->table->use > 0)) return; rhltable_destroy(&ctx->table->chains_ht); kfree(ctx->table->name); kfree(ctx->table->udata); kfree(ctx->table); }
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
void nft_unregister_chain_type(const struct nft_chain_type *ctype) { nfnl_lock(NFNL_SUBSYS_NFTABLES); chain_type[ctype->family][ctype->type] = NULL; nfnl_unlock(NFNL_SUBSYS_NFTABLES); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static struct nft_chain *nft_chain_lookup(struct net *net, struct nft_table *table, const struct nlattr *nla, u8 genmask) { char search[NFT_CHAIN_MAXNAMELEN + 1]; struct rhlist_head *tmp, *...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_dump_stats(struct sk_buff *skb, struct nft_stats __percpu *stats) { struct nft_stats *cpu_stats, total; struct nlattr *nest; unsigned int seq; u64 pkts, bytes; int cpu; if (!stats) return 0; memset(&total, 0, sizeof(total)); for_each_possible_cpu(cpu) { ...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_dump_basechain_hook(struct sk_buff *skb, int family, const struct nft_base_chain *basechain) { const struct nf_hook_ops *ops = &basechain->ops; struct nft_hook *hook, *first = NULL; struct nlattr *nest, *nest_devs; int n = 0; nest = nla_nest_start_noflag(skb...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static struct nft_hook *nft_hook_list_find(struct list_head *hook_list, const struct nft_hook *this) { struct nft_hook *hook; list_for_each_entry(hook, hook_list, list) { if (this->ops.dev == hook->ops.dev) return hook; } return NULL; }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_last_rule(struct nft_rule_blob *blob, const void *ptr) { struct nft_rule_dp *prule; prule = (struct nft_rule_dp *)ptr; prule->is_last = 1; }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_fill_expr_info(struct sk_buff *skb, const struct nft_expr *expr, bool reset) { if (nla_put_string(skb, NFTA_EXPR_NAME, expr->ops->type->name)) goto nla_put_failure; if (expr->ops->dump) { struct nlattr *data = nla_nest_start_noflag(skb, NFTA_EXPR_DA...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr) { const struct nft_expr_type *type = expr->ops->type; if (expr->ops->destroy) expr->ops->destroy(ctx, expr); module_put(type->owner); }
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_rule_notify(const struct nft_ctx *ctx, const struct nft_rule *rule, int event) { struct nftables_pernet *nft_net = nft_pernet(ctx->net); const struct nft_rule *prule; struct sk_buff *skb; u64 handle = 0; u16 flags = 0; int err; if (!ctx->report && ...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int __nf_tables_dump_rules(struct sk_buff *skb, unsigned int *idx, struct netlink_callback *cb, const struct nft_table *table, const struct nft_chain *chain, bool reset) { struct net *net = sock_net(skb->sk);...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_dump_rules(struct sk_buff *skb, struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); const struct nft_rule_dump_ctx *ctx = cb->data; struct nft_table *table; const struct nft_chain *chain; unsigned int idx = 0; struct net *n...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_dump_rules_start(struct netlink_callback *cb) { const struct nlattr *const *nla = cb->data; struct nft_rule_dump_ctx *ctx = NULL; if (nla[NFTA_RULE_TABLE] || nla[NFTA_RULE_CHAIN]) { ctx = kzalloc(sizeof(*ctx), GFP_ATOMIC); if (!ctx) return -ENOMEM; if (nla[NFTA_RULE_TABLE...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_rule_destroy(const struct nft_ctx *ctx, struct nft_rule *rule) { struct nft_expr *expr, *next; expr = nft_expr_first(rule); while (nft_expr_more(rule, expr)) { next = nft_expr_next(expr); nf_tables_expr_destroy(ctx, expr); expr = next; } kf...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain) { struct nft_expr *expr, *last; const struct nft_data *data; struct nft_rule *rule; int err; if (ctx->level == NFT_JUMP_STACK_SIZE) return -EMLINK; list_for_each_entry(rule, &chain->rules, list) { ...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static struct nft_set *nft_set_lookup_byhandle(const struct nft_table *table, const struct nlattr *nla, u8 genmask) { struct nft_set *set; list_for_each_entry(set, &table->sets, list) { if (be64_to_cpu(nla_get_be64(n...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_fill_set_concat(struct sk_buff *skb, const struct nft_set *set) { struct nlattr *concat, *field; int i; concat = nla_nest_start_noflag(skb, NFTA_SET_DESC_CONCAT); if (!concat) return -ENOMEM; for (i = 0; i < set->field_count; i++) { field = ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_dump_sets(struct sk_buff *skb, struct netlink_callback *cb) { const struct nft_set *set; unsigned int idx, s_idx = cb->args[0]; struct nft_table *table, *cur_table = (struct nft_table *)cb->args[2]; struct net *net = sock_net(skb->sk); struct nft_ctx *ctx =...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_getset(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const nla[]) { struct netlink_ext_ack *extack = info->extack; u8 genmask = nft_genmask_cur(info->net); u8 family = info->nfmsg->nfgen_family; struct nft_table *table = NULL; struct n...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_set_desc_concat_parse(const struct nlattr *attr, struct nft_set_desc *desc) { struct nlattr *tb[NFTA_SET_FIELD_MAX + 1]; u32 len; int err; if (desc->field_count >= ARRAY_SIZE(desc->field_len)) return -E2BIG; err = nla_parse_nested_deprecated(tb, NFTA_...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_set_desc_parse(struct nft_set_desc *desc, const struct nlattr *nla) { struct nlattr *da[NFTA_SET_DESC_MAX + 1]; int err; err = nla_parse_nested_deprecated(da, NFTA_SET_DESC_MAX, nla, nft_set_desc_policy, NULL); if (er...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_delset(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const nla[]) { struct netlink_ext_ack *extack = info->extack; u8 genmask = nft_genmask_next(info->net); u8 family = info->nfmsg->nfgen_family; struct net *net = info->net; const str...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_setelem_data_validate(const struct nft_ctx *ctx, struct nft_set *set, struct nft_set_elem *elem) { const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv); enum nft_registers dreg; dreg = nft_type_to_reg(set->dtyp...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_set_catchall_bind_check(const struct nft_ctx *ctx, struct nft_set *set) { u8 genmask = nft_genmask_next(ctx->net); struct nft_set_elem_catchall *catchall; struct nft_set_elem elem; struct nft_set_ext *ext; int ret = 0; list_for_each_entry_rcu(catchall,...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_dump_set_start(struct netlink_callback *cb) { struct nft_set_dump_ctx *dump_ctx = cb->data; cb->data = kmemdup(dump_ctx, sizeof(*dump_ctx), GFP_ATOMIC); return cb->data ? 0 : -ENOMEM; }
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_setelem_get(struct nft_ctx *ctx, struct nft_set *set, struct nft_set_elem *elem, u32 flags) { void *priv; if (!(flags & NFT_SET_ELEM_CATCHALL)) { priv = set->ops->get(ctx->net, set, elem, flags); if (IS_ERR(priv)) return PTR_ERR(priv); } else { priv = ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static struct nft_trans *nft_trans_elem_alloc(struct nft_ctx *ctx, int msg_type, struct nft_set *set) { struct nft_trans *trans; trans = nft_trans_alloc(ctx, msg_type, sizeof(struct nft_trans_elem)); if (trans == NULL) return NULL; nft_trans_elem_set(trans) =...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
void *nft_set_elem_init(const struct nft_set *set, const struct nft_set_ext_tmpl *tmpl, const u32 *key, const u32 *key_end, const u32 *data, u64 timeout, u64 expiration, gfp_t gfp) { struct nft_set_ext *ext; void *elem; elem = kzalloc(set->...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void __nft_set_elem_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr) { if (expr->ops->destroy_clone) { expr->ops->destroy_clone(ctx, expr); module_put(expr->ops->type->owner); } else { nf_tables_expr_destroy(ctx, expr); } }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_set_elem_expr_setup(struct nft_ctx *ctx, const struct nft_set_ext_tmpl *tmpl, const struct nft_set_ext *ext, struct nft_expr *expr_array[], u32 num_exprs) { struc...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
struct nft_set_ext *nft_set_catchall_lookup(const struct net *net, const struct nft_set *set) { struct nft_set_elem_catchall *catchall; u8 genmask = nft_genmask_cur(net); struct nft_set_ext *ext; list_for_each_entry_rcu(catchall, &set->catchall_list, list) { ext...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
void *nft_set_catchall_gc(const struct nft_set *set) { struct nft_set_elem_catchall *catchall, *next; struct nft_set_ext *ext; void *elem = NULL; list_for_each_entry_safe(catchall, next, &set->catchall_list, list) { ext = nft_set_elem_ext(set, catchall->elem); if (!nft_set_elem_expired(ext) || nft_se...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_setelem_catchall_deactivate(const struct net *net, struct nft_set *set, struct nft_set_elem *elem) { struct nft_set_elem_catchall *catchall; struct nft_set_ext *ext; list_for_each_entry(catchall, &set->catchall_...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_setelem_catchall_remove(const struct net *net, const struct nft_set *set, const struct nft_set_elem *elem) { struct nft_set_elem_catchall *catchall, *next; list_for_each_entry_safe(catchall, next, &set->catchall_list, ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_setelem_flush(const struct nft_ctx *ctx, struct nft_set *set, const struct nft_set_iter *iter, struct nft_set_elem *elem) { struct nft_trans *trans; int err; trans = nft_trans_alloc_gfp(ctx, NFT_MSG_DELSETELEM, ...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int __nft_set_catchall_flush(const struct nft_ctx *ctx, struct nft_set *set, struct nft_set_elem *elem) { struct nft_trans *trans; trans = nft_trans_alloc_gfp(ctx, NFT_MSG_DELSETELEM, sizeof(struct nft_tra...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
void nft_unregister_obj(struct nft_object_type *obj_type) { nfnl_lock(NFNL_SUBSYS_NFTABLES); list_del_rcu(&obj_type->list); nfnl_unlock(NFNL_SUBSYS_NFTABLES); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
struct nft_object *nft_obj_lookup(const struct net *net, const struct nft_table *table, const struct nlattr *nla, u32 objtype, u8 genmask) { struct nft_object_hash_key k = {.table = table}; char search[NFT_OBJ_MAX...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static const struct nft_object_type *nft_obj_type_get(struct net *net, u32 objtype) { const struct nft_object_type *type; type = __nft_obj_type_get(objtype); if (type != NULL && try_module_get(type->owner)) return type; lockdep_nfnl_nft_mutex_not_held...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_updobj(const struct nft_ctx *ctx, const struct nft_object_type *type, const struct nlattr *attr, struct nft_object *obj) { struct nft_object *newobj; struct nft_trans *trans; int err = -ENOMEM; if (!try_module_get(type->owner)) r...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_delobj(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const nla[]) { struct netlink_ext_ack *extack = info->extack; u8 genmask = nft_genmask_next(info->net); u8 family = info->nfmsg->nfgen_family; struct net *net = info->net; const str...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
void nf_tables_deactivate_flowtable(const struct nft_ctx *ctx, struct nft_flowtable *flowtable, enum nft_trans_phase phase) { switch (phase) { case NFT_TRANS_PREPARE: case NFT_TRANS_ABORT: case NFT_TRANS_RELEASE: flowtable->use--; ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static const struct nf_flowtable_type *nft_flowtable_type_get(struct net *net, u8 family) { const struct nf_flowtable_type *type; type = __nft_flowtable_type_get(family); if (type != NULL && try_module_get(type->owner)) return type; lockdep_nf...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_flowtable_hooks_destroy(struct list_head *hook_list) { struct nft_hook *hook, *next; list_for_each_entry_safe(hook, next, hook_list, list) { list_del_rcu(&hook->list); kfree_rcu(hook, rcu); } }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_flowtable_hook_release(struct nft_flowtable_hook *flowtable_hook) { struct nft_hook *this, *next; list_for_each_entry_safe(this, next, &flowtable_hook->list, list) { list_del(&this->list); kfree(this); } }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_dump_flowtable(struct sk_buff *skb, struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); struct nft_flowtable_filter *filter = cb->data; unsigned int idx = 0, s_idx = cb->args[0]; struct net *net = sock_net(skb->sk); int f...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_dump_flowtable_start(struct netlink_callback *cb) { const struct nlattr *const *nla = cb->data; struct nft_flowtable_filter *filter = NULL; if (nla[NFTA_FLOWTABLE_TABLE]) { filter = kzalloc(sizeof(*filter), GFP_ATOMIC); if (!filter) return -ENOMEM; filter->table = nla_str...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_chain_commit_drop_policy(struct nft_trans *trans) { struct nft_base_chain *basechain; if (nft_trans_chain_policy(trans) != NF_DROP) return; if (!nft_is_base_chain(trans->ctx.chain)) return; basechain = nft_base_chain(trans->ctx.chain); basechain->policy = NF_DROP; }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nft_commit_release(struct nft_trans *trans) { switch (trans->msg_type) { case NFT_MSG_DELTABLE: nf_tables_table_destroy(&trans->ctx); break; case NFT_MSG_NEWCHAIN: free_percpu(nft_trans_chain_stats(trans)); kfree(nft_trans_chain_name(trans)); break; case NFT_MSG_DELCHAIN: nf...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_commit_release(struct net *net) { struct nftables_pernet *nft_net = nft_pernet(net); struct nft_trans *trans; if (list_empty(&nft_net->commit_list)) { nf_tables_module_autoload_cleanup(net); mutex_unlock(&nft_net->commit_mutex); return; } trans = list_last_entry(&nft_net->c...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_commit_audit_free(struct list_head *adl) { struct nft_audit_data *adp, *adn; list_for_each_entry_safe(adp, adn, adl, list) { list_del(&adp->list); kfree(adp); } }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void nf_tables_module_autoload(struct net *net) { struct nftables_pernet *nft_net = nft_pernet(net); struct nft_module_request *req, *next; LIST_HEAD(module_list); list_splice_init(&nft_net->module_list, &module_list); mutex_unlock(&nft_net->commit_mutex); list_for_each_entry_safe(req, next, &modul...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
int nft_chain_validate_hooks(const struct nft_chain *chain, unsigned int hook_flags) { struct nft_base_chain *basechain; if (nft_is_base_chain(chain)) { basechain = nft_base_chain(chain); if ((1 << basechain->ops.hooknum) & hook_flags) return 0; return -EOPNOTSUPP;...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nf_tables_loop_check_setelem(const struct nft_ctx *ctx, struct nft_set *set, const struct nft_set_iter *iter, struct nft_set_elem *elem) { const struct nft_set_ext *ext = nft_set_elem_ex...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_set_catchall_loops(const struct nft_ctx *ctx, struct nft_set *set) { u8 genmask = nft_genmask_next(ctx->net); struct nft_set_elem_catchall *catchall; struct nft_set_ext *ext; int ret = 0; list_for_each_entry_rcu(catchall, &set->catchall_list, list) { ext ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_parse_register(const struct nlattr *attr, u32 *preg) { unsigned int reg; reg = ntohl(nla_get_be32(attr)); switch (reg) { case NFT_REG_VERDICT ... NFT_REG_4: *preg = reg * NFT_REG_SIZE / NFT_REG32_SIZE; break; case NFT_REG32_00 ... NFT_REG32_15: *preg = reg + NFT_REG_SIZE / NFT_REG...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
int nft_dump_register(struct sk_buff *skb, unsigned int attr, unsigned int reg) { if (reg % (NFT_REG_SIZE / NFT_REG32_SIZE) == 0) reg = reg / (NFT_REG_SIZE / NFT_REG32_SIZE); else reg = reg - NFT_REG_SIZE / NFT_REG32_SIZE + NFT_REG32_00; return nla_put_be32(skb, attr, htonl(reg)); }
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
int nft_parse_register_store(const struct nft_ctx *ctx, const struct nlattr *attr, u8 *dreg, const struct nft_data *data, enum nft_data_types type, unsigned int len) { int err; u32 reg; err = nft_parse_register(attr, &reg); ...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data, struct nft_data_desc *desc, const struct nlattr *nla) { u8 genmask = nft_genmask_next(ctx->net); struct nlattr *tb[NFTA_VERDICT_MAX + 1]; struct nft_chain *chain; int err; er...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int nft_value_dump(struct sk_buff *skb, const struct nft_data *data, unsigned int len) { return nla_put(skb, NFTA_DATA_VALUE, len, data->data); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void __nft_release_hook(struct net *net, struct nft_table *table) { struct nft_flowtable *flowtable; struct nft_chain *chain; list_for_each_entry(chain, &table->chains, list) __nf_tables_unregister_hook(net, table, chain, true); list_for_each_entry(flowtable, &table->flowtables, list) __nft...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static int __init nf_tables_module_init(void) { int err; err = register_pernet_subsys(&nf_tables_net_ops); if (err < 0) return err; err = nft_chain_filter_init(); if (err < 0) goto err_chain_filter; err = nf_tables_core_module_init(); if (err < 0) goto err_core_module; err = register_net...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_api.c
static void __exit nf_tables_module_exit(void) { nfnetlink_subsys_unregister(&nf_tables_subsys); netlink_unregister_notifier(&nft_nl_notifier); nft_offload_exit(); unregister_netdevice_notifier(&nf_tables_flowtable_notifier); nft_chain_filter_fini(); nft_chain_route_fini(); unregister_pernet_subsys(&nf_t...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_core.c
static void expr_call_ops_eval(const struct nft_expr *expr, struct nft_regs *regs, struct nft_pktinfo *pkt) { #ifdef CONFIG_RETPOLINE unsigned long e = (unsigned long)expr->ops->eval; #define X(e, fun) \ do { ...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_core.c
int __init nf_tables_core_module_init(void) { int err, i, j = 0; nft_counter_init_seqcount(); for (i = 0; i < ARRAY_SIZE(nft_basic_objects); i++) { err = nft_register_obj(nft_basic_objects[i]); if (err) goto err; } for (j = 0; j < ARRAY_SIZE(nft_basic_types); j++) { err = nft_register_ex...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_core.c
void nf_tables_core_module_exit(void) { int i; i = ARRAY_SIZE(nft_basic_types); while (i-- > 0) nft_unregister_expr(nft_basic_types[i]); i = ARRAY_SIZE(nft_basic_objects); while (i-- > 0) nft_unregister_obj(nft_basic_objects[i]); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow, enum flow_dissector_key_id addr_type) { struct nft_flow_match *match = &flow->match; struct nft_flow_key *mask = &match->mask; struct nft_flow_key *key = &match->key; if (match->dissector.used_keys & BIT(FLOW_DISSECT...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
void nft_offload_update_dependency(struct nft_offload_ctx *ctx, const void *data, u32 len) { switch (ctx->dep.type) { case NFT_OFFLOAD_DEP_NETWORK: WARN_ON(len != sizeof(__u16)); memcpy(&ctx->dep.l3num, data, sizeof(__u16)); break; case NFT_OFFLOAD_DEP_TRANSPORT: ...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static void nft_flow_offload_common_init(struct flow_cls_common_offload *common, __be16 proto, int priority, struct netlink_ext_ack *extack) { common->protocol = proto; common->prio = priority; common->extack = extack; }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
bool nft_chain_offload_support(const struct nft_base_chain *basechain) { struct net_device *dev; struct nft_hook *hook; if (nft_chain_offload_priority(basechain) < 0) return false; list_for_each_entry(hook, &basechain->hook_list, list) { if (hook->ops.pf != NFPROTO_NETDEV || hook->ops.hooknum...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static int nft_flow_offload_cmd(const struct nft_chain *chain, const struct nft_rule *rule, struct nft_flow_rule *flow, enum flow_cls_command command, struct flow_cls_offload *cls_flow) { s...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static int nft_flow_offload_rule(const struct nft_chain *chain, struct nft_rule *rule, struct nft_flow_rule *flow, enum flow_cls_command command) { struct flow_cls_offload cls_flow; return nft_flow_offload_cmd(chain...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static int nft_flow_offload_unbind(struct flow_block_offload *bo, struct nft_base_chain *basechain) { struct flow_block_cb *block_cb, *next; struct flow_cls_offload cls_flow; struct netlink_ext_ack extack; struct nft_chain *chain; struct nft_rule *rule; chain = &basechai...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static void nft_flow_block_offload_init(struct flow_block_offload *bo, struct net *net, enum flow_block_command cmd, struct nft_base_chain *basechain, struct n...
[ 1, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static int nft_block_offload_cmd(struct nft_base_chain *chain, struct net_device *dev, enum flow_block_command cmd) { struct netlink_ext_ack extack = {}; struct flow_block_offload bo; int err; nft_flow_block_offload_init(&bo, dev_net(dev), cmd,...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static void nft_indr_block_cleanup(struct flow_block_cb *block_cb) { struct nft_base_chain *basechain = block_cb->indr.data; struct net_device *dev = block_cb->indr.dev; struct netlink_ext_ack extack = {}; struct nftables_pernet *nft_net; struct net *net = dev_net(dev); struct flow_block_offload bo; nft...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
static int nft_chain_offload_cmd(struct nft_base_chain *basechain, struct net_device *dev, enum flow_block_command cmd) { int err; if (dev->netdev_ops->ndo_setup_tc) err = nft_block_offload_cmd(basechain, dev, cmd); else err = nft_indr_bl...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_offload.c
void nft_offload_exit(void) { unregister_netdevice_notifier(&nft_offload_netdev_notifier); }
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_trace.c
static int nf_trace_fill_ll_header(struct sk_buff *nlskb, const struct sk_buff *skb) { struct vlan_ethhdr veth; int off; BUILD_BUG_ON(sizeof(veth) > NFT_TRACETYPE_LL_HSIZE); off = skb_mac_header(skb) - skb->data; if (off != -ETH_HLEN) return -1; if (skb_copy_bits(s...
[ 1, 0 ]