Blame view
net/netfilter/nf_nat_tftp.c
1.36 KB
a536df35b [NETFILTER]: nf_c... |
1 2 3 4 5 6 7 8 |
/* (C) 2001-2002 Magnus Boden <mb@ozaba.mine.nu> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/module.h> |
a536df35b [NETFILTER]: nf_c... |
9 |
#include <linux/udp.h> |
a536df35b [NETFILTER]: nf_c... |
10 11 |
#include <net/netfilter/nf_conntrack_helper.h> #include <net/netfilter/nf_conntrack_expect.h> |
1afc56794 netfilter: nf_ct_... |
12 |
#include <net/netfilter/nf_nat_helper.h> |
a536df35b [NETFILTER]: nf_c... |
13 14 15 16 17 18 |
#include <linux/netfilter/nf_conntrack_tftp.h> MODULE_AUTHOR("Magnus Boden <mb@ozaba.mine.nu>"); MODULE_DESCRIPTION("TFTP NAT helper"); MODULE_LICENSE("GPL"); MODULE_ALIAS("ip_nat_tftp"); |
3db05fea5 [NETFILTER]: Repl... |
19 |
static unsigned int help(struct sk_buff *skb, |
a536df35b [NETFILTER]: nf_c... |
20 21 22 |
enum ip_conntrack_info ctinfo, struct nf_conntrack_expect *exp) { |
de24b4ebb [NETFILTER]: nf_{... |
23 |
const struct nf_conn *ct = exp->master; |
a536df35b [NETFILTER]: nf_c... |
24 25 26 27 28 |
exp->saved_proto.udp.port = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.udp.port; exp->dir = IP_CT_DIR_REPLY; exp->expectfn = nf_nat_follow_master; |
b20ab9cc6 netfilter: nf_ct_... |
29 30 |
if (nf_ct_expect_related(exp) != 0) { nf_ct_helper_log(skb, exp->master, "cannot add expectation"); |
a536df35b [NETFILTER]: nf_c... |
31 |
return NF_DROP; |
b20ab9cc6 netfilter: nf_ct_... |
32 |
} |
a536df35b [NETFILTER]: nf_c... |
33 34 35 36 37 |
return NF_ACCEPT; } static void __exit nf_nat_tftp_fini(void) { |
a9b3cd7f3 rcu: convert uses... |
38 |
RCU_INIT_POINTER(nf_nat_tftp_hook, NULL); |
a536df35b [NETFILTER]: nf_c... |
39 40 41 42 43 |
synchronize_rcu(); } static int __init nf_nat_tftp_init(void) { |
d1332e0ab [NETFILTER]: remo... |
44 |
BUG_ON(nf_nat_tftp_hook != NULL); |
a9b3cd7f3 rcu: convert uses... |
45 |
RCU_INIT_POINTER(nf_nat_tftp_hook, help); |
a536df35b [NETFILTER]: nf_c... |
46 47 48 49 50 |
return 0; } module_init(nf_nat_tftp_init); module_exit(nf_nat_tftp_fini); |