- rebuild for kernel-3.7.10-4
[packages/xtables-addons.git] / xtables-addons-DNETMAP.patch
CommitLineData
0d8b3919
JR
1diff -ruN xtables-addons-1.47.1/extensions/libxt_DNETMAP.c xtables-addons-2.0/extensions/libxt_DNETMAP.c
2--- xtables-addons-1.47.1/extensions/libxt_DNETMAP.c 2012-10-15 21:29:22.000000000 +0200
3+++ xtables-addons-2.0/extensions/libxt_DNETMAP.c 2012-11-12 19:03:51.000000000 +0100
4@@ -69,19 +69,8 @@
5 return bits;
6 }
7
8-static void DNETMAP_init(struct xt_entry_target *t)
9-{
10- struct xt_DNETMAP_tginfo *tginfo = (void *)&t->data;
11- struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
12-
13- /* Actually, it's 0, but it's ignored at the moment. */
14- mr->rangesize = 1;
15- tginfo->ttl = 0;
16- tginfo->flags = 0;
17-}
18-
19 /* Parses network address */
20-static void parse_prefix(char *arg, struct nf_nat_ipv4_range *range)
21+static void parse_prefix(char *arg, struct nf_nat_range *range)
22 {
23 char *slash;
24 const struct in_addr *ip;
25@@ -97,7 +86,7 @@
26 if (ip == NULL)
27 xtables_error(PARAMETER_PROBLEM, "Bad IP address \"%s\"\n",
28 arg);
29- range->min_ip = ip->s_addr;
30+ range->min_addr.in = *ip;
31 if (slash) {
32 if (strchr(slash + 1, '.')) {
33 ip = xtables_numeric_to_ipmask(slash + 1);
34@@ -123,20 +112,20 @@
35 } else
36 netmask = ~0;
37
38- if (range->min_ip & ~netmask) {
39+ if (range->min_addr.ip & ~netmask) {
40 if (slash)
41 *slash = '/';
42 xtables_error(PARAMETER_PROBLEM, "Bad network address \"%s\"\n",
43 arg);
44 }
45- range->max_ip = range->min_ip | ~netmask;
46+ range->max_addr.ip = range->min_addr.ip | ~netmask;
47 }
48
49 static int DNETMAP_parse(int c, char **argv, int invert, unsigned int *flags,
50 const void *entry, struct xt_entry_target **target)
51 {
52 struct xt_DNETMAP_tginfo *tginfo = (void *)(*target)->data;
53- struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
54+ struct nf_nat_range *mr = &tginfo->prefix;
55 char *end;
56
57 switch (c) {
58@@ -147,7 +136,7 @@
59 invert);
60
61 /* TO-DO use xtables_ipparse_any instead? */
62- parse_prefix(optarg, &mr->range[0]);
63+ parse_prefix(optarg, mr);
64 *flags |= XT_DNETMAP_PREFIX;
65 tginfo->flags |= XT_DNETMAP_PREFIX;
66 return 1;
67@@ -192,14 +181,13 @@
68 int numeric)
69 {
70 struct xt_DNETMAP_tginfo *tginfo = (void *)&target->data;
71- const struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
72- const struct nf_nat_ipv4_range *r = &mr->range[0];
73+ const struct nf_nat_range *r = &tginfo->prefix;
74 struct in_addr a;
75 int bits;
76
77- a.s_addr = r->min_ip;
78+ a = r->min_addr.in;
79 printf("%s", xtables_ipaddr_to_numeric(&a));
80- a.s_addr = ~(r->min_ip ^ r->max_ip);
81+ a.s_addr = ~(r->min_addr.ip ^ r->max_addr.ip);
82 bits = netmask2bits(a.s_addr);
83 if (bits < 0)
84 printf("/%s", xtables_ipaddr_to_numeric(&a));
85@@ -265,7 +253,6 @@
86 .size = XT_ALIGN(sizeof(struct xt_DNETMAP_tginfo)),
87 .userspacesize = XT_ALIGN(sizeof(struct xt_DNETMAP_tginfo)),
88 .help = DNETMAP_help,
89- .init = DNETMAP_init,
90 .parse = DNETMAP_parse,
91 .print = DNETMAP_print,
92 .save = DNETMAP_save,
93diff -ruN xtables-addons-1.47.1/extensions/xt_DNETMAP.c xtables-addons-2.0/extensions/xt_DNETMAP.c
94--- xtables-addons-1.47.1/extensions/xt_DNETMAP.c 2012-10-15 21:29:22.000000000 +0200
95+++ xtables-addons-2.0/extensions/xt_DNETMAP.c 2012-11-12 19:03:51.000000000 +0100
96@@ -84,7 +78,7 @@
97 };
98
99 struct dnetmap_prefix {
100- struct nf_nat_ipv4_multi_range_compat prefix;
101+ struct nf_nat_range prefix;
102 char prefix_str[16];
103 #ifdef CONFIG_PROC_FS
104 char proc_str_data[20];
105@@ -179,7 +168,7 @@
106
107 static struct dnetmap_prefix *
108 dnetmap_prefix_lookup(struct dnetmap_net *dnetmap_net,
109- const struct nf_nat_ipv4_multi_range_compat *mr)
110+ const struct nf_nat_range *mr)
111 {
112 struct dnetmap_prefix *p;
113
114@@ -258,7 +247,7 @@
115 {
116 struct dnetmap_net *dnetmap_net = dnetmap_pernet(par->net);
117 const struct xt_DNETMAP_tginfo *tginfo = par->targinfo;
118- const struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
119+ const struct nf_nat_range *mr = &tginfo->prefix;
120 struct dnetmap_prefix *p;
121 struct dnetmap_entry *e;
122 #ifdef CONFIG_PROC_FS
123@@ -274,14 +263,10 @@
124 return ret;
125 }
126
127- if (!(mr->range[0].flags & NF_NAT_RANGE_MAP_IPS)) {
128+ if (!(mr->flags & NF_NAT_RANGE_MAP_IPS)) {
129 pr_debug("DNETMAP:check: bad MAP_IPS.\n");
130 return -EINVAL;
131 }
132- if (mr->rangesize != 1) {
133- pr_debug("DNETMAP:check: bad rangesize %u.\n", mr->rangesize);
134- return -EINVAL;
135- }
136
137 mutex_lock(&dnetmap_mutex);
138 p = dnetmap_prefix_lookup(dnetmap_net, mr);
139@@ -307,15 +292,15 @@
140 INIT_LIST_HEAD(&p->lru_list);
141 INIT_LIST_HEAD(&p->elist);
142
143- ip_min = ntohl(mr->range[0].min_ip) + (whole_prefix == 0);
144- ip_max = ntohl(mr->range[0].max_ip) - (whole_prefix == 0);
145+ ip_min = ntohl(mr->min_addr.ip) + (whole_prefix == 0);
146+ ip_max = ntohl(mr->max_addr.ip) - (whole_prefix == 0);
147
148- sprintf(p->prefix_str, NIPQUAD_FMT "/%u", NIPQUAD(mr->range[0].min_ip),
149+ sprintf(p->prefix_str, NIPQUAD_FMT "/%u", NIPQUAD(mr->min_addr.ip),
150 33 - ffs(~(ip_min ^ ip_max)));
151 #ifdef CONFIG_PROC_FS
152- sprintf(p->proc_str_data, NIPQUAD_FMT "_%u", NIPQUAD(mr->range[0].min_ip),
153+ sprintf(p->proc_str_data, NIPQUAD_FMT "_%u", NIPQUAD(mr->min_addr.ip),
154 33 - ffs(~(ip_min ^ ip_max)));
155- sprintf(p->proc_str_stat, NIPQUAD_FMT "_%u_stat", NIPQUAD(mr->range[0].min_ip),
156+ sprintf(p->proc_str_stat, NIPQUAD_FMT "_%u_stat", NIPQUAD(mr->min_addr.ip),
157 33 - ffs(~(ip_min ^ ip_max)));
158 #endif
159 printk(KERN_INFO KBUILD_MODNAME ": new prefix %s\n", p->prefix_str);
160@@ -381,8 +366,8 @@
161 enum ip_conntrack_info ctinfo;
162 __be32 prenat_ip, postnat_ip, prenat_ip_prev;
163 const struct xt_DNETMAP_tginfo *tginfo = par->targinfo;
164- const struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
165- struct nf_nat_ipv4_range newrange;
166+ const struct nf_nat_range *mr = &tginfo->prefix;
167+ struct nf_nat_range newrange;
168 struct dnetmap_entry *e;
169 struct dnetmap_prefix *p;
170 __s32 jttl;
171@@ -419,15 +404,14 @@
172
173 spin_unlock_bh(&dnetmap_lock);
174
175- newrange = ((struct nf_nat_ipv4_range) {
176- mr->range[0].flags | NF_NAT_RANGE_MAP_IPS,
177- e->prenat_addr, e->prenat_addr,
178- mr->range[0].min, mr->range[0].max});
179-
180- /* Hand modified range to generic setup. */
181+ memset(&newrange, 0, sizeof(newrange));
182+ newrange.flags = mr->flags | NF_NAT_RANGE_MAP_IPS;
183+ newrange.min_addr.ip = e->prenat_addr;
184+ newrange.max_addr.ip = e->prenat_addr;
185+ newrange.min_proto = mr->min_proto;
186+ newrange.max_proto = mr->max_proto;
187 return nf_nat_setup_info(ct, &newrange,
188 HOOK2MANIP(par->hooknum));
189-
190 }
191
192 prenat_ip = ip_hdr(skb)->saddr;
193@@ -509,12 +493,12 @@
194
195 spin_unlock_bh(&dnetmap_lock);
196
197- newrange = ((struct nf_nat_ipv4_range) {
198- mr->range[0].flags | NF_NAT_RANGE_MAP_IPS,
199- postnat_ip, postnat_ip,
200- mr->range[0].min, mr->range[0].max});
201-
202- /* Hand modified range to generic setup. */
203+ memset(&newrange, 0, sizeof(newrange));
204+ newrange.flags = mr->flags | NF_NAT_RANGE_MAP_IPS;
205+ newrange.min_addr.ip = postnat_ip;
206+ newrange.max_addr.ip = postnat_ip;
207+ newrange.min_proto = mr->min_proto;
208+ newrange.max_proto = mr->max_proto;
209 return nf_nat_setup_info(ct, &newrange, HOOK2MANIP(par->hooknum));
210
211 no_rev_map:
212@@ -528,7 +512,7 @@
213 {
214 struct dnetmap_net *dnetmap_net = dnetmap_pernet(par->net);
215 const struct xt_DNETMAP_tginfo *tginfo = par->targinfo;
216- const struct nf_nat_ipv4_multi_range_compat *mr = &tginfo->prefix;
217+ const struct nf_nat_range *mr = &tginfo->prefix;
218 struct dnetmap_prefix *p;
219
220 if (!(tginfo->flags & XT_DNETMAP_PREFIX))
221diff -ruN xtables-addons-1.47.1/extensions/xt_DNETMAP.h xtables-addons-2.0/extensions/xt_DNETMAP.h
222--- xtables-addons-1.47.1/extensions/xt_DNETMAP.h 2012-10-15 21:29:22.000000000 +0200
223+++ xtables-addons-2.0/extensions/xt_DNETMAP.h 2012-11-12 19:03:51.000000000 +0100
224@@ -13,7 +13,7 @@
225 };
226
227 struct xt_DNETMAP_tginfo {
228- struct nf_nat_ipv4_multi_range_compat prefix;
229+ struct nf_nat_range prefix;
230 __u8 flags;
231 __s32 ttl;
232 };
233diff -ruN xtables-addons-1.47.1/include/linux/netfilter/nf_nat.h xtables-addons-2.0/include/linux/netfilter/nf_nat.h
234--- xtables-addons-1.47.1/include/linux/netfilter/nf_nat.h 2012-10-15 21:29:22.000000000 +0200
235+++ xtables-addons-2.0/include/linux/netfilter/nf_nat.h 2012-11-12 19:03:51.000000000 +0100
236@@ -22,4 +22,12 @@
237 struct nf_nat_ipv4_range range[1];
238 };
239
240+struct nf_nat_range {
241+ unsigned int flags;
242+ union nf_inet_addr min_addr;
243+ union nf_inet_addr max_addr;
244+ union nf_conntrack_man_proto min_proto;
245+ union nf_conntrack_man_proto max_proto;
246+};
247+
248 #endif /* _NETFILTER_NF_NAT_H */
249diff -ruN xtables-addons-1.47.1/mconfig xtables-addons-2.0/mconfig
250--- xtables-addons-1.47.1/mconfig 2012-10-15 21:29:22.000000000 +0200
251+++ xtables-addons-2.0/mconfig 2012-11-12 19:03:51.000000000 +0100
252@@ -2,10 +2,9 @@
253 #
254 build_ACCOUNT=m
255 build_CHAOS=m
256-build_CHECKSUM=
257 build_DELUDE=m
258 build_DHCPMAC=m
259-build_DNETMAP=m
260+build_DNETMAP=
261 build_ECHO=m
262 build_IPMARK=m
263 build_LOGMARK=m
264@@ -13,7 +12,6 @@
265 build_STEAL=m
266 build_SYSRQ=m
267 build_TARPIT=m
268-build_TEE=
269 build_condition=m
270 build_fuzzy=m
271 build_geoip=m
This page took 0.174827 seconds and 4 git commands to generate.