Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | net/netfilter/nf_conntrack_sip.c |
static int process_bye_request(struct sk_buff *skb, unsigned int protoff,
unsigned int dataoff, const char **dptr,
unsigned int *datalen, unsigned int cseq) {
enum ip_conntrack_info ctinfo;
struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
flush_expectat... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_conntrack_standalone.c | static void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) {
int ret;
u32 len;
char *secctx;
ret = security_secid_to_secctx(ct->secmark, &secctx, &len);
if (ret)
return;
seq_printf(s, "secctx=%s ", secctx);
security_release_secctx(secctx, len);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_conntrack_standalone.c |
static void nf_conntrack_fini_net(struct net *net) {
if (enable_hooks)
nf_ct_netns_put(net, NFPROTO_INET);
nf_conntrack_standalone_fini_proc(net);
nf_conntrack_standalone_fini_sysctl(net);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_conntrack_standalone.c |
static void nf_conntrack_pernet_exit(struct list_head *net_exit_list) {
struct net *net;
list_for_each_entry(net, net_exit_list, exit_list) nf_conntrack_fini_net(net);
nf_conntrack_cleanup_net_list(net_exit_list);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_conntrack_tftp.c | static int tftp_help(struct sk_buff *skb, unsigned int protoff,
struct nf_conn *ct, enum ip_conntrack_info ctinfo) {
const struct tftphdr *tfh;
struct tftphdr _tftph;
struct nf_conntrack_expect *exp;
struct nf_conntrack_tuple *tuple;
unsigned int ret = NF_ACCEPT;
typeof(nf_nat_tftp_hook... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_conntrack_tftp.c |
static void __exit nf_conntrack_tftp_fini(void) {
nf_conntrack_helpers_unregister(tftp, ports_c * 2);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_dup_netdev.c |
static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,
enum nf_dev_hooks hook) {
if (__this_cpu_read(nf_dup_skb_recursion) > NF_RECURSION_LIMIT)
goto err;
if (hook == NF_NETDEV_INGRESS && skb_mac_header_was_set(skb)) {
if (skb_cow_head(skb, skb->mac_le... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void flow_offload_fill_dir(struct flow_offload *flow,
enum flow_offload_tuple_dir dir) {
struct flow_offload_tuple *ft = &flow->tuplehash[dir].tuple;
struct nf_conntrack_tuple *ctt = &flow->ct->tuplehash[dir].tuple;
ft->dir = dir;
switch (ctt->src.l3num) {
case NFPR... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
struct flow_offload *flow_offload_alloc(struct nf_conn *ct) {
struct flow_offload *flow;
if (unlikely(nf_ct_is_dying(ct)))
return NULL;
flow = kzalloc(sizeof(*flow), GFP_ATOMIC);
if (!flow)
return NULL;
refcount_inc(&ct->ct_general.use);
flow->ct = ct;
flow_offload_fill_dir(flow, FLOW_OFFLOAD... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void nft_flow_dst_release(struct flow_offload *flow,
enum flow_offload_tuple_dir dir) {
if (flow->tuplehash[dir].tuple.xmit_type == FLOW_OFFLOAD_XMIT_NEIGH ||
flow->tuplehash[dir].tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM)
dst_release(flow->tuplehash[dir].tuple.dst_c... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void flow_offload_fixup_tcp(struct ip_ct_tcp *tcp) {
tcp->seen[0].td_maxwin = 0;
tcp->seen[1].td_maxwin = 0;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void flow_offload_fixup_ct(struct nf_conn *ct) {
struct net *net = nf_ct_net(ct);
int l4num = nf_ct_protonum(ct);
s32 timeout;
if (l4num == IPPROTO_TCP) {
struct nf_tcp_net *tn = nf_tcp_pernet(net);
flow_offload_fixup_tcp(&ct->proto.tcp);
timeout = tn->timeouts[ct->proto.tcp.state];
t... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
void flow_offload_free(struct flow_offload *flow) {
switch (flow->type) {
case NF_FLOW_OFFLOAD_ROUTE:
flow_offload_route_release(flow);
break;
default:
break;
}
nf_ct_put(flow->ct);
kfree_rcu(flow, rcu_head);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
unsigned long flow_offload_get_timeout(struct flow_offload *flow) {
unsigned long timeout = NF_FLOW_TIMEOUT;
struct net *net = nf_ct_net(flow->ct);
int l4num = nf_ct_protonum(flow->ct);
if (l4num == IPPROTO_TCP) {
struct nf_tcp_net *tn = nf_tcp_pernet(net);
timeout = tn->offload_timeout;
} else if ... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
int flow_offload_add(struct nf_flowtable *flow_table,
struct flow_offload *flow) {
int err;
flow->timeout = nf_flowtable_time_stamp + flow_offload_get_timeout(flow);
err =
rhashtable_insert_fast(&flow_table->rhashtable, &flow->tuplehash[0].node,
nf_flow_o... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
void flow_offload_teardown(struct flow_offload *flow) {
clear_bit(IPS_OFFLOAD_BIT, &flow->ct->status);
set_bit(NF_FLOW_TEARDOWN, &flow->flags);
flow_offload_fixup_ct(flow->ct);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
struct flow_offload_tuple_rhash *
flow_offload_lookup(struct nf_flowtable *flow_table,
struct flow_offload_tuple *tuple) {
struct flow_offload_tuple_rhash *tuplehash;
struct flow_offload *flow;
int dir;
tuplehash = rhashtable_lookup(&flow_table->rhashtable, tuple,
... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static int nf_flow_table_iterate(struct nf_flowtable *flow_table,
void (*iter)(struct nf_flowtable *flowtable,
struct flow_offload *flow,
void *data),
void *data... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void nf_flow_offload_work_gc(struct work_struct *work) {
struct nf_flowtable *flow_table;
flow_table = container_of(work, struct nf_flowtable, gc_work.work);
nf_flow_table_gc_run(flow_table);
queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void nf_flow_nat_port_tcp(struct sk_buff *skb, unsigned int thoff,
__be16 port, __be16 new_port) {
struct tcphdr *tcph;
tcph = (void *)(skb_network_header(skb) + thoff);
inet_proto_csum_replace2(&tcph->check, skb, port, new_port, false);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void nf_flow_nat_port_udp(struct sk_buff *skb, unsigned int thoff,
__be16 port, __be16 new_port) {
struct udphdr *udph;
udph = (void *)(skb_network_header(skb) + thoff);
if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
inet_proto_csum_replace2(&udph->check, sk... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static void nf_flow_nat_port(struct sk_buff *skb, unsigned int thoff,
u8 protocol, __be16 port, __be16 new_port) {
switch (protocol) {
case IPPROTO_TCP:
nf_flow_nat_port_tcp(skb, thoff, port, new_port);
break;
case IPPROTO_UDP:
nf_flow_nat_port_udp(skb, thoff, port, new_p... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c | void nf_flow_table_free(struct nf_flowtable *flow_table) {
mutex_lock(&flowtable_lock);
list_del(&flow_table->list);
mutex_unlock(&flowtable_lock);
cancel_delayed_work_sync(&flow_table->gc_work);
nf_flow_table_offload_flush(flow_table);
nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL);
... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_core.c |
static int nf_flow_table_pernet_init(struct net *net) {
int ret;
ret = nf_flow_table_init_net(net);
if (ret < 0)
return ret;
ret = nf_flow_table_init_proc(net);
if (ret < 0)
goto out_proc;
return 0;
out_proc:
nf_flow_table_fini_net(net);
return ret;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_inet.c |
static void __exit nf_flow_inet_module_exit(void) {
nft_unregister_flowtable_type(&flowtable_inet);
nft_unregister_flowtable_type(&flowtable_ipv6);
nft_unregister_flowtable_type(&flowtable_ipv4);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_ip.c |
static int nf_flow_state_check(struct flow_offload *flow, int proto,
struct sk_buff *skb, unsigned int thoff) {
struct tcphdr *tcph;
if (proto != IPPROTO_TCP)
return 0;
tcph = (void *)(skb_network_header(skb) + thoff);
if (unlikely(tcph->fin || tcph->rst)) {
flow_offloa... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_ip.c |
static void nf_flow_nat_ip_tcp(struct sk_buff *skb, unsigned int thoff,
__be32 addr, __be32 new_addr) {
struct tcphdr *tcph;
tcph = (void *)(skb_network_header(skb) + thoff);
inet_proto_csum_replace4(&tcph->check, skb, addr, new_addr, true);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_ip.c |
static void nf_flow_nat_ip_udp(struct sk_buff *skb, unsigned int thoff,
__be32 addr, __be32 new_addr) {
struct udphdr *udph;
udph = (void *)(skb_network_header(skb) + thoff);
if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
inet_proto_csum_replace4(&udph->check, skb, a... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_ip.c | static bool nf_flow_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu) {
if (skb->len <= mtu)
return false;
if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
return false;
return true;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_ip.c |
static void nf_flow_nat_ipv6_tcp(struct sk_buff *skb, unsigned int thoff,
struct in6_addr *addr,
struct in6_addr *new_addr,
struct ipv6hdr *ip6h) {
struct tcphdr *tcph;
tcph = (void *)(skb_network_header(skb) + thof... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_ip.c |
static void nf_flow_nat_ipv6_udp(struct sk_buff *skb, unsigned int thoff,
struct in6_addr *addr,
struct in6_addr *new_addr) {
struct udphdr *udph;
udph = (void *)(skb_network_header(skb) + thoff);
if (udph->check || skb->ip_summed == CHECKSUM_PAR... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_ip.c |
static void nf_flow_nat_ipv6_l4proto(struct sk_buff *skb, struct ipv6hdr *ip6h,
unsigned int thoff, struct in6_addr *addr,
struct in6_addr *new_addr) {
switch (ip6h->nexthdr) {
case IPPROTO_TCP:
nf_flow_nat_ipv6_tcp(skb, thoff, addr, new... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void flow_offload_mangle(struct flow_action_entry *entry,
enum flow_action_mangle_base htype, u32 offset,
const __be32 *value, const __be32 *mask) {
entry->id = FLOW_ACTION_MANGLE;
entry->mangle.htype = htype;
entry->mangle.offset = offset;
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void flow_offload_ipv6_snat(struct net *net,
const struct flow_offload *flow,
enum flow_offload_tuple_dir dir,
struct nf_flow_rule *flow_rule) {
u32 mask = ~htonl(0xffffffff);
const __be32 *addr;
u32 o... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static int flow_offload_l4proto(const struct flow_offload *flow) {
u8 protonum = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.l4proto;
u8 type = 0;
switch (protonum) {
case IPPROTO_TCP:
type = FLOW_ACT_MANGLE_HDR_TYPE_TCP;
break;
case IPPROTO_UDP:
type = FLOW_ACT_MANGLE_HDR_TYPE_UDP;
bre... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void flow_offload_decap_tunnel(const struct flow_offload *flow,
enum flow_offload_tuple_dir dir,
struct nf_flow_rule *flow_rule) {
const struct flow_offload_tuple *other_tuple;
struct flow_action_entry *entry;
struct dst_entry *ds... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static int nf_flow_rule_route_common(struct net *net,
const struct flow_offload *flow,
enum flow_offload_tuple_dir dir,
struct nf_flow_rule *flow_rule) {
const struct flow_offload_tuple *other_tuple;
cons... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
int nf_flow_rule_route_ipv6(struct net *net, const struct flow_offload *flow,
enum flow_offload_tuple_dir dir,
struct nf_flow_rule *flow_rule) {
if (nf_flow_rule_route_common(net, flow, dir, flow_rule) < 0)
return -1;
if (test_bit(NF_FLOW_SNAT, &flow->fl... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void nf_flow_offload_destroy(struct nf_flow_rule *flow_rule[]) {
int i;
for (i = 0; i < FLOW_OFFLOAD_DIR_MAX; i++)
__nf_flow_offload_destroy(flow_rule[i]);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void nf_flow_offload_init(struct flow_cls_offload *cls_flow,
__be16 proto, int priority,
enum flow_cls_command cmd,
const struct flow_offload_tuple *tuple,
struct netlink_ext_ack *... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static int flow_offload_tuple_add(struct flow_offload_work *offload,
struct nf_flow_rule *flow_rule,
enum flow_offload_tuple_dir dir) {
return nf_flow_offload_tuple(offload->flowtable, offload->flow, flow_rule,
dir, of... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void flow_offload_tuple_del(struct flow_offload_work *offload,
enum flow_offload_tuple_dir dir) {
nf_flow_offload_tuple(offload->flowtable, offload->flow, NULL, dir,
offload->flowtable->priority, FLOW_CLS_DESTROY, NULL,
&offloa... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void flow_offload_work_add(struct flow_offload_work *offload) {
struct nf_flow_rule *flow_rule[FLOW_OFFLOAD_DIR_MAX];
int err;
err = nf_flow_offload_alloc(offload, flow_rule);
if (err < 0)
return;
err = flow_offload_rule_add(offload, flow_rule);
if (err < 0)
goto out;
set_bit(IPS_HW_OFF... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void flow_offload_tuple_stats(struct flow_offload_work *offload,
enum flow_offload_tuple_dir dir,
struct flow_stats *stats) {
nf_flow_offload_tuple(offload->flowtable, offload->flow, NULL, dir,
offload->flowtable... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static struct flow_offload_work *
nf_flow_offload_work_alloc(struct nf_flowtable *flowtable,
struct flow_offload *flow, unsigned int cmd) {
struct flow_offload_work *offload;
if (test_and_set_bit(NF_FLOW_HW_PENDING, &flow->flags))
return NULL;
offload = kmalloc(sizeof(struct flow... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static int nf_flow_table_block_setup(struct nf_flowtable *flowtable,
struct flow_block_offload *bo,
enum flow_block_command cmd) {
struct flow_block_cb *block_cb, *next;
int err = 0;
down_write(&flowtable->flow_block_lock);
switch (cmd)... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
static void nf_flow_table_block_offload_init(struct flow_block_offload *bo,
struct net *net,
enum flow_block_command cmd,
struct nf_flowtable *flowtable,
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_offload.c |
void nf_flow_table_offload_exit(void) {
destroy_workqueue(nf_flow_offload_add_wq);
destroy_workqueue(nf_flow_offload_del_wq);
destroy_workqueue(nf_flow_offload_stats_wq);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_procfs.c |
static void *nf_flow_table_cpu_seq_start(struct seq_file *seq, loff_t *pos) {
struct net *net = seq_file_net(seq);
int cpu;
if (*pos == 0)
return SEQ_START_TOKEN;
for (cpu = *pos - 1; cpu < nr_cpu_ids; ++cpu) {
if (!cpu_possible(cpu))
continue;
*pos = cpu + 1;
return per_cpu_ptr(net->ft... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_procfs.c |
static void nf_flow_table_cpu_seq_stop(struct seq_file *seq, void *v) {} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_procfs.c |
static int nf_flow_table_cpu_seq_show(struct seq_file *seq, void *v) {
const struct nf_flow_table_stat *st = v;
if (v == SEQ_START_TOKEN) {
seq_puts(seq, "wq_add wq_del wq_stats\n");
return 0;
}
seq_printf(seq, "%8d %8d %8d\n", st->count_wq_add, st->count_wq_del,
st->count_wq_stats);... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_procfs.c |
int nf_flow_table_init_proc(struct net *net) {
struct proc_dir_entry *pde;
pde = proc_create_net("nf_flowtable", 0444, net->proc_net_stat,
&nf_flow_table_cpu_seq_ops,
sizeof(struct seq_net_private));
return pde ? 0 : -ENOMEM;
} | [
1,
0
] |
Linux Kernel | net/netfilter/nf_flow_table_procfs.c |
void nf_flow_table_fini_proc(struct net *net) {
remove_proc_entry("nf_flowtable", net->proc_net_stat);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_log.c |
void nf_log_packet(struct net *net, u_int8_t pf, unsigned int hooknum,
const struct sk_buff *skb, const struct net_device *in,
const struct net_device *out,
const struct nf_loginfo *loginfo, const char *fmt, ...) {
va_list args;
char prefix[NF_LOG_PREFIXLEN]... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_log.c |
struct nf_log_buf *nf_log_buf_open(void) {
struct nf_log_buf *m = kmalloc(sizeof(*m), GFP_ATOMIC);
if (unlikely(!m)) {
local_bh_disable();
do {
m = xchg(&emergency_ptr, NULL);
} while (!m);
}
m->count = 0;
return m;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_log.c |
static int seq_show(struct seq_file *s, void *v) {
loff_t *pos = v;
const struct nf_logger *logger;
int i;
struct net *net = seq_file_net(s);
logger = nft_log_dereference(net->nf.nf_loggers[*pos]);
if (!logger)
seq_printf(s, "%2lld NONE (", *pos);
else
seq_printf(s, "%2lld %s (", *pos, logger->... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_log.c |
static void netfilter_log_sysctl_exit(struct net *net) {} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_log_syslog.c | static bool nf_log_allowed(const struct net *net) {
return net_eq(net, &init_net) || sysctl_nf_log_all_netns;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_log_syslog.c |
static void dump_mac_header(struct nf_log_buf *m, const struct nf_loginfo *info,
const struct sk_buff *skb) {
struct net_device *dev = skb->dev;
unsigned int logflags = 0;
if (info->type == NF_LOG_TYPE_LOG)
logflags = info->u.log.logflags;
if (!(logflags & NF_LOG_MACDECODE))
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_log_syslog.c |
static void __exit nf_log_syslog_exit(void) {
unregister_pernet_subsys(&nf_log_syslog_net_ops);
nf_log_unregister(&nf_ip_logger);
nf_log_unregister(&nf_arp_logger);
nf_log_unregister(&nf_ip6_logger);
nf_log_unregister(&nf_netdev_logger);
nf_log_unregister(&nf_bridge_logger);
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_core.c |
static bool nf_nat_inet_in_range(const struct nf_conntrack_tuple *t,
const struct nf_nat_range2 *range) {
if (t->src.l3num == NFPROTO_IPV4)
return ntohl(t->src.u3.ip) >= ntohl(range->min_addr.ip) &&
ntohl(t->src.u3.ip) <= ntohl(range->max_addr.ip);
return ipv6_addr_... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_core.c | static void get_unique_tuple(struct nf_conntrack_tuple *tuple,
const struct nf_conntrack_tuple *orig_tuple,
const struct nf_nat_range2 *range,
struct nf_conn *ct,
enum nf_nat_manip_type maniptype) {
con... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_core.c | static unsigned int __nf_nat_alloc_null_binding(struct nf_conn *ct,
enum nf_nat_manip_type manip) {
union nf_inet_addr ip =
(manip == NF_NAT_MANIP_SRC ? ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3
: ct->tuplehash[IP_CT_DIR_REPLY].... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_core.c |
static int nfnetlink_parse_nat_proto(struct nlattr *attr,
const struct nf_conn *ct,
struct nf_nat_range2 *range) {
struct nlattr *tb[CTA_PROTONAT_MAX + 1];
int err;
err = nla_parse_nested_deprecated(tb, CTA_PROTONAT_MAX, attr,
... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_core.c |
static int nf_nat_ipv6_nlattr_to_range(struct nlattr *tb[],
struct nf_nat_range2 *range) {
if (tb[CTA_NAT_V6_MINIP]) {
nla_memcpy(&range->min_addr.ip6, tb[CTA_NAT_V6_MINIP],
sizeof(struct in6_addr));
range->flags |= NF_NAT_RANGE_MAP_IPS;
}
if (tb[CTA... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_core.c |
void nf_nat_unregister_fn(struct net *net, u8 pf, const struct nf_hook_ops *ops,
unsigned int ops_count) {
struct nat_net *nat_net = net_generic(net, nat_net_id);
struct nf_nat_hooks_net *nat_proto_net;
struct nf_nat_lookup_hook_priv *priv;
struct nf_hook_ops *nat_ops;
int hooknum =... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_ftp.c |
static void __exit nf_nat_ftp_fini(void) {
nf_nat_helper_unregister(&nat_helper_ftp);
RCU_INIT_POINTER(nf_nat_ftp_hook, NULL);
synchronize_rcu();
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_ftp.c |
static int __init nf_nat_ftp_init(void) {
BUG_ON(nf_nat_ftp_hook != NULL);
nf_nat_helper_register(&nat_helper_ftp);
RCU_INIT_POINTER(nf_nat_ftp_hook, nf_nat_ftp);
return 0;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_helper.c | static bool enlarge_skb(struct sk_buff *skb, unsigned int extra) {
if (skb->len + extra > 65535)
return false;
if (pskb_expand_head(skb, 0, extra - skb_tailroom(skb), GFP_ATOMIC))
return false;
return true;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_helper.c | bool __nf_nat_mangle_tcp_packet(struct sk_buff *skb, struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff, unsigned int match_offset,
unsigned int match_len, const char *rep_buffer,
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_irc.c | static int warn_set(const char *val, const struct kernel_param *kp) {
pr_info("kernel >= 2.6.10 only uses 'ports' for conntrack modules\n");
return 0;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_masquerade.c |
static int device_cmp(struct nf_conn *i, void *arg) {
const struct nf_conn_nat *nat = nfct_nat(i);
const struct masq_dev_work *w = arg;
if (!nat)
return 0;
return nat->masq_index == w->ifindex;
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_masquerade.c | static int masq_inet_event(struct notifier_block *this, unsigned long event,
void *ptr) {
const struct in_ifaddr *ifa = ptr;
const struct in_device *idev;
const struct net_device *dev;
union nf_inet_addr addr;
if (event != NETDEV_DOWN)
return NOTIFY_DONE;
idev = ifa->ifa_dev... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_masquerade.c |
unsigned int nf_nat_masquerade_ipv6(struct sk_buff *skb,
const struct nf_nat_range2 *range,
const struct net_device *out) {
enum ip_conntrack_info ctinfo;
struct nf_conn_nat *nat;
struct in6_addr src;
struct nf_conn *ct;
struct nf_nat_ra... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_ovs.c | int nf_ct_nat(struct sk_buff *skb, struct nf_conn *ct,
enum ip_conntrack_info ctinfo, int *action,
const struct nf_nat_range2 *range, bool commit) {
enum nf_nat_manip_type maniptype;
int err, ct_action = *action;
*action = 0;
if (!nf_ct_is_confirmed(ct) && !nf_ct_nat_ext_add(ct))
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c |
static bool udp_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
unsigned int hdroff,
const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype) {
struct udphdr *hdr;
if (skb_ensure_writable(skb, hdroff + sizeof(*hdr... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c | static bool sctp_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
unsigned int hdroff,
const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype) {
#ifdef CONFIG_NF_CT_PROTO_SCTP
struct sctphdr *hdr;
int hdrsize = 8... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c |
static bool icmp_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
unsigned int hdroff,
const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype) {
struct icmphdr *hdr;
if (skb_ensure_writable(skb, hdroff + sizeof... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c |
static bool icmpv6_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
unsigned int hdroff,
const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype) {
struct icmp6hdr *hdr;
if (skb_ensure_writable(skb, hdroff... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c | static bool gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
unsigned int hdroff,
const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype) {
#if IS_ENABLED(CONFIG_NF_CT_PROTO_GRE)
const struct gre_base_hdr *greh;
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c | static bool l4proto_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
unsigned int hdroff,
const struct nf_conntrack_tuple *tuple,
enum nf_nat_manip_type maniptype) {
switch (tuple->dst.protonum) {
case IPPROTO_TCP:
re... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c |
static void nf_nat_ipv6_csum_update(struct sk_buff *skb, unsigned int iphdroff,
__sum16 *check,
const struct nf_conntrack_tuple *t,
enum nf_nat_manip_type maniptype) {
#if IS_ENABLED(CONFIG_IPV6)
const struct ... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c |
static void nf_csum_update(struct sk_buff *skb, unsigned int iphdroff,
__sum16 *check, const struct nf_conntrack_tuple *t,
enum nf_nat_manip_type maniptype) {
switch (t->src.l3num) {
case NFPROTO_IPV4:
nf_nat_ipv4_csum_update(skb, iphdroff, check, t, manipt... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c | static unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state) {
struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
__be16 frag_off;
int hdrlen;
u8 nexthdr;
ct = nf_ct_get(skb, &ctinfo);
if (!ct)
return NF_ACCEPT;
if (ctin... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c |
static unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state) {
unsigned int ret;
struct in6_addr daddr = ipv6_hdr(skb)->daddr;
ret = nf_nat_ipv6_fn(priv, skb, state);
if (ret != NF_DROP && ret != NF_STOLEN &&
ipv6_addr_cmp(&dad... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_proto.c |
static unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state) {
#ifdef CONFIG_XFRM
const struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
int err;
#endif
unsigned int ret;
ret = nf_nat_ipv6_fn(priv, skb, state);
#ifdef CONFIG_XF... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_redirect.c |
unsigned int nf_nat_redirect_ipv6(struct sk_buff *skb,
const struct nf_nat_range2 *range,
unsigned int hooknum) {
struct nf_nat_range2 newrange;
struct in6_addr newdst;
enum ip_conntrack_info ctinfo;
struct nf_conn *ct;
ct = nf_ct_get(skb, ... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_sip.c | static unsigned int mangle_packet(struct sk_buff *skb, unsigned int protoff,
unsigned int dataoff, const char **dptr,
unsigned int *datalen, unsigned int matchoff,
unsigned int matchlen, const char *buffer,
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_sip.c |
static int map_sip_addr(struct sk_buff *skb, unsigned int protoff,
unsigned int dataoff, const char **dptr,
unsigned int *datalen, enum sip_header_types type) {
enum ip_conntrack_info ctinfo;
struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
unsigned int matchlen, matc... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_nat_sip.c | static int mangle_content_len(struct sk_buff *skb, unsigned int protoff,
unsigned int dataoff, const char **dptr,
unsigned int *datalen) {
enum ip_conntrack_info ctinfo;
struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
unsigned int matchoff, matchlen;
cha... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_nat_tftp.c |
static void __exit nf_nat_tftp_fini(void) {
nf_nat_helper_unregister(&nat_helper_tftp);
RCU_INIT_POINTER(nf_nat_tftp_hook, NULL);
synchronize_rcu();
} | [
0,
0
] |
Linux Kernel | net/netfilter/nf_queue.c | static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state,
unsigned int index, unsigned int queuenum) {
struct nf_queue_entry *entry = NULL;
const struct nf_queue_handler *qh;
unsigned int route_key_size;
int status;
qh = rcu_dereference(nf_queue_handler);
if (!qh)
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_queue.c |
static unsigned int nf_iterate(struct sk_buff *skb, struct nf_hook_state *state,
const struct nf_hook_entries *hooks,
unsigned int *index) {
const struct nf_hook_entry *hook;
unsigned int verdict, i = *index;
while (i < hooks->num_hook_entries) {
... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_synproxy_core.c |
bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
const struct tcphdr *th,
struct synproxy_options *opts) {
int length = (th->doff * 4) - sizeof(*th);
u8 buf[40], *ptr;
if (unlikely(length < 0))
return false;
ptr = skb_header... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_synproxy_core.c |
static int synproxy_cpu_seq_show(struct seq_file *seq, void *v) {
struct synproxy_stats *stats = v;
if (v == SEQ_START_TOKEN) {
seq_puts(seq, "entries\t\tsyn_received\t"
"cookie_invalid\tcookie_valid\t"
"cookie_retrans\tconn_reopened\n");
return 0;
}
seq_printf(seq... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_synproxy_core.c | static int __net_init synproxy_proc_init(struct net *net) { return 0; } | [
0,
0
] |
Linux Kernel | net/netfilter/nf_synproxy_core.c |
static int __net_init synproxy_net_init(struct net *net) {
struct synproxy_net *snet = synproxy_pernet(net);
struct nf_conn *ct;
int err = -ENOMEM;
ct = nf_ct_tmpl_alloc(net, &nf_ct_zone_dflt, GFP_KERNEL);
if (!ct)
goto err1;
if (!nfct_seqadj_ext_add(ct))
goto err2;
if (!nfct_synproxy_ext_add(c... | [
0,
0
] |
Linux Kernel | net/netfilter/nf_synproxy_core.c |
void synproxy_send_client_synack(struct net *net, const struct sk_buff *skb,
const struct tcphdr *th,
const struct synproxy_options *opts) {
struct sk_buff *nskb;
struct iphdr *iph, *niph;
struct tcphdr *nth;
unsigned int tcp_hdr_size;
u16 mss... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_synproxy_core.c |
static void synproxy_send_server_ack(struct net *net,
const struct ip_ct_tcp *state,
const struct sk_buff *skb,
const struct tcphdr *th,
const struct synproxy_options *opt... | [
1,
0
] |
Linux Kernel | net/netfilter/nf_synproxy_core.c |
static void synproxy_send_server_ack_ipv6(struct net *net,
const struct ip_ct_tcp *state,
const struct sk_buff *skb,
const struct tcphdr *th,
const str... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.