[PATCH] sched: fix group power for allnodes_domains
[linux-2.6/openmoko-kernel/knife-kernel.git] / net / ipv4 / netfilter / ip_nat_tftp.c
blob43c3bd7c118e70b1594f11e6397444090ecee1a1
1 /* (C) 2001-2002 Magnus Boden <mb@ozaba.mine.nu>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation.
7 * Version: 0.0.7
9 * Thu 21 Mar 2002 Harald Welte <laforge@gnumonks.org>
10 * - Port to newnat API
12 * This module currently supports DNAT:
13 * iptables -t nat -A PREROUTING -d x.x.x.x -j DNAT --to-dest x.x.x.y
15 * and SNAT:
16 * iptables -t nat -A POSTROUTING { -j MASQUERADE , -j SNAT --to-source x.x.x.x }
18 * It has not been tested with
19 * -j SNAT --to-source x.x.x.x-x.x.x.y since I only have one external ip
20 * If you do test this please let me know if it works or not.
24 #include <linux/module.h>
25 #include <linux/netfilter_ipv4.h>
26 #include <linux/ip.h>
27 #include <linux/udp.h>
29 #include <linux/netfilter.h>
30 #include <linux/netfilter_ipv4/ip_tables.h>
31 #include <linux/netfilter_ipv4/ip_conntrack_helper.h>
32 #include <linux/netfilter_ipv4/ip_conntrack_tftp.h>
33 #include <linux/netfilter_ipv4/ip_nat_helper.h>
34 #include <linux/netfilter_ipv4/ip_nat_rule.h>
35 #include <linux/moduleparam.h>
37 MODULE_AUTHOR("Magnus Boden <mb@ozaba.mine.nu>");
38 MODULE_DESCRIPTION("tftp NAT helper");
39 MODULE_LICENSE("GPL");
41 static unsigned int help(struct sk_buff **pskb,
42 enum ip_conntrack_info ctinfo,
43 struct ip_conntrack_expect *exp)
45 struct ip_conntrack *ct = exp->master;
47 exp->saved_proto.udp.port
48 = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.udp.port;
49 exp->dir = IP_CT_DIR_REPLY;
50 exp->expectfn = ip_nat_follow_master;
51 if (ip_conntrack_expect_related(exp) != 0)
52 return NF_DROP;
53 return NF_ACCEPT;
56 static void __exit fini(void)
58 ip_nat_tftp_hook = NULL;
59 /* Make sure noone calls it, meanwhile. */
60 synchronize_net();
63 static int __init init(void)
65 BUG_ON(ip_nat_tftp_hook);
66 ip_nat_tftp_hook = help;
67 return 0;
70 module_init(init);
71 module_exit(fini);