aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@computergmbh.de>2008-01-15 02:42:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:27 -0500
commitf72e25a897c7edda03a0e1f767925d98772684da (patch)
treefb64cfbee8ba3000931e99f0fe5c464abb8f5ace /net/ipv4
parent2ae15b64e6a1608c840c60df38e8e5eef7b2b8c3 (diff)
[NETFILTER]: Rename ipt_iprange to xt_iprange
This patch moves ipt_iprange to xt_iprange, in preparation for adding IPv6 support to xt_iprange. Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/Kconfig10
-rw-r--r--net/ipv4/netfilter/Makefile1
-rw-r--r--net/ipv4/netfilter/ipt_iprange.c77
3 files changed, 0 insertions, 88 deletions
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 10ca307b8499..9a077cb24798 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -57,16 +57,6 @@ config IP_NF_IPTABLES
57 To compile it as a module, choose M here. If unsure, say N. 57 To compile it as a module, choose M here. If unsure, say N.
58 58
59# The matches. 59# The matches.
60config IP_NF_MATCH_IPRANGE
61 tristate '"iprange" match support'
62 depends on IP_NF_IPTABLES
63 depends on NETFILTER_ADVANCED
64 help
65 This option makes possible to match IP addresses against IP address
66 ranges.
67
68 To compile it as a module, choose M here. If unsure, say N.
69
70config IP_NF_MATCH_RECENT 60config IP_NF_MATCH_RECENT
71 tristate '"recent" match support' 61 tristate '"recent" match support'
72 depends on IP_NF_IPTABLES 62 depends on IP_NF_IPTABLES
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile
index fd7d4a5b436c..0c7dc78a62e9 100644
--- a/net/ipv4/netfilter/Makefile
+++ b/net/ipv4/netfilter/Makefile
@@ -44,7 +44,6 @@ obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o
44obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o 44obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o
45obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o 45obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o
46obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o 46obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o
47obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o
48obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o 47obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o
49obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o 48obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o
50 49
diff --git a/net/ipv4/netfilter/ipt_iprange.c b/net/ipv4/netfilter/ipt_iprange.c
deleted file mode 100644
index 9a2aba816c9b..000000000000
--- a/net/ipv4/netfilter/ipt_iprange.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * iptables module to match IP address ranges
3 *
4 * (C) 2003 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/module.h>
11#include <linux/skbuff.h>
12#include <linux/ip.h>
13#include <linux/netfilter/x_tables.h>
14#include <linux/netfilter_ipv4/ipt_iprange.h>
15
16MODULE_LICENSE("GPL");
17MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
18MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching");
19
20static bool
21iprange_mt(const struct sk_buff *skb, const struct net_device *in,
22 const struct net_device *out, const struct xt_match *match,
23 const void *matchinfo, int offset, unsigned int protoff,
24 bool *hotdrop)
25{
26 const struct ipt_iprange_info *info = matchinfo;
27 const struct iphdr *iph = ip_hdr(skb);
28
29 if (info->flags & IPRANGE_SRC) {
30 if ((ntohl(iph->saddr) < ntohl(info->src.min_ip)
31 || ntohl(iph->saddr) > ntohl(info->src.max_ip))
32 ^ !!(info->flags & IPRANGE_SRC_INV)) {
33 pr_debug("src IP %u.%u.%u.%u NOT in range %s"
34 "%u.%u.%u.%u-%u.%u.%u.%u\n",
35 NIPQUAD(iph->saddr),
36 info->flags & IPRANGE_SRC_INV ? "(INV) " : "",
37 NIPQUAD(info->src.min_ip),
38 NIPQUAD(info->src.max_ip));
39 return false;
40 }
41 }
42 if (info->flags & IPRANGE_DST) {
43 if ((ntohl(iph->daddr) < ntohl(info->dst.min_ip)
44 || ntohl(iph->daddr) > ntohl(info->dst.max_ip))
45 ^ !!(info->flags & IPRANGE_DST_INV)) {
46 pr_debug("dst IP %u.%u.%u.%u NOT in range %s"
47 "%u.%u.%u.%u-%u.%u.%u.%u\n",
48 NIPQUAD(iph->daddr),
49 info->flags & IPRANGE_DST_INV ? "(INV) " : "",
50 NIPQUAD(info->dst.min_ip),
51 NIPQUAD(info->dst.max_ip));
52 return false;
53 }
54 }
55 return true;
56}
57
58static struct xt_match iprange_mt_reg __read_mostly = {
59 .name = "iprange",
60 .family = AF_INET,
61 .match = iprange_mt,
62 .matchsize = sizeof(struct ipt_iprange_info),
63 .me = THIS_MODULE
64};
65
66static int __init iprange_mt_init(void)
67{
68 return xt_register_match(&iprange_mt_reg);
69}
70
71static void __exit iprange_mt_exit(void)
72{
73 xt_unregister_match(&iprange_mt_reg);
74}
75
76module_init(iprange_mt_init);
77module_exit(iprange_mt_exit);