Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
net/netfilter/nf_tables_trace.c
static int nf_trace_fill_dev_info(struct sk_buff *nlskb, const struct net_device *indev, const struct net_device *outdev) { if (indev) { if (nla_put_be32(nlskb, NFTA_TRACE_IIF, htonl(indev->ifindex))) return -1; if (nla_put_be16(nlskb...
[ 0, 0 ]
Linux Kernel
net/netfilter/nf_tables_trace.c
void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *pkt, const struct nft_verdict *verdict, const struct nft_chain *chain) { static siphash_key_t trace_key __read_mostly; struct sk_buff *skb = pkt->skb; info->basechain = nft_base_chain(chain); info...
[ 1, 0 ]
Linux Kernel
net/netfilter/utils.c
__sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, u8 protocol) { const struct iphdr *iph = ip_hdr(skb); __sum16 csum = 0; switch (skb->ip_summed) { case CHECKSUM_COMPLETE: if (hook != NF_INET_PRE_ROUTING && hook != NF_INET_LOCAL_IN) break; ...
[ 1, 0 ]
Linux Kernel
net/netfilter/utils.c
__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, u8 protocol) { const struct ipv6hdr *ip6h = ipv6_hdr(skb); __sum16 csum = 0; switch (skb->ip_summed) { case CHECKSUM_COMPLETE: if (hook != NF_INET_PRE_ROUTING && hook != NF_INET_LOCAL_IN) br...
[ 1, 0 ]
Linux Kernel
net/netfilter/utils.c
__sum16 nf_checksum_partial(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, unsigned int len, u8 protocol, unsigned short family) { __sum16 csum = 0; switch (family) { case AF_INET: csum = nf_ip_checksum_partial(skb, hook, dataoff, len, p...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_addrtype.c
static bool addrtype_mt6(struct net *net, const struct net_device *dev, const struct sk_buff *skb, const struct xt_addrtype_info_v1 *info) { const struct ipv6hdr *iph = ipv6_hdr(skb); bool ret = true; if (info->source) ret &= match_type6(net, dev, &iph->sadd...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_addrtype.c
static inline bool match_type(struct net *net, const struct net_device *dev, __be32 addr, u_int16_t mask) { return !!(mask & (1 << inet_dev_addr_type(net, dev, addr))); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_addrtype.c
static bool addrtype_mt_v0(const struct sk_buff *skb, struct xt_action_param *par) { struct net *net = xt_net(par); const struct xt_addrtype_info *info = par->matchinfo; const struct iphdr *iph = ip_hdr(skb); bool ret = true; if (info->source) ret &= match_type(net, NU...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_AUDIT.c
static bool audit_ip4(struct audit_buffer *ab, struct sk_buff *skb) { struct iphdr _iph; const struct iphdr *ih; ih = skb_header_pointer(skb, skb_network_offset(skb), sizeof(_iph), &_iph); if (!ih) return false; audit_log_format(ab, " saddr=%pI4 daddr=%pI4 proto=%hhu", &ih->saddr, &i...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_AUDIT.c
static bool audit_ip6(struct audit_buffer *ab, struct sk_buff *skb) { struct ipv6hdr _ip6h; const struct ipv6hdr *ih; u8 nexthdr; __be16 frag_off; ih = skb_header_pointer(skb, skb_network_offset(skb), sizeof(_ip6h), &_ip6h); if (!ih) return false; nexthdr = ih->nexthdr; ipv6_skip_exthdr(skb, skb_...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_AUDIT.c
static unsigned int audit_tg(struct sk_buff *skb, const struct xt_action_param *par) { struct audit_buffer *ab; int fam = -1; if (audit_enabled == AUDIT_OFF) goto errout; ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_NETFILTER_PKT); if (ab == NULL) goto errout; audit_l...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_AUDIT.c
static unsigned int audit_tg_ebt(struct sk_buff *skb, const struct xt_action_param *par) { audit_tg(skb, par); return EBT_CONTINUE; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_AUDIT.c
static int __init audit_tg_init(void) { return xt_register_targets(audit_tg_reg, ARRAY_SIZE(audit_tg_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_bpf.c
static int __bpf_mt_check_fd(int fd, struct bpf_prog **ret) { struct bpf_prog *prog; prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER); if (IS_ERR(prog)) return PTR_ERR(prog); *ret = prog; return 0; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_bpf.c
static int __bpf_mt_check_path(const char *path, struct bpf_prog **ret) { if (strnlen(path, XT_BPF_PATH_MAX) == XT_BPF_PATH_MAX) return -EINVAL; *ret = bpf_prog_get_type_path(path, BPF_PROG_TYPE_SOCKET_FILTER); return PTR_ERR_OR_ZERO(*ret); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_bpf.c
static void __exit bpf_mt_exit(void) { xt_unregister_matches(bpf_mt_reg, ARRAY_SIZE(bpf_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_cgroup.c
static int cgroup_mt_check_v1(const struct xt_mtchk_param *par) { struct xt_cgroup_info_v1 *info = par->matchinfo; struct cgroup *cgrp; if ((info->invert_path & ~1) || (info->invert_classid & ~1)) return -EINVAL; if (!info->has_path && !info->has_classid) { pr_info("xt_cgroup: no path or classid spec...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_cgroup.c
static int cgroup_mt_check_v2(const struct xt_mtchk_param *par) { struct xt_cgroup_info_v2 *info = par->matchinfo; struct cgroup *cgrp; if ((info->invert_path & ~1) || (info->invert_classid & ~1)) return -EINVAL; if (!info->has_path && !info->has_classid) { pr_info("xt_cgroup: no path or classid spec...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_cgroup.c
static bool cgroup_mt_v0(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_cgroup_info_v0 *info = par->matchinfo; struct sock *sk = skb->sk; if (!sk || !sk_fullsock(sk) || !net_eq(xt_net(par), sock_net(sk))) return false; return (info->id == sock_cgroup_cl...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_cgroup.c
static bool cgroup_mt_v1(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_cgroup_info_v1 *info = par->matchinfo; struct sock_cgroup_data *skcd = &skb->sk->sk_cgrp_data; struct cgroup *ancestor = info->priv; struct sock *sk = skb->sk; if (!sk || !sk_fullsock(...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_cgroup.c
static int __init cgroup_mt_init(void) { return xt_register_matches(cgroup_mt_reg, ARRAY_SIZE(cgroup_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_CHECKSUM.c
static int checksum_tg_check(const struct xt_tgchk_param *par) { const struct xt_CHECKSUM_info *einfo = par->targinfo; const struct ip6t_ip6 *i6 = par->entryinfo; const struct ipt_ip *i4 = par->entryinfo; if (einfo->operation & ~XT_CHECKSUM_OP_FILL) { pr_info_ratelimited("unsupported CHECKSUM operation %x...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_cluster.c
static inline u_int32_t xt_cluster_hash(const struct nf_conn *ct, const struct xt_cluster_match_info *info) { u_int32_t hash = 0; switch (nf_ct_l3num(ct)) { case AF_INET: hash = xt_cluster_hash_ipv4(nf_ct_orig_ipv4_src(ct), info); break; case AF_INET6: hash = xt_cluster_hash_ipv6(n...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_cluster.c
static bool xt_cluster_mt(const struct sk_buff *skb, struct xt_action_param *par) { struct sk_buff *pskb = (struct sk_buff *)skb; const struct xt_cluster_match_info *info = par->matchinfo; const struct nf_conn *ct; enum ip_conntrack_info ctinfo; unsigned long hash; if (!xt_cluster...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_cluster.c
static void __exit xt_cluster_mt_fini(void) { xt_unregister_match(&xt_cluster_match); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_connlabel.c
static int connlabel_mt_check(const struct xt_mtchk_param *par) { const int options = XT_CONNLABEL_OP_INVERT | XT_CONNLABEL_OP_SET; struct xt_connlabel_mtinfo *info = par->matchinfo; int ret; if (info->options & ~options) { pr_info_ratelimited("Unknown options in mask %x\n", info->options); return -EI...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_connlimit.c
static int connlimit_mt_check(const struct xt_mtchk_param *par) { struct xt_connlimit_info *info = par->matchinfo; unsigned int keylen; keylen = sizeof(u32); if (par->family == NFPROTO_IPV6) keylen += sizeof(struct in6_addr); else keylen += sizeof(struct in_addr); info->data = nf_conncount_init(pa...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_connmark.c
static int connmark_tg_check(const struct xt_tgchk_param *par) { int ret; ret = nf_ct_netns_get(par->net, par->family); if (ret < 0) pr_info_ratelimited("cannot load conntrack support for proto=%u\n", par->family); return ret; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_connmark.c
static bool connmark_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_connmark_mtinfo1 *info = par->matchinfo; enum ip_conntrack_info ctinfo; const struct nf_conn *ct; ct = nf_ct_get(skb, &ctinfo); if (ct == NULL) return false; return ((READ_ONCE(ct...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_connmark.c
static void connmark_mt_destroy(const struct xt_mtdtor_param *par) { nf_ct_netns_put(par->net, par->family); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_CONNSECMARK.c
static int connsecmark_tg_check(const struct xt_tgchk_param *par) { const struct xt_connsecmark_target_info *info = par->targinfo; int ret; if (strcmp(par->table, "mangle") != 0 && strcmp(par->table, "security") != 0) { pr_info_ratelimited( "only valid in \'mangle\' or \'security\' table, not ...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_CONNSECMARK.c
static int __init connsecmark_tg_init(void) { return xt_register_target(&connsecmark_tg_reg); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_conntrack.c
static inline bool conntrack_mt_origsrc(const struct nf_conn *ct, const struct xt_conntrack_mtinfo2 *info, u_int8_t family) { return conntrack_addrcmp(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3, &info->ori...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_conntrack.c
static inline bool conntrack_mt_origdst(const struct nf_conn *ct, const struct xt_conntrack_mtinfo2 *info, u_int8_t family) { return conntrack_addrcmp(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3, &info->ori...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_conntrack.c
static inline bool conntrack_mt_replsrc(const struct nf_conn *ct, const struct xt_conntrack_mtinfo2 *info, u_int8_t family) { return conntrack_addrcmp(&ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3, &info->replsr...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_conntrack.c
static inline bool ct_proto_port_check_v3(const struct xt_conntrack_mtinfo3 *info, const struct nf_conn *ct) { const struct nf_conntrack_tuple *tuple; tuple = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple; if ((info->match_flags & XT_CONNTRACK_PROTO) && (nf_ct_protonum(ct) == info->l4prot...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_conntrack.c
static int __init conntrack_mt_init(void) { return xt_register_matches(conntrack_mt_reg, ARRAY_SIZE(conntrack_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_cpu.c
static void __exit cpu_mt_exit(void) { xt_unregister_match(&cpu_mt_reg); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_CT.c
static int xt_ct_set_helper(struct nf_conn *ct, const char *helper_name, const struct xt_tgchk_param *par) { struct nf_conntrack_helper *helper; struct nf_conn_help *help; u8 proto; proto = xt_ct_find_proto(par); if (!proto) { pr_info_ratelimited( "You must specify a ...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_CT.c
static void xt_ct_put_helper(struct nf_conn_help *help) { struct nf_conntrack_helper *helper; if (!help) return; helper = rcu_dereference_raw(help->helper); if (helper) nf_conntrack_helper_put(helper); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_CT.c
static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par) { struct xt_ct_target_info *info = par->targinfo; struct xt_ct_target_info_v1 info_v1 = { .flags = info->flags, .zone = info->zone, .ct_events = info->ct_events, .exp_events = info->exp_events, }; int ret; if (info->flags...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_CT.c
static unsigned int notrack_tg(struct sk_buff *skb, const struct xt_action_param *par) { if (skb->_nfct != 0) return XT_CONTINUE; nf_ct_set(skb, NULL, IP_CT_UNTRACKED); return XT_CONTINUE; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_dccp.c
static inline bool dccp_find_option(u_int8_t option, const struct sk_buff *skb, unsigned int protoff, const struct dccp_hdr *dh, bool *hotdrop) { const unsigned char *op; unsigned int optoff = __dccp_hdr_len(dh); unsigned int optlen = dh->dc...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_devgroup.c
static int __init devgroup_mt_init(void) { return xt_register_match(&devgroup_mt_reg); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_devgroup.c
static void __exit devgroup_mt_exit(void) { xt_unregister_match(&devgroup_mt_reg); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_dscp.c
static bool dscp_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_dscp_info *info = par->matchinfo; u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT; return (dscp == info->dscp) ^ !!info->invert; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_dscp.c
static bool dscp_mt6(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_dscp_info *info = par->matchinfo; u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT; return (dscp == info->dscp) ^ !!info->invert; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_dscp.c
static bool tos_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_tos_match_info *info = par->matchinfo; if (xt_family(par) == NFPROTO_IPV4) return ((ip_hdr(skb)->tos & info->tos_mask) == info->tos_value) ^ !!info->invert; else return ((ipv6_get_dsfield(ipv6_hdr(skb...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_ecn.c
static bool match_tcp(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_ecn_info *einfo = par->matchinfo; struct tcphdr _tcph; const struct tcphdr *th; th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph); if (th == NULL) return false; if (einfo->operation & XT_ECN_O...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_ecn.c
static int ecn_mt_check4(const struct xt_mtchk_param *par) { const struct xt_ecn_info *info = par->matchinfo; const struct ipt_ip *ip = par->entryinfo; if (info->operation & XT_ECN_OP_MATCH_MASK) return -EINVAL; if (info->invert & XT_ECN_OP_MATCH_MASK) return -EINVAL; if (info->operation & (XT_ECN...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_ecn.c
static int __init ecn_mt_init(void) { return xt_register_matches(ecn_mt_reg, ARRAY_SIZE(ecn_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_esp.c
static inline bool spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) { bool r; pr_debug("spi_match:%c 0x%x <= 0x%x <= 0x%x\n", invert ? '!' : ' ', min, spi, max); r = (spi >= min && spi <= max) ^ invert; pr_debug(" result %s\n", r ? "PASS" : "FAILED"); ...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_esp.c
static bool esp_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct ip_esp_hdr *eh; struct ip_esp_hdr _esp; const struct xt_esp *espinfo = par->matchinfo; if (par->fragoff != 0) return false; eh = skb_header_pointer(skb, par->thoff, sizeof(_esp), &_esp); if (eh == NULL) { /* ...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static inline struct hashlimit_net *hashlimit_pernet(struct net *net) { return net_generic(net, hashlimit_net_id); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static struct dsthash_ent *dsthash_alloc_init(struct xt_hashlimit_htable *ht, const struct dsthash_dst *dst, bool *race) { struct dsthash_ent *ent; spin_lock(&ht->lock); ent = dsthash_find(ht, dst); if (ent != NULL) { ...
[ 1, 1 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static struct xt_hashlimit_htable * htable_find_get(struct net *net, const char *name, u_int8_t family) { struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); struct xt_hashlimit_htable *hinfo; hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) { if (!strcmp(name, hinfo->name) && hinfo->fami...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static u64 user2rate(u64 user) { if (user != 0) { return div64_u64(XT_HASHLIMIT_SCALE_v2, user); } else { pr_info_ratelimited("invalid rate from userspace: %llu\n", user); return 0; } }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static u64 user2rate_bytes(u32 user) { u64 r; r = user ? U32_MAX / user : U32_MAX; return (r - 1) << XT_HASHLIMIT_BYTE_SHIFT; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static void rateinfo_init(struct dsthash_ent *dh, struct xt_hashlimit_htable *hinfo, int revision) { dh->rateinfo.prev = jiffies; if (revision >= 3 && hinfo->cfg.mode & XT_HASHLIMIT_RATE_MATCH) { dh->rateinfo.prev_window = 0; dh->rateinfo.current_rate = 0; if (hinfo->cfg.mode ...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static void hashlimit_ipv6_mask(__be32 *i, unsigned int p) { switch (p) { case 0 ... 31: i[0] = maskl(i[0], p); i[1] = i[2] = i[3] = 0; break; case 32 ... 63: i[1] = maskl(i[1], p - 32); i[2] = i[3] = 0; break; case 64 ... 95: i[2] = maskl(i[2], p - 64); i[3] = 0; break; ca...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static u32 hashlimit_byte_cost(unsigned int len, struct dsthash_ent *dh) { u64 tmp = xt_hashlimit_len_to_chunks(len); tmp = tmp * dh->rateinfo.cost; if (unlikely(tmp > CREDITS_PER_JIFFY_BYTES * HZ)) tmp = CREDITS_PER_JIFFY_BYTES * HZ; if (dh->rateinfo.credit < tmp && dh->rateinfo.credit_cap) { dh->ra...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static bool hashlimit_mt_v1(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_hashlimit_mtinfo1 *info = par->matchinfo; struct xt_hashlimit_htable *hinfo = info->hinfo; struct hashlimit_cfg3 cfg = {}; int ret; ret = cfg_copy(&cfg, (void *)&info->cfg, 1); ...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static bool hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_hashlimit_mtinfo3 *info = par->matchinfo; struct xt_hashlimit_htable *hinfo = info->hinfo; return hashlimit_mt_common(skb, par, hinfo, &info->cfg, 3); } #define HASHLIMIT_MAX_SIZE 1048576
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static int hashlimit_mt_check_v2(const struct xt_mtchk_param *par) { struct xt_hashlimit_mtinfo2 *info = par->matchinfo; struct hashlimit_cfg3 cfg = {}; int ret; ret = xt_check_proc_name(info->name, sizeof(info->name)); if (ret) return ret; ret = cfg_copy(&cfg, (void *)&info->cfg, 2); if (ret) ...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static void *dl_seq_start(struct seq_file *s, loff_t *pos) __acquires(htable->lock) { struct xt_hashlimit_htable *htable = pde_data(file_inode(s->file)); unsigned int *bucket; spin_lock_bh(&htable->lock); if (*pos >= htable->cfg.size) return NULL; bucket = kmalloc(sizeof(unsigned int), GFP_ATOMIC); ...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static void dl_seq_stop(struct seq_file *s, void *v) __releases(htable->lock) { struct xt_hashlimit_htable *htable = pde_data(file_inode(s->file)); unsigned int *bucket = v; if (!IS_ERR(bucket)) kfree(bucket); spin_unlock_bh(&htable->lock); }
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static void dl_seq_print(struct dsthash_ent *ent, u_int8_t family, struct seq_file *s) { switch (family) { case NFPROTO_IPV4: seq_printf(s, "%ld %pI4:%u->%pI4:%u %llu %llu %llu\n", (long)(ent->expires - jiffies) / HZ, &ent->dst.ip.src, ntohs(ent->dst.src_p...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family, struct seq_file *s) { struct xt_hashlimit_htable *ht = pde_data(file_inode(s->file)); spin_lock(&ent->lock); rateinfo_recalc(ent, jiffies, ht->cfg.mode, 2); dl_seq_print(ent, family, s); spin_unlock(&en...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hashlimit.c
static int __net_init hashlimit_proc_net_init(struct net *net) { struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); hashlimit_net->ipt_hashlimit = proc_mkdir("ipt_hashlimit", net->proc_net); if (!hashlimit_net->ipt_hashlimit) return -ENOMEM; #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) hashlimit_net->...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_helper.c
static int __init helper_mt_init(void) { return xt_register_match(&helper_mt_reg); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_hl.c
static bool ttl_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct ipt_ttl_info *info = par->matchinfo; const u8 ttl = ip_hdr(skb)->ttl; switch (info->mode) { case IPT_TTL_EQ: return ttl == info->ttl; case IPT_TTL_NE: return ttl != info->ttl; case IPT_TTL_LT: return ttl ...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hl.c
static bool hl_mt6(const struct sk_buff *skb, struct xt_action_param *par) { const struct ip6t_hl_info *info = par->matchinfo; const struct ipv6hdr *ip6h = ipv6_hdr(skb); switch (info->mode) { case IP6T_HL_EQ: return ip6h->hop_limit == info->hop_limit; case IP6T_HL_NE: return ip6h->hop_limit != info...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_hl.c
static int __init hl_mt_init(void) { return xt_register_matches(hl_mt_reg, ARRAY_SIZE(hl_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_HMARK.c
static inline __be32 hmark_addr6_mask(const __be32 *addr32, const __be32 *mask) { return (addr32[0] & mask[0]) ^ (addr32[1] & mask[1]) ^ (addr32[2] & mask[2]) ^ (addr32[3] & mask[3]); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_HMARK.c
static inline __be32 hmark_addr_mask(int l3num, const __be32 *addr32, const __be32 *mask) { switch (l3num) { case AF_INET: return *addr32 & *mask; case AF_INET6: return hmark_addr6_mask(addr32, mask); } return 0; }
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_HMARK.c
static int hmark_pkt_set_htuple_ipv4(const struct sk_buff *skb, struct hmark_tuple *t, const struct xt_hmark_info *info) { struct iphdr *ip, _ip; int nhoff = skb_network_offset(skb); ip = (struct iphdr *)(skb->data + nhoff); if (ip->prot...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_HMARK.c
static int hmark_tg_check(const struct xt_tgchk_param *par) { const struct xt_hmark_info *info = par->targinfo; const char *errmsg = "proto mask must be zero with L3 mode"; if (!info->hmodulus) return -EINVAL; if (info->proto_mask && (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3))) goto err; if ...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_IDLETIMER.c
static void idletimer_tg_expired(struct timer_list *t) { struct idletimer_tg *timer = from_timer(timer, t, timer); pr_debug("timer %s expired\n", timer->attr.attr.name); schedule_work(&timer->work); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_IDLETIMER.c
static int idletimer_check_sysfs_name(const char *name, unsigned int size) { int ret; ret = xt_check_proc_name(name, size); if (ret < 0) return ret; if (!strcmp(name, "power") || !strcmp(name, "subsystem") || !strcmp(name, "uevent")) return -EINVAL; return 0; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_IDLETIMER.c
static unsigned int idletimer_tg_target(struct sk_buff *skb, const struct xt_action_param *par) { const struct idletimer_tg_info *info = par->targinfo; pr_debug("resetting timer %s, timeout period %u\n", info->label, info->timeout); mod_timer(&info->timer->time...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_IDLETIMER.c
static int idletimer_tg_checkentry_v1(const struct xt_tgchk_param *par) { struct idletimer_tg_info_v1 *info = par->targinfo; int ret; pr_debug("checkentry targinfo%s\n", info->label); if (info->send_nl_msg) return -EOPNOTSUPP; ret = idletimer_tg_helper((struct idletimer_tg_info *)info); if (ret < 0) ...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_IDLETIMER.c
static void idletimer_tg_destroy_v1(const struct xt_tgdtor_param *par) { const struct idletimer_tg_info_v1 *info = par->targinfo; pr_debug("destroy targinfo %s\n", info->label); mutex_lock(&list_mutex); if (--info->timer->refcnt == 0) { pr_debug("deleting timer %s\n", info->label); list_del(&info->...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_ipcomp.c
static bool comp_mt(const struct sk_buff *skb, struct xt_action_param *par) { struct ip_comp_hdr _comphdr; const struct ip_comp_hdr *chdr; const struct xt_ipcomp *compinfo = par->matchinfo; if (par->fragoff != 0) return false; chdr = skb_header_pointer(skb, par->thoff, sizeof(_comphdr), &_comphdr); if...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_iprange.c
static inline int iprange_ipv6_lt(const struct in6_addr *a, const struct in6_addr *b) { unsigned int i; for (i = 0; i < 4; ++i) { if (a->s6_addr32[i] != b->s6_addr32[i]) return ntohl(a->s6_addr32[i]) < ntohl(b->s6_addr32[i]); } return 0; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_iprange.c
static bool iprange_mt6(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_iprange_mtinfo *info = par->matchinfo; const struct ipv6hdr *iph = ipv6_hdr(skb); bool m; if (info->flags & IPRANGE_SRC) { m = iprange_ipv6_lt(&iph->saddr, &info->src_min.in6); m |...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_iprange.c
static void __exit iprange_mt_exit(void) { xt_unregister_matches(iprange_mt_reg, ARRAY_SIZE(iprange_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_l2tp.c
static bool l2tp_match(const struct xt_l2tp_info *info, struct l2tp_data *data) { if ((info->flags & XT_L2TP_TYPE) && (info->type != data->type)) return false; if ((info->flags & XT_L2TP_VERSION) && (info->version != data->version)) return false; if ((info->flags & XT_L2TP_TID) &&...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_l2tp.c
static bool l2tp_mt4(const struct sk_buff *skb, struct xt_action_param *par) { struct iphdr *iph = ip_hdr(skb); u8 ipproto = iph->protocol; switch (ipproto) { case IPPROTO_UDP: return l2tp_udp_mt(skb, par, par->thoff); case IPPROTO_L2TP: return l2tp_ip_mt(skb, par, par->thoff); } return false; }
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_l2tp.c
static int l2tp_mt_check6(const struct xt_mtchk_param *par) { const struct xt_l2tp_info *info = par->matchinfo; const struct ip6t_entry *e = par->entryinfo; const struct ip6t_ip6 *ip = &e->ipv6; int ret; ret = l2tp_mt_check(par); if (ret != 0) return ret; if ((ip->proto != IPPROTO_UDP) && (ip->proto...
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_l2tp.c
static int __init l2tp_mt_init(void) { return xt_register_matches(&l2tp_mt_reg[0], ARRAY_SIZE(l2tp_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_LED.c
static unsigned int led_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct xt_led_info *ledinfo = par->targinfo; struct xt_led_info_internal *ledinternal = ledinfo->internal_data; unsigned long led_delay = XT_LED_BLINK_DELAY; if ((ledinfo->delay > 0) && ledinfo...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_LED.c
static void __exit led_tg_exit(void) { xt_unregister_target(&led_tg_reg); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_length.c
static bool length_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_length_info *info = par->matchinfo; u_int16_t pktlen = ntohs(ip_hdr(skb)->tot_len); return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; }
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_length.c
static void __exit length_mt_exit(void) { xt_unregister_matches(length_mt_reg, ARRAY_SIZE(length_mt_reg)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_LOG.c
static int log_tg_check(const struct xt_tgchk_param *par) { const struct xt_log_info *loginfo = par->targinfo; int ret; if (par->family != NFPROTO_IPV4 && par->family != NFPROTO_IPV6) return -EINVAL; if (loginfo->level >= 8) { pr_debug("level %u >= 8\n", loginfo->level); return -EINVAL; } if...
[ 1, 0 ]
Linux Kernel
net/netfilter/xt_LOG.c
static int __init log_tg_init(void) { return xt_register_targets(log_tg_regs, ARRAY_SIZE(log_tg_regs)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_LOG.c
static void __exit log_tg_exit(void) { xt_unregister_targets(log_tg_regs, ARRAY_SIZE(log_tg_regs)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_mac.c
static int __init mac_mt_init(void) { return xt_register_match(&mac_mt_reg); }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_mark.c
static bool mark_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_mark_mtinfo1 *info = par->matchinfo; return ((skb->mark & info->mask) == info->mark) ^ info->invert; }
[ 0, 0 ]
Linux Kernel
net/netfilter/xt_MASQUERADE.c
static int masquerade_tg_check(const struct xt_tgchk_param *par) { const struct nf_nat_ipv4_multi_range_compat *mr = par->targinfo; if (mr->range[0].flags & NF_NAT_RANGE_MAP_IPS) { pr_debug("bad MAP_IPS.\n"); return -EINVAL; } if (mr->rangesize != 1) { pr_debug("bad rangesize %u\n", mr->rangesize);...
[ 0, 1 ]