Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | net/netfilter/nft_connlimit.c |
static void nft_connlimit_destroy_clone(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
struct nft_connlimit *priv = nft_expr_priv(expr);
nf_conncount_cache_free(priv->list);
kfree(priv->list);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_counter.c |
static inline void nft_counter_do_eval(struct nft_counter_percpu_priv *priv,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_counter *this_cpu;
seqcount_t *myseq;
local_bh_disable();
this_cpu = this_cpu_ptr(priv->... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_counter.c |
static int nft_counter_obj_init(const struct nft_ctx *ctx,
const struct nlattr *const tb[],
struct nft_object *obj) {
struct nft_counter_percpu_priv *priv = nft_obj_data(obj);
return nft_counter_do_init(tb, priv);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_counter.c |
static void nft_counter_obj_destroy(const struct nft_ctx *ctx,
struct nft_object *obj) {
struct nft_counter_percpu_priv *priv = nft_obj_data(obj);
nft_counter_do_destroy(priv);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_counter.c |
static int nft_counter_clone(struct nft_expr *dst, const struct nft_expr *src) {
struct nft_counter_percpu_priv *priv = nft_expr_priv(src);
struct nft_counter_percpu_priv *priv_clone = nft_expr_priv(dst);
struct nft_counter __percpu *cpu_stats;
struct nft_counter *this_cpu;
struct nft_counter total;
nft_c... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_ct.c |
static void nft_ct_set_eval(const struct nft_expr *expr, struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
const struct nft_ct *priv = nft_expr_priv(expr);
struct sk_buff *skb = pkt->skb;
#if defined(CONFIG_NF_CONNTRACK_MARK) || defined(CONFIG_NF_CONNTRACK_SECMARK)
u32 value = r... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_ct.c |
static void nft_ct_get_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
nf_ct_netns_put(ctx->net, ctx->family);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_ct.c |
static void nft_ct_set_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
struct nft_ct *priv = nft_expr_priv(expr);
__nft_ct_set_destroy(ctx, priv);
nf_ct_netns_put(ctx->net, ctx->family);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_ct.c |
static int nft_ct_timeout_obj_dump(struct sk_buff *skb, struct nft_object *obj,
bool reset) {
const struct nft_ct_timeout_obj *priv = nft_obj_data(obj);
const struct nf_ct_timeout *timeout = priv->timeout;
struct nlattr *nest_params;
int ret;
if (nla_put_u8(skb, NFTA_CT_TI... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_ct.c |
static int nft_ct_helper_obj_dump(struct sk_buff *skb, struct nft_object *obj,
bool reset) {
const struct nft_ct_helper_obj *priv = nft_obj_data(obj);
const struct nf_conntrack_helper *helper;
u16 family;
if (priv->helper4 && priv->helper6) {
family = NFPROTO_INET;
he... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_ct.c |
static int __init nft_ct_module_init(void) {
int err;
BUILD_BUG_ON(NF_CT_LABELS_MAX_SIZE > NFT_REG_SIZE);
err = nft_register_expr(&nft_ct_type);
if (err < 0)
return err;
err = nft_register_expr(&nft_notrack_type);
if (err < 0)
goto err1;
err = nft_register_obj(&nft_ct_helper_obj_type);
if (... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_dynset.c |
void nft_dynset_eval(const struct nft_expr *expr, struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
const struct nft_dynset *priv = nft_expr_priv(expr);
struct nft_set *set = priv->set;
const struct nft_set_ext *ext;
u64 timeout;
if (priv->op == NFT_DYNSET_OP_DELETE) {
set->op... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_dynset.c |
static void nft_dynset_ext_add_expr(struct nft_dynset *priv) {
u8 size = 0;
int i;
for (i = 0; i < priv->num_exprs; i++)
size += priv->expr_array[i]->ops->size;
nft_set_ext_add_length(&priv->tmpl, NFT_SET_EXT_EXPRESSIONS,
sizeof(struct nft_set_elem_expr) + size);
} | [
1,
0
] |
Linux Kernel | net/netfilter/nft_dynset.c |
static void nft_dynset_activate(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
struct nft_dynset *priv = nft_expr_priv(expr);
priv->set->use++;
} | [
1,
0
] |
Linux Kernel | net/netfilter/nft_dynset.c |
static void nft_dynset_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
struct nft_dynset *priv = nft_expr_priv(expr);
int i;
for (i = 0; i < priv->num_exprs; i++)
nft_expr_destroy(ctx, priv->expr_array[i]);
nf_tables_destroy_set(ctx, priv->set);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_exthdr.c |
static void *nft_tcp_header_pointer(const struct nft_pktinfo *pkt,
unsigned int len, void *buffer,
unsigned int *tcphdr_len) {
struct tcphdr *tcph;
if (pkt->tprot != IPPROTO_TCP || pkt->fragoff)
return NULL;
tcph = skb_header_pointer(p... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_exthdr.c |
static void nft_exthdr_tcp_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
u8 buff[sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE];
struct nft_exthdr *priv = nft_expr_priv(expr);
unsigned int i, optl, tcphdr_l... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_exthdr.c | static void nft_exthdr_tcp_strip_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
u8 buff[sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE];
struct nft_exthdr *priv = nft_expr_priv(expr);
unsigned int ... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_exthdr.c |
static int nft_exthdr_tcp_strip_init(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nlattr *const tb[]) {
struct nft_exthdr *priv = nft_expr_priv(expr);
if (tb[NFTA_EXTHDR_SREG] || tb[NFTA_EXTHDR_DREG] || tb[NFTA_EXTHD... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_fib_inet.c |
static void nft_fib_inet_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
const struct nft_fib *priv = nft_expr_priv(expr);
switch (nft_pf(pkt)) {
case NFPROTO_IPV4:
switch (priv->result) {
case NFT_FIB_... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_flow_offload.c |
static bool nft_is_valid_ether_device(const struct net_device *dev) {
if (!dev || (dev->flags & IFF_LOOPBACK) || dev->type != ARPHRD_ETHER ||
dev->addr_len != ETH_ALEN || !is_valid_ether_addr(dev->dev_addr))
return false;
return true;
} | [
1,
0
] |
Linux Kernel | net/netfilter/nft_flow_offload.c |
static void nft_dev_forward_path(struct nf_flow_route *route,
const struct nf_conn *ct,
enum ip_conntrack_dir dir,
struct nft_flowtable *ft) {
const struct dst_entry *dst = route->tuple[dir].dst;
struct net_device_pa... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_flow_offload.c |
static bool nft_flow_offload_skip(struct sk_buff *skb, int family) {
if (skb_sec_path(skb))
return true;
if (family == NFPROTO_IPV4) {
const struct ip_options *opt;
opt = &(IPCB(skb)->opt);
if (unlikely(opt->optlen))
return true;
}
return false;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_flow_offload.c |
static int nft_flow_offload_validate(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nft_data **data) {
unsigned int hook_mask = (1 << NF_INET_FORWARD);
return nft_chain_validate_hooks(ctx->chain, hook_mask);
} | [
1,
0
] |
Linux Kernel | net/netfilter/nft_flow_offload.c |
static void nft_flow_offload_deactivate(const struct nft_ctx *ctx,
const struct nft_expr *expr,
enum nft_trans_phase phase) {
struct nft_flow_offload *priv = nft_expr_priv(expr);
nf_tables_deactivate_flowtable(ctx, priv->flowtable, ph... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_flow_offload.c |
static void nft_flow_offload_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
nf_ct_netns_put(ctx->net, ctx->family);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_fwd_netdev.c |
static int nft_fwd_netdev_offload(struct nft_offload_ctx *ctx,
struct nft_flow_rule *flow,
const struct nft_expr *expr) {
const struct nft_fwd_netdev *priv = nft_expr_priv(expr);
int oif = ctx->regs[priv->sreg_dev].data.data[0];
return nft_fwd_... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_fwd_netdev.c |
static bool nft_fwd_netdev_offload_action(const struct nft_expr *expr) {
return true;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_fwd_netdev.c |
static int nft_fwd_validate(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nft_data **data) {
return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS) |
(1 << NF_NETDEV_EGRESS))... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_hash.c |
static void nft_jhash_eval(const struct nft_expr *expr, struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_jhash *priv = nft_expr_priv(expr);
const void *data = ®s->data[priv->sreg];
u32 h;
h = reciprocal_scale(jhash(data, priv->len, priv->seed), priv->modulus);
... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_hash.c |
static int nft_jhash_init(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nlattr *const tb[]) {
struct nft_jhash *priv = nft_expr_priv(expr);
u32 len;
int err;
if (!tb[NFTA_HASH_SREG] || !tb[NFTA_HASH_DREG] || !tb[NFTA_HASH_LEN] ||
... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_hash.c |
static int nft_symhash_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_symhash *priv = nft_expr_priv(expr);
if (nft_dump_register(skb, NFTA_HASH_DREG, priv->dreg))
goto nla_put_failure;
if (nla_put_be32(skb, NFTA_HASH_MODULUS, htonl(priv->mod... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_hash.c |
static void __exit nft_hash_module_exit(void) {
nft_unregister_expr(&nft_hash_type);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_immediate.c |
static enum nft_data_types nft_reg_to_type(const struct nlattr *nla) {
enum nft_data_types type;
u8 reg;
reg = ntohl(nla_get_be32(nla));
if (reg == NFT_REG_VERDICT)
type = NFT_DATA_VERDICT;
else
type = NFT_DATA_VALUE;
return type;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_immediate.c |
static int nft_immediate_init(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nlattr *const tb[]) {
struct nft_immediate_expr *priv = nft_expr_priv(expr);
struct nft_data_desc desc = {
.size = sizeof(priv->data),
};
int err;... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_immediate.c |
static void nft_immediate_deactivate(const struct nft_ctx *ctx,
const struct nft_expr *expr,
enum nft_trans_phase phase) {
const struct nft_immediate_expr *priv = nft_expr_priv(expr);
if (phase == NFT_TRANS_COMMIT)
return;
return nft... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_immediate.c |
static void nft_immediate_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
const struct nft_immediate_expr *priv = nft_expr_priv(expr);
const struct nft_data *data = &priv->data;
struct nft_rule *rule, *n;
struct nft_ctx chain_ctx;
struct nft_chain *chain;
... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_immediate.c |
static int
nft_immediate_offload_verdict(struct nft_offload_ctx *ctx,
struct nft_flow_rule *flow,
const struct nft_immediate_expr *priv) {
struct flow_action_entry *entry;
const struct nft_data *data;
entry = &flow->rule->action.entries[ctx->num_action... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_inner.c |
static int nft_inner_parse(const struct nft_inner *priv,
struct nft_pktinfo *pkt,
struct nft_inner_tun_ctx *tun_ctx) {
struct nft_inner_tun_ctx ctx = {};
u32 off = pkt->inneroff;
if (priv->flags & NFT_INNER_HDRSIZE &&
nft_inner_parse_tunhdr(priv, pkt, ... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_inner.c |
static int nft_inner_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_inner *priv = nft_expr_priv(expr);
if (nla_put_be32(skb, NFTA_INNER_NUM, htonl(0)) ||
nla_put_be32(skb, NFTA_INNER_TYPE, htonl(priv->type)) ||
nla_put_be32(skb, NFTA_INN... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_last.c |
static int nft_last_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
struct nft_last_priv *priv = nft_expr_priv(expr);
struct nft_last *last = priv->last;
unsigned long last_jiffies = READ_ONCE(last->jiffies);
u32 last_set = READ_ONCE(last->set);
__be64 msecs;
... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static int nft_limit_pkts_init(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nlattr *const tb[]) {
struct nft_limit_priv_pkts *priv = nft_expr_priv(expr);
int err;
err = nft_limit_init(&priv->limit, tb, true);
if (err < 0)
... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static void nft_limit_bytes_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_limit_priv *priv = nft_expr_priv(expr);
u64 cost = div64_u64(priv->nsecs * pkt->skb->len, priv->rate);
if (nft_limit_... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static int nft_limit_bytes_clone(struct nft_expr *dst,
const struct nft_expr *src) {
struct nft_limit_priv *priv_dst = nft_expr_priv(dst);
struct nft_limit_priv *priv_src = nft_expr_priv(src);
return nft_limit_clone(priv_dst, priv_src);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static const struct nft_expr_ops *
nft_limit_select_ops(const struct nft_ctx *ctx,
const struct nlattr *const tb[]) {
if (tb[NFTA_LIMIT_TYPE] == NULL)
return &nft_limit_pkts_ops;
switch (ntohl(nla_get_be32(tb[NFTA_LIMIT_TYPE]))) {
case NFT_LIMIT_PKTS:
return &nft_limit_pkts_ops;
c... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static void nft_limit_obj_pkts_eval(struct nft_object *obj,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_limit_priv_pkts *priv = nft_obj_data(obj);
if (nft_limit_eval(&priv->limit, priv->cost))
regs->verdict.code = N... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static int nft_limit_obj_pkts_dump(struct sk_buff *skb, struct nft_object *obj,
bool reset) {
const struct nft_limit_priv_pkts *priv = nft_obj_data(obj);
return nft_limit_dump(skb, &priv->limit, NFT_LIMIT_PKTS);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static const struct nft_object_ops *
nft_limit_obj_select_ops(const struct nft_ctx *ctx,
const struct nlattr *const tb[]) {
if (!tb[NFTA_LIMIT_TYPE])
return &nft_limit_obj_pkts_ops;
switch (ntohl(nla_get_be32(tb[NFTA_LIMIT_TYPE]))) {
case NFT_LIMIT_PKTS:
return &nft_limit_obj_pk... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_limit.c |
static int __init nft_limit_module_init(void) {
int err;
err = nft_register_obj(&nft_limit_obj_type);
if (err < 0)
return err;
err = nft_register_expr(&nft_limit_type);
if (err < 0)
goto err1;
return 0;
err1:
nft_unregister_obj(&nft_limit_obj_type);
return err;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_log.c |
static int nft_log_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_log *priv = nft_expr_priv(expr);
const struct nf_loginfo *li = &priv->loginfo;
if (priv->prefix != nft_log_null_prefix)
if (nla_put_string(skb, NFTA_LOG_PREFIX, priv->prefix))
... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_lookup.c | bool nft_set_do_lookup(const struct net *net, const struct nft_set *set,
const u32 *key, const struct nft_set_ext **ext) {
if (set->ops == &nft_set_hash_fast_type.ops)
return nft_hash_lookup_fast(net, set, key, ext);
if (set->ops == &nft_set_hash_type.ops)
return nft_hash_lookup(net, ... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_lookup.c |
static int nft_lookup_validate(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nft_data **d) {
const struct nft_lookup *priv = nft_expr_priv(expr);
struct nft_set_iter iter;
if (!(priv->set->flags & NFT_SET_MAP) || priv->set->dty... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_masq.c |
static int nft_masq_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
const struct nlattr *const tb[]) {
u32 plen = sizeof_field(struct nf_nat_range, min_addr.all);
struct nft_masq *priv = nft_expr_priv(expr);
int err;
if (tb[NFTA_MASQ_FLAGS]) {
priv->flags = ntohl(nla_... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_masq.c |
static int nft_masq_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_masq *priv = nft_expr_priv(expr);
if (priv->flags != 0 &&
nla_put_be32(skb, NFTA_MASQ_FLAGS, htonl(priv->flags)))
goto nla_put_failure;
if (priv->sreg_proto_min) {
if... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_masq.c |
static void nft_masq_ipv6_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
nf_ct_netns_put(ctx->net, NFPROTO_IPV6);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_masq.c |
static void nft_masq_module_exit_ipv6(void) {
nft_unregister_expr(&nft_masq_ipv6_type);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_masq.c | static inline int nft_masq_module_init_ipv6(void) { return 0; } | [
0,
0
] |
Linux Kernel | net/netfilter/nft_masq.c | static void nft_masq_inet_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
switch (nft_pf(pkt)) {
case NFPROTO_IPV4:
return nft_masq_ipv4_eval(expr, regs, pkt);
case NFPROTO_IPV6:
return nft_masq_ipv6_ev... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_masq.c |
static void __exit nft_masq_module_exit(void) {
nft_masq_module_exit_ipv6();
nft_masq_module_exit_inet();
nft_unregister_expr(&nft_masq_ipv4_type);
nf_nat_masquerade_inet_unregister_notifiers();
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_meta.c |
static noinline u32 nft_meta_get_eval_sdif(const struct nft_pktinfo *pkt) {
switch (nft_pf(pkt)) {
case NFPROTO_IPV4:
return inet_sdif(pkt->skb);
case NFPROTO_IPV6:
return inet6_sdif(pkt->skb);
}
return 0;
} | [
1,
0
] |
Linux Kernel | net/netfilter/nft_meta.c |
void nft_meta_set_eval(const struct nft_expr *expr, struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
const struct nft_meta *meta = nft_expr_priv(expr);
struct sk_buff *skb = pkt->skb;
u32 *sreg = ®s->data[meta->sreg];
u32 value = *sreg;
u8 value8;
switch (meta->key) {
ca... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_meta.c |
int nft_meta_set_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_meta *priv = nft_expr_priv(expr);
if (nla_put_be32(skb, NFTA_META_KEY, htonl(priv->key)))
goto nla_put_failure;
if (nft_dump_register(skb, NFTA_META_SREG, priv->sreg))
goto nla_pu... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_meta.c |
void nft_meta_set_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
const struct nft_meta *priv = nft_expr_priv(expr);
if (priv->key == NFT_META_NFTRACE)
static_branch_dec(&nft_trace_enabled);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_meta.c |
static int nft_meta_inner_init(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nlattr *const tb[]) {
struct nft_meta *priv = nft_expr_priv(expr);
unsigned int len;
priv->key = ntohl(nla_get_be32(tb[NFTA_META_KEY]));
switch (pri... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_meta.c |
static int nft_secmark_compute_secid(struct nft_secmark *priv) {
u32 tmp_secid = 0;
int err;
err = security_secctx_to_secid(priv->ctx, strlen(priv->ctx), &tmp_secid);
if (err)
return err;
if (!tmp_secid)
return -ENOENT;
err = security_secmark_relabel_packet(tmp_secid);
if (err)
return err;... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_nat.c |
static void nft_nat_setup_proto(struct nf_nat_range2 *range,
const struct nft_regs *regs,
const struct nft_nat *priv) {
range->min_proto.all =
(__force __be16)nft_reg_load16(®s->data[priv->sreg_proto_min]);
range->max_proto.all =
(__for... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_nat.c |
static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_nat *priv = nft_expr_priv(expr);
switch (priv->type) {
case NF_NAT_MANIP_SRC:
if (nla_put_be32(skb, NFTA_NAT_TYPE, htonl(NFT_NAT_SNAT)))
goto nla_put_failure;
break;
c... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_nat.c |
static int nft_nat_inet_module_init(void) {
return nft_register_expr(&nft_inet_nat_type);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_nat.c | static void nft_nat_inet_module_exit(void) {}
#endif | [
0,
0
] |
Linux Kernel | net/netfilter/nft_numgen.c |
static int nft_ng_inc_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_ng_inc *priv = nft_expr_priv(expr);
return nft_ng_dump(skb, priv->dreg, priv->modulus, NFT_NG_INCREMENTAL,
priv->offset);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_numgen.c |
static void nft_ng_random_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_ng_random *priv = nft_expr_priv(expr);
regs->data[priv->dreg] = nft_ng_random_gen(priv);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_numgen.c |
static int nft_ng_random_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_ng_random *priv = nft_expr_priv(expr);
return nft_ng_dump(skb, priv->dreg, priv->modulus, NFT_NG_RANDOM,
priv->offset);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_objref.c |
static int nft_objref_map_init(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nlattr *const tb[]) {
struct nft_objref_map *priv = nft_expr_priv(expr);
u8 genmask = nft_genmask_next(ctx->net);
struct nft_set *set;
int err;
se... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_objref.c |
static const struct nft_expr_ops *
nft_objref_select_ops(const struct nft_ctx *ctx,
const struct nlattr *const tb[]) {
if (tb[NFTA_OBJREF_SET_SREG] &&
(tb[NFTA_OBJREF_SET_NAME] || tb[NFTA_OBJREF_SET_ID]))
return &nft_objref_map_ops;
else if (tb[NFTA_OBJREF_IMM_NAME] && tb[NFTA_OBJRE... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_osf.c |
static void __exit nft_osf_module_exit(void) {
return nft_unregister_expr(&nft_osf_type);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static bool nft_payload_rebuild_vlan_hdr(const struct sk_buff *skb, int mac_off,
struct vlan_ethhdr *veth) {
if (skb_copy_bits(skb, mac_off, veth, ETH_HLEN))
return false;
veth->h_vlan_proto = skb->vlan_proto;
veth->h_vlan_TCI = htons(skb_vlan_tag_get(skb));
veth->... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_payload.c | static bool nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset,
u8 len) {
int mac_off = skb_mac_header(skb) - skb->data;
u8 *vlanh, *dst_u8 = (u8 *)d;
struct vlan_ethhdr veth;
u8 vlan_hlen = 0;
if ((skb->protocol == htons(ETH_P_8021AD) ||
skb->protocol... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static int nft_payload_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_payload *priv = nft_expr_priv(expr);
if (nft_dump_register(skb, NFTA_PAYLOAD_DREG, priv->dreg) ||
nla_put_be32(skb, NFTA_PAYLOAD_BASE, htonl(priv->base)) ||
nla_put_... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static bool nft_payload_offload_mask(struct nft_offload_reg *reg, u32 priv_len,
u32 field_len) {
unsigned int remainder, delta, k;
struct nft_data mask = {};
__be32 remainder_mask;
if (priv_len == field_len) {
memset(®->mask, 0xff, priv_len);
return true;
} el... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static int nft_payload_offload(struct nft_offload_ctx *ctx,
struct nft_flow_rule *flow,
const struct nft_expr *expr) {
const struct nft_payload *priv = nft_expr_priv(expr);
int err;
switch (priv->base) {
case NFT_PAYLOAD_LL_HEADER:
err = nft_pa... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static inline void nft_csum_replace(__sum16 *sum, __wsum fsum, __wsum tsum) {
*sum = csum_fold(csum_add(csum_sub(~csum_unfold(*sum), fsum), tsum));
if (*sum == 0)
*sum = CSUM_MANGLED_0;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static int nft_payload_csum_sctp(struct sk_buff *skb, int offset) {
struct sctphdr *sh;
if (skb_ensure_writable(skb, offset + sizeof(*sh)))
return -1;
sh = (struct sctphdr *)(skb->data + offset);
sh->checksum = sctp_compute_cksum(skb, offset);
skb->ip_summed = CHECKSUM_UNNECESSARY;
return 0;
} | [
1,
0
] |
Linux Kernel | net/netfilter/nft_payload.c | static int nft_payload_l4csum_update(const struct nft_pktinfo *pkt,
struct sk_buff *skb, __wsum fsum,
__wsum tsum) {
int l4csum_offset;
__sum16 sum;
if (nft_payload_l4csum_offset(pkt, skb, &l4csum_offset) < 0)
return 0;
if (skb_copy... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static int nft_payload_csum_inet(struct sk_buff *skb, const u32 *src,
__wsum fsum, __wsum tsum, int csum_offset) {
__sum16 sum;
if (skb_copy_bits(skb, csum_offset, &sum, sizeof(sum)) < 0)
return -1;
nft_csum_replace(&sum, fsum, tsum);
if (skb_ensure_writable(skb, csum_off... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_payload.c |
static const struct nft_expr_ops *
nft_payload_select_ops(const struct nft_ctx *ctx,
const struct nlattr *const tb[]) {
enum nft_payload_bases base;
unsigned int offset, len;
int err;
if (tb[NFTA_PAYLOAD_BASE] == NULL || tb[NFTA_PAYLOAD_OFFSET] == NULL ||
tb[NFTA_PAYLOAD_LEN] == N... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_queue.c | static int nft_queue_validate(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nft_data **data) {
static const unsigned int supported_hooks =
((1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_FORWARD) | (1... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_queue.c |
static int nft_queue_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_queue *priv = nft_expr_priv(expr);
if (nla_put_be16(skb, NFTA_QUEUE_NUM, htons(priv->queuenum)) ||
nla_put_be16(skb, NFTA_QUEUE_TOTAL, htons(priv->queues_total)) ||
nla_... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_queue.c |
static void __exit nft_queue_module_exit(void) {
nft_unregister_expr(&nft_queue_type);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_quota.c | static int nft_quota_do_dump(struct sk_buff *skb, struct nft_quota *priv,
bool reset) {
u64 consumed, consumed_cap, quota;
u32 flags = priv->flags;
consumed = atomic64_read(priv->consumed);
quota = atomic64_read(&priv->quota);
if (consumed >= quota) {
consumed_cap = quota;
... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_quota.c |
static void nft_quota_obj_destroy(const struct nft_ctx *ctx,
struct nft_object *obj) {
struct nft_quota *priv = nft_obj_data(obj);
return nft_quota_do_destroy(ctx, priv);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_quota.c |
static void nft_quota_eval(const struct nft_expr *expr, struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_quota *priv = nft_expr_priv(expr);
nft_quota_do_eval(priv, regs, pkt);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_quota.c |
static int nft_quota_clone(struct nft_expr *dst, const struct nft_expr *src) {
struct nft_quota *priv_dst = nft_expr_priv(dst);
priv_dst->consumed = kmalloc(sizeof(*priv_dst->consumed), GFP_ATOMIC);
if (!priv_dst->consumed)
return -ENOMEM;
atomic64_set(priv_dst->consumed, 0);
return 0;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_range.c |
void nft_range_eval(const struct nft_expr *expr, struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
const struct nft_range_expr *priv = nft_expr_priv(expr);
int d1, d2;
d1 = memcmp(®s->data[priv->sreg], &priv->data_from, priv->len);
d2 = memcmp(®s->data[priv->sreg], &priv->data_... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_range.c |
static int nft_range_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_range_expr *priv = nft_expr_priv(expr);
if (nft_dump_register(skb, NFTA_RANGE_SREG, priv->sreg))
goto nla_put_failure;
if (nla_put_be32(skb, NFTA_RANGE_OP, htonl(priv->op)))
... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_redir.c |
static int nft_redir_validate(const struct nft_ctx *ctx,
const struct nft_expr *expr,
const struct nft_data **data) {
int err;
err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT);
if (err < 0)
return err;
return nft_chain_validate_h... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_redir.c |
static int nft_redir_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_redir *priv = nft_expr_priv(expr);
if (priv->sreg_proto_min) {
if (nft_dump_register(skb, NFTA_REDIR_REG_PROTO_MIN, priv->sreg_proto_min))
goto nla_put_failure;
if (nf... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_redir.c | static void nft_redir_ipv6_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_redir *priv = nft_expr_priv(expr);
struct nf_nat_range2 range;
memset(&range, 0, sizeof(range));
if (priv->sreg_proto_m... | [
1,
0
] |
Linux Kernel | net/netfilter/nft_redir.c |
static void nft_redir_inet_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr) {
nf_ct_netns_put(ctx->net, NFPROTO_INET);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nft_reject.c |
int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr,
bool reset) {
const struct nft_reject *priv = nft_expr_priv(expr);
if (nla_put_be32(skb, NFTA_REJECT_TYPE, htonl(priv->type)))
goto nla_put_failure;
switch (priv->type) {
case NFT_REJECT_ICMP_UNREACH:
case NFT_REJ... | [
0,
0
] |
Linux Kernel | net/netfilter/nft_reject_inet.c |
static void nft_reject_inet_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt) {
struct nft_reject *priv = nft_expr_priv(expr);
switch (nft_pf(pkt)) {
case NFPROTO_IPV4:
switch (priv->type) {
case NFT_... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.