aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@computergmbh.de>2007-12-18 01:43:50 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:07 -0500
commit643a2c15a407faf08101a20e1a3461160711899d (patch)
treeee1634c4961162f3ae938fb892b64083af838ba3 /net/netfilter
parentdf54aae02210e1acf3a1d2ffac9b29003835710c (diff)
[NETFILTER]: Introduce nf_inet_address
A few netfilter modules provide their own union of IPv4 and IPv6 address storage. Will unify that in this patch series. (1/4): Rename union nf_conntrack_address to union nf_inet_addr and move it to x_tables.h. 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/netfilter')
-rw-r--r--net/netfilter/nf_conntrack_expect.c4
-rw-r--r--net/netfilter/nf_conntrack_ftp.c2
-rw-r--r--net/netfilter/nf_conntrack_h323_main.c34
-rw-r--r--net/netfilter/nf_conntrack_sip.c8
-rw-r--r--net/netfilter/xt_connlimit.c20
5 files changed, 34 insertions, 34 deletions
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index 175c8d1a199..0efbf343eac 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -226,8 +226,8 @@ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me)
226EXPORT_SYMBOL_GPL(nf_ct_expect_alloc); 226EXPORT_SYMBOL_GPL(nf_ct_expect_alloc);
227 227
228void nf_ct_expect_init(struct nf_conntrack_expect *exp, int family, 228void nf_ct_expect_init(struct nf_conntrack_expect *exp, int family,
229 union nf_conntrack_address *saddr, 229 union nf_inet_addr *saddr,
230 union nf_conntrack_address *daddr, 230 union nf_inet_addr *daddr,
231 u_int8_t proto, __be16 *src, __be16 *dst) 231 u_int8_t proto, __be16 *src, __be16 *dst)
232{ 232{
233 int len; 233 int len;
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index 6df259067f7..6770baf2e84 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -358,7 +358,7 @@ static int help(struct sk_buff *skb,
358 unsigned int matchlen, matchoff; 358 unsigned int matchlen, matchoff;
359 struct nf_ct_ftp_master *ct_ftp_info = &nfct_help(ct)->help.ct_ftp_info; 359 struct nf_ct_ftp_master *ct_ftp_info = &nfct_help(ct)->help.ct_ftp_info;
360 struct nf_conntrack_expect *exp; 360 struct nf_conntrack_expect *exp;
361 union nf_conntrack_address *daddr; 361 union nf_inet_addr *daddr;
362 struct nf_conntrack_man cmd = {}; 362 struct nf_conntrack_man cmd = {};
363 unsigned int i; 363 unsigned int i;
364 int found = 0, ends_in_nl; 364 int found = 0, ends_in_nl;
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index b636ca60a77..872c1aa3124 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -50,12 +50,12 @@ MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations "
50int (*set_h245_addr_hook) (struct sk_buff *skb, 50int (*set_h245_addr_hook) (struct sk_buff *skb,
51 unsigned char **data, int dataoff, 51 unsigned char **data, int dataoff,
52 H245_TransportAddress *taddr, 52 H245_TransportAddress *taddr,
53 union nf_conntrack_address *addr, __be16 port) 53 union nf_inet_addr *addr, __be16 port)
54 __read_mostly; 54 __read_mostly;
55int (*set_h225_addr_hook) (struct sk_buff *skb, 55int (*set_h225_addr_hook) (struct sk_buff *skb,
56 unsigned char **data, int dataoff, 56 unsigned char **data, int dataoff,
57 TransportAddress *taddr, 57 TransportAddress *taddr,
58 union nf_conntrack_address *addr, __be16 port) 58 union nf_inet_addr *addr, __be16 port)
59 __read_mostly; 59 __read_mostly;
60int (*set_sig_addr_hook) (struct sk_buff *skb, 60int (*set_sig_addr_hook) (struct sk_buff *skb,
61 struct nf_conn *ct, 61 struct nf_conn *ct,
@@ -214,7 +214,7 @@ static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
214/****************************************************************************/ 214/****************************************************************************/
215static int get_h245_addr(struct nf_conn *ct, unsigned char *data, 215static int get_h245_addr(struct nf_conn *ct, unsigned char *data,
216 H245_TransportAddress *taddr, 216 H245_TransportAddress *taddr,
217 union nf_conntrack_address *addr, __be16 *port) 217 union nf_inet_addr *addr, __be16 *port)
218{ 218{
219 unsigned char *p; 219 unsigned char *p;
220 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; 220 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
@@ -257,7 +257,7 @@ static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
257 int ret = 0; 257 int ret = 0;
258 __be16 port; 258 __be16 port;
259 __be16 rtp_port, rtcp_port; 259 __be16 rtp_port, rtcp_port;
260 union nf_conntrack_address addr; 260 union nf_inet_addr addr;
261 struct nf_conntrack_expect *rtp_exp; 261 struct nf_conntrack_expect *rtp_exp;
262 struct nf_conntrack_expect *rtcp_exp; 262 struct nf_conntrack_expect *rtcp_exp;
263 typeof(nat_rtp_rtcp_hook) nat_rtp_rtcp; 263 typeof(nat_rtp_rtcp_hook) nat_rtp_rtcp;
@@ -330,7 +330,7 @@ static int expect_t120(struct sk_buff *skb,
330 int dir = CTINFO2DIR(ctinfo); 330 int dir = CTINFO2DIR(ctinfo);
331 int ret = 0; 331 int ret = 0;
332 __be16 port; 332 __be16 port;
333 union nf_conntrack_address addr; 333 union nf_inet_addr addr;
334 struct nf_conntrack_expect *exp; 334 struct nf_conntrack_expect *exp;
335 typeof(nat_t120_hook) nat_t120; 335 typeof(nat_t120_hook) nat_t120;
336 336
@@ -623,7 +623,7 @@ static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = {
623/****************************************************************************/ 623/****************************************************************************/
624int get_h225_addr(struct nf_conn *ct, unsigned char *data, 624int get_h225_addr(struct nf_conn *ct, unsigned char *data,
625 TransportAddress *taddr, 625 TransportAddress *taddr,
626 union nf_conntrack_address *addr, __be16 *port) 626 union nf_inet_addr *addr, __be16 *port)
627{ 627{
628 unsigned char *p; 628 unsigned char *p;
629 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; 629 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
@@ -662,7 +662,7 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
662 int dir = CTINFO2DIR(ctinfo); 662 int dir = CTINFO2DIR(ctinfo);
663 int ret = 0; 663 int ret = 0;
664 __be16 port; 664 __be16 port;
665 union nf_conntrack_address addr; 665 union nf_inet_addr addr;
666 struct nf_conntrack_expect *exp; 666 struct nf_conntrack_expect *exp;
667 typeof(nat_h245_hook) nat_h245; 667 typeof(nat_h245_hook) nat_h245;
668 668
@@ -704,8 +704,8 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
704 704
705/* If the calling party is on the same side of the forward-to party, 705/* If the calling party is on the same side of the forward-to party,
706 * we don't need to track the second call */ 706 * we don't need to track the second call */
707static int callforward_do_filter(union nf_conntrack_address *src, 707static int callforward_do_filter(union nf_inet_addr *src,
708 union nf_conntrack_address *dst, 708 union nf_inet_addr *dst,
709 int family) 709 int family)
710{ 710{
711 const struct nf_afinfo *afinfo; 711 const struct nf_afinfo *afinfo;
@@ -772,7 +772,7 @@ static int expect_callforwarding(struct sk_buff *skb,
772 int dir = CTINFO2DIR(ctinfo); 772 int dir = CTINFO2DIR(ctinfo);
773 int ret = 0; 773 int ret = 0;
774 __be16 port; 774 __be16 port;
775 union nf_conntrack_address addr; 775 union nf_inet_addr addr;
776 struct nf_conntrack_expect *exp; 776 struct nf_conntrack_expect *exp;
777 typeof(nat_callforwarding_hook) nat_callforwarding; 777 typeof(nat_callforwarding_hook) nat_callforwarding;
778 778
@@ -828,7 +828,7 @@ static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
828 int ret; 828 int ret;
829 int i; 829 int i;
830 __be16 port; 830 __be16 port;
831 union nf_conntrack_address addr; 831 union nf_inet_addr addr;
832 typeof(set_h225_addr_hook) set_h225_addr; 832 typeof(set_h225_addr_hook) set_h225_addr;
833 833
834 pr_debug("nf_ct_q931: Setup\n"); 834 pr_debug("nf_ct_q931: Setup\n");
@@ -1200,7 +1200,7 @@ static unsigned char *get_udp_data(struct sk_buff *skb, unsigned int protoff,
1200 1200
1201/****************************************************************************/ 1201/****************************************************************************/
1202static struct nf_conntrack_expect *find_expect(struct nf_conn *ct, 1202static struct nf_conntrack_expect *find_expect(struct nf_conn *ct,
1203 union nf_conntrack_address *addr, 1203 union nf_inet_addr *addr,
1204 __be16 port) 1204 __be16 port)
1205{ 1205{
1206 struct nf_conntrack_expect *exp; 1206 struct nf_conntrack_expect *exp;
@@ -1242,7 +1242,7 @@ static int expect_q931(struct sk_buff *skb, struct nf_conn *ct,
1242 int ret = 0; 1242 int ret = 0;
1243 int i; 1243 int i;
1244 __be16 port; 1244 __be16 port;
1245 union nf_conntrack_address addr; 1245 union nf_inet_addr addr;
1246 struct nf_conntrack_expect *exp; 1246 struct nf_conntrack_expect *exp;
1247 typeof(nat_q931_hook) nat_q931; 1247 typeof(nat_q931_hook) nat_q931;
1248 1248
@@ -1311,7 +1311,7 @@ static int process_gcf(struct sk_buff *skb, struct nf_conn *ct,
1311 int dir = CTINFO2DIR(ctinfo); 1311 int dir = CTINFO2DIR(ctinfo);
1312 int ret = 0; 1312 int ret = 0;
1313 __be16 port; 1313 __be16 port;
1314 union nf_conntrack_address addr; 1314 union nf_inet_addr addr;
1315 struct nf_conntrack_expect *exp; 1315 struct nf_conntrack_expect *exp;
1316 1316
1317 pr_debug("nf_ct_ras: GCF\n"); 1317 pr_debug("nf_ct_ras: GCF\n");
@@ -1471,7 +1471,7 @@ static int process_arq(struct sk_buff *skb, struct nf_conn *ct,
1471 struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info; 1471 struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
1472 int dir = CTINFO2DIR(ctinfo); 1472 int dir = CTINFO2DIR(ctinfo);
1473 __be16 port; 1473 __be16 port;
1474 union nf_conntrack_address addr; 1474 union nf_inet_addr addr;
1475 typeof(set_h225_addr_hook) set_h225_addr; 1475 typeof(set_h225_addr_hook) set_h225_addr;
1476 1476
1477 pr_debug("nf_ct_ras: ARQ\n"); 1477 pr_debug("nf_ct_ras: ARQ\n");
@@ -1513,7 +1513,7 @@ static int process_acf(struct sk_buff *skb, struct nf_conn *ct,
1513 int dir = CTINFO2DIR(ctinfo); 1513 int dir = CTINFO2DIR(ctinfo);
1514 int ret = 0; 1514 int ret = 0;
1515 __be16 port; 1515 __be16 port;
1516 union nf_conntrack_address addr; 1516 union nf_inet_addr addr;
1517 struct nf_conntrack_expect *exp; 1517 struct nf_conntrack_expect *exp;
1518 typeof(set_sig_addr_hook) set_sig_addr; 1518 typeof(set_sig_addr_hook) set_sig_addr;
1519 1519
@@ -1576,7 +1576,7 @@ static int process_lcf(struct sk_buff *skb, struct nf_conn *ct,
1576 int dir = CTINFO2DIR(ctinfo); 1576 int dir = CTINFO2DIR(ctinfo);
1577 int ret = 0; 1577 int ret = 0;
1578 __be16 port; 1578 __be16 port;
1579 union nf_conntrack_address addr; 1579 union nf_inet_addr addr;
1580 struct nf_conntrack_expect *exp; 1580 struct nf_conntrack_expect *exp;
1581 1581
1582 pr_debug("nf_ct_ras: LCF\n"); 1582 pr_debug("nf_ct_ras: LCF\n");
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 515abffc4a0..47d8947cf26 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -247,7 +247,7 @@ static int skp_digits_len(struct nf_conn *ct, const char *dptr,
247} 247}
248 248
249static int parse_addr(struct nf_conn *ct, const char *cp, const char **endp, 249static int parse_addr(struct nf_conn *ct, const char *cp, const char **endp,
250 union nf_conntrack_address *addr, const char *limit) 250 union nf_inet_addr *addr, const char *limit)
251{ 251{
252 const char *end; 252 const char *end;
253 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; 253 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
@@ -275,7 +275,7 @@ static int parse_addr(struct nf_conn *ct, const char *cp, const char **endp,
275static int epaddr_len(struct nf_conn *ct, const char *dptr, 275static int epaddr_len(struct nf_conn *ct, const char *dptr,
276 const char *limit, int *shift) 276 const char *limit, int *shift)
277{ 277{
278 union nf_conntrack_address addr; 278 union nf_inet_addr addr;
279 const char *aux = dptr; 279 const char *aux = dptr;
280 280
281 if (!parse_addr(ct, dptr, &dptr, &addr, limit)) { 281 if (!parse_addr(ct, dptr, &dptr, &addr, limit)) {
@@ -366,7 +366,7 @@ EXPORT_SYMBOL_GPL(ct_sip_get_info);
366static int set_expected_rtp(struct sk_buff *skb, 366static int set_expected_rtp(struct sk_buff *skb,
367 struct nf_conn *ct, 367 struct nf_conn *ct,
368 enum ip_conntrack_info ctinfo, 368 enum ip_conntrack_info ctinfo,
369 union nf_conntrack_address *addr, 369 union nf_inet_addr *addr,
370 __be16 port, 370 __be16 port,
371 const char *dptr) 371 const char *dptr)
372{ 372{
@@ -403,7 +403,7 @@ static int sip_help(struct sk_buff *skb,
403 enum ip_conntrack_info ctinfo) 403 enum ip_conntrack_info ctinfo)
404{ 404{
405 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; 405 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
406 union nf_conntrack_address addr; 406 union nf_inet_addr addr;
407 unsigned int dataoff, datalen; 407 unsigned int dataoff, datalen;
408 const char *dptr; 408 const char *dptr;
409 int ret = NF_ACCEPT; 409 int ret = NF_ACCEPT;
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index 26d12b00a9c..b7a684607c7 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -53,10 +53,10 @@ static inline unsigned int connlimit_iphash(__be32 addr)
53} 53}
54 54
55static inline unsigned int 55static inline unsigned int
56connlimit_iphash6(const union nf_conntrack_address *addr, 56connlimit_iphash6(const union nf_inet_addr *addr,
57 const union nf_conntrack_address *mask) 57 const union nf_inet_addr *mask)
58{ 58{
59 union nf_conntrack_address res; 59 union nf_inet_addr res;
60 unsigned int i; 60 unsigned int i;
61 61
62 if (unlikely(!connlimit_rnd_inited)) { 62 if (unlikely(!connlimit_rnd_inited)) {
@@ -81,14 +81,14 @@ static inline bool already_closed(const struct nf_conn *conn)
81} 81}
82 82
83static inline unsigned int 83static inline unsigned int
84same_source_net(const union nf_conntrack_address *addr, 84same_source_net(const union nf_inet_addr *addr,
85 const union nf_conntrack_address *mask, 85 const union nf_inet_addr *mask,
86 const union nf_conntrack_address *u3, unsigned int family) 86 const union nf_inet_addr *u3, unsigned int family)
87{ 87{
88 if (family == AF_INET) { 88 if (family == AF_INET) {
89 return (addr->ip & mask->ip) == (u3->ip & mask->ip); 89 return (addr->ip & mask->ip) == (u3->ip & mask->ip);
90 } else { 90 } else {
91 union nf_conntrack_address lh, rh; 91 union nf_inet_addr lh, rh;
92 unsigned int i; 92 unsigned int i;
93 93
94 for (i = 0; i < ARRAY_SIZE(addr->ip6); ++i) { 94 for (i = 0; i < ARRAY_SIZE(addr->ip6); ++i) {
@@ -102,8 +102,8 @@ same_source_net(const union nf_conntrack_address *addr,
102 102
103static int count_them(struct xt_connlimit_data *data, 103static int count_them(struct xt_connlimit_data *data,
104 const struct nf_conntrack_tuple *tuple, 104 const struct nf_conntrack_tuple *tuple,
105 const union nf_conntrack_address *addr, 105 const union nf_inet_addr *addr,
106 const union nf_conntrack_address *mask, 106 const union nf_inet_addr *mask,
107 const struct xt_match *match) 107 const struct xt_match *match)
108{ 108{
109 struct nf_conntrack_tuple_hash *found; 109 struct nf_conntrack_tuple_hash *found;
@@ -185,7 +185,7 @@ connlimit_mt(const struct sk_buff *skb, const struct net_device *in,
185 bool *hotdrop) 185 bool *hotdrop)
186{ 186{
187 const struct xt_connlimit_info *info = matchinfo; 187 const struct xt_connlimit_info *info = matchinfo;
188 union nf_conntrack_address addr, mask; 188 union nf_inet_addr addr, mask;
189 struct nf_conntrack_tuple tuple; 189 struct nf_conntrack_tuple tuple;
190 const struct nf_conntrack_tuple *tuple_ptr = &tuple; 190 const struct nf_conntrack_tuple *tuple_ptr = &tuple;
191 enum ip_conntrack_info ctinfo; 191 enum ip_conntrack_info ctinfo;