aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-09-28 17:21:37 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-28 21:03:00 -0400
commitcdcb71bf964e02e0a22007f5d90ead7bede3b85b (patch)
treee632690c78cb4e7fada1bbd6ad0b1db70c16a194 /net/ipv4
parent59b8bfd8fd608821e5addc9f4682c7f2424afd8c (diff)
[NETFILTER]: conntrack annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/ip_conntrack_amanda.c6
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c12
-rw-r--r--net/ipv4/netfilter/ip_conntrack_ftp.c6
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_pptp.c4
-rw-r--r--net/ipv4/netfilter/ip_conntrack_irc.c5
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netbios_ns.c10
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netlink.c82
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_icmp.c4
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_sctp.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c6
-rw-r--r--net/ipv4/netfilter/ip_conntrack_sip.c16
-rw-r--r--net/ipv4/netfilter/ip_conntrack_tftp.c8
12 files changed, 81 insertions, 80 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c
index 0a7bd7f04061..6c7383a8e42b 100644
--- a/net/ipv4/netfilter/ip_conntrack_amanda.c
+++ b/net/ipv4/netfilter/ip_conntrack_amanda.c
@@ -155,11 +155,11 @@ static int help(struct sk_buff **pskb,
155 exp->tuple.dst.protonum = IPPROTO_TCP; 155 exp->tuple.dst.protonum = IPPROTO_TCP;
156 exp->tuple.dst.u.tcp.port = htons(port); 156 exp->tuple.dst.u.tcp.port = htons(port);
157 157
158 exp->mask.src.ip = 0xFFFFFFFF; 158 exp->mask.src.ip = htonl(0xFFFFFFFF);
159 exp->mask.src.u.tcp.port = 0; 159 exp->mask.src.u.tcp.port = 0;
160 exp->mask.dst.ip = 0xFFFFFFFF; 160 exp->mask.dst.ip = htonl(0xFFFFFFFF);
161 exp->mask.dst.protonum = 0xFF; 161 exp->mask.dst.protonum = 0xFF;
162 exp->mask.dst.u.tcp.port = 0xFFFF; 162 exp->mask.dst.u.tcp.port = htons(0xFFFF);
163 163
164 if (ip_nat_amanda_hook) 164 if (ip_nat_amanda_hook)
165 ret = ip_nat_amanda_hook(pskb, ctinfo, off - dataoff, 165 ret = ip_nat_amanda_hook(pskb, ctinfo, off - dataoff,
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index c432b3163609..143c4668538b 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -149,8 +149,8 @@ static unsigned int ip_conntrack_hash_rnd;
149static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple, 149static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple,
150 unsigned int size, unsigned int rnd) 150 unsigned int size, unsigned int rnd)
151{ 151{
152 return (jhash_3words(tuple->src.ip, 152 return (jhash_3words((__force u32)tuple->src.ip,
153 (tuple->dst.ip ^ tuple->dst.protonum), 153 ((__force u32)tuple->dst.ip ^ tuple->dst.protonum),
154 (tuple->src.u.all | (tuple->dst.u.all << 16)), 154 (tuple->src.u.all | (tuple->dst.u.all << 16)),
155 rnd) % size); 155 rnd) % size);
156} 156}
@@ -1169,9 +1169,9 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct,
1169int ip_ct_port_tuple_to_nfattr(struct sk_buff *skb, 1169int ip_ct_port_tuple_to_nfattr(struct sk_buff *skb,
1170 const struct ip_conntrack_tuple *tuple) 1170 const struct ip_conntrack_tuple *tuple)
1171{ 1171{
1172 NFA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(u_int16_t), 1172 NFA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(__be16),
1173 &tuple->src.u.tcp.port); 1173 &tuple->src.u.tcp.port);
1174 NFA_PUT(skb, CTA_PROTO_DST_PORT, sizeof(u_int16_t), 1174 NFA_PUT(skb, CTA_PROTO_DST_PORT, sizeof(__be16),
1175 &tuple->dst.u.tcp.port); 1175 &tuple->dst.u.tcp.port);
1176 return 0; 1176 return 0;
1177 1177
@@ -1186,9 +1186,9 @@ int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
1186 return -EINVAL; 1186 return -EINVAL;
1187 1187
1188 t->src.u.tcp.port = 1188 t->src.u.tcp.port =
1189 *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_SRC_PORT-1]); 1189 *(__be16 *)NFA_DATA(tb[CTA_PROTO_SRC_PORT-1]);
1190 t->dst.u.tcp.port = 1190 t->dst.u.tcp.port =
1191 *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_DST_PORT-1]); 1191 *(__be16 *)NFA_DATA(tb[CTA_PROTO_DST_PORT-1]);
1192 1192
1193 return 0; 1193 return 0;
1194} 1194}
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c
index 1d18c863f064..93dcf960662f 100644
--- a/net/ipv4/netfilter/ip_conntrack_ftp.c
+++ b/net/ipv4/netfilter/ip_conntrack_ftp.c
@@ -425,8 +425,8 @@ static int help(struct sk_buff **pskb,
425 exp->tuple.src.u.tcp.port = 0; /* Don't care. */ 425 exp->tuple.src.u.tcp.port = 0; /* Don't care. */
426 exp->tuple.dst.protonum = IPPROTO_TCP; 426 exp->tuple.dst.protonum = IPPROTO_TCP;
427 exp->mask = ((struct ip_conntrack_tuple) 427 exp->mask = ((struct ip_conntrack_tuple)
428 { { 0xFFFFFFFF, { 0 } }, 428 { { htonl(0xFFFFFFFF), { 0 } },
429 { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }}); 429 { htonl(0xFFFFFFFF), { .tcp = { htons(0xFFFF) } }, 0xFF }});
430 430
431 exp->expectfn = NULL; 431 exp->expectfn = NULL;
432 exp->flags = 0; 432 exp->flags = 0;
@@ -488,7 +488,7 @@ static int __init ip_conntrack_ftp_init(void)
488 for (i = 0; i < ports_c; i++) { 488 for (i = 0; i < ports_c; i++) {
489 ftp[i].tuple.src.u.tcp.port = htons(ports[i]); 489 ftp[i].tuple.src.u.tcp.port = htons(ports[i]);
490 ftp[i].tuple.dst.protonum = IPPROTO_TCP; 490 ftp[i].tuple.dst.protonum = IPPROTO_TCP;
491 ftp[i].mask.src.u.tcp.port = 0xFFFF; 491 ftp[i].mask.src.u.tcp.port = htons(0xFFFF);
492 ftp[i].mask.dst.protonum = 0xFF; 492 ftp[i].mask.dst.protonum = 0xFF;
493 ftp[i].max_expected = 1; 493 ftp[i].max_expected = 1;
494 ftp[i].timeout = 5 * 60; /* 5 minutes */ 494 ftp[i].timeout = 5 * 60; /* 5 minutes */
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
index fb0aee691721..a2af5e0c7f99 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
@@ -242,10 +242,10 @@ exp_gre(struct ip_conntrack *ct,
242 exp_orig->tuple.dst.u.gre.key = callid; 242 exp_orig->tuple.dst.u.gre.key = callid;
243 exp_orig->tuple.dst.protonum = IPPROTO_GRE; 243 exp_orig->tuple.dst.protonum = IPPROTO_GRE;
244 244
245 exp_orig->mask.src.ip = 0xffffffff; 245 exp_orig->mask.src.ip = htonl(0xffffffff);
246 exp_orig->mask.src.u.all = 0; 246 exp_orig->mask.src.u.all = 0;
247 exp_orig->mask.dst.u.gre.key = htons(0xffff); 247 exp_orig->mask.dst.u.gre.key = htons(0xffff);
248 exp_orig->mask.dst.ip = 0xffffffff; 248 exp_orig->mask.dst.ip = htonl(0xffffffff);
249 exp_orig->mask.dst.protonum = 0xff; 249 exp_orig->mask.dst.protonum = 0xff;
250 250
251 exp_orig->master = ct; 251 exp_orig->master = ct;
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c
index 44889075f3b2..75f7c3db1619 100644
--- a/net/ipv4/netfilter/ip_conntrack_irc.c
+++ b/net/ipv4/netfilter/ip_conntrack_irc.c
@@ -218,7 +218,8 @@ static int help(struct sk_buff **pskb,
218 IPPROTO_TCP }}); 218 IPPROTO_TCP }});
219 exp->mask = ((struct ip_conntrack_tuple) 219 exp->mask = ((struct ip_conntrack_tuple)
220 { { 0, { 0 } }, 220 { { 0, { 0 } },
221 { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }}); 221 { htonl(0xFFFFFFFF),
222 { .tcp = { htons(0xFFFF) } }, 0xFF }});
222 exp->expectfn = NULL; 223 exp->expectfn = NULL;
223 exp->flags = 0; 224 exp->flags = 0;
224 if (ip_nat_irc_hook) 225 if (ip_nat_irc_hook)
@@ -266,7 +267,7 @@ static int __init ip_conntrack_irc_init(void)
266 hlpr = &irc_helpers[i]; 267 hlpr = &irc_helpers[i];
267 hlpr->tuple.src.u.tcp.port = htons(ports[i]); 268 hlpr->tuple.src.u.tcp.port = htons(ports[i]);
268 hlpr->tuple.dst.protonum = IPPROTO_TCP; 269 hlpr->tuple.dst.protonum = IPPROTO_TCP;
269 hlpr->mask.src.u.tcp.port = 0xFFFF; 270 hlpr->mask.src.u.tcp.port = htons(0xFFFF);
270 hlpr->mask.dst.protonum = 0xFF; 271 hlpr->mask.dst.protonum = 0xFF;
271 hlpr->max_expected = max_dcc_channels; 272 hlpr->max_expected = max_dcc_channels;
272 hlpr->timeout = dcc_timeout; 273 hlpr->timeout = dcc_timeout;
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
index 4adec47aae32..a1d6a89f64aa 100644
--- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
+++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
@@ -78,12 +78,12 @@ static int help(struct sk_buff **pskb,
78 goto out; 78 goto out;
79 79
80 exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; 80 exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple;
81 exp->tuple.src.u.udp.port = ntohs(NMBD_PORT); 81 exp->tuple.src.u.udp.port = htons(NMBD_PORT);
82 82
83 exp->mask.src.ip = mask; 83 exp->mask.src.ip = mask;
84 exp->mask.src.u.udp.port = 0xFFFF; 84 exp->mask.src.u.udp.port = htons(0xFFFF);
85 exp->mask.dst.ip = 0xFFFFFFFF; 85 exp->mask.dst.ip = htonl(0xFFFFFFFF);
86 exp->mask.dst.u.udp.port = 0xFFFF; 86 exp->mask.dst.u.udp.port = htons(0xFFFF);
87 exp->mask.dst.protonum = 0xFF; 87 exp->mask.dst.protonum = 0xFF;
88 88
89 exp->expectfn = NULL; 89 exp->expectfn = NULL;
@@ -115,7 +115,7 @@ static struct ip_conntrack_helper helper = {
115 .src = { 115 .src = {
116 .u = { 116 .u = {
117 .udp = { 117 .udp = {
118 .port = 0xFFFF, 118 .port = __constant_htons(0xFFFF),
119 } 119 }
120 } 120 }
121 }, 121 },
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c
index 52eddea27e93..53b6dffea6c2 100644
--- a/net/ipv4/netfilter/ip_conntrack_netlink.c
+++ b/net/ipv4/netfilter/ip_conntrack_netlink.c
@@ -78,8 +78,8 @@ ctnetlink_dump_tuples_ip(struct sk_buff *skb,
78{ 78{
79 struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP); 79 struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP);
80 80
81 NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t), &tuple->src.ip); 81 NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(__be32), &tuple->src.ip);
82 NFA_PUT(skb, CTA_IP_V4_DST, sizeof(u_int32_t), &tuple->dst.ip); 82 NFA_PUT(skb, CTA_IP_V4_DST, sizeof(__be32), &tuple->dst.ip);
83 83
84 NFA_NEST_END(skb, nest_parms); 84 NFA_NEST_END(skb, nest_parms);
85 85
@@ -110,7 +110,7 @@ ctnetlink_dump_tuples(struct sk_buff *skb,
110static inline int 110static inline int
111ctnetlink_dump_status(struct sk_buff *skb, const struct ip_conntrack *ct) 111ctnetlink_dump_status(struct sk_buff *skb, const struct ip_conntrack *ct)
112{ 112{
113 u_int32_t status = htonl((u_int32_t) ct->status); 113 __be32 status = htonl((u_int32_t) ct->status);
114 NFA_PUT(skb, CTA_STATUS, sizeof(status), &status); 114 NFA_PUT(skb, CTA_STATUS, sizeof(status), &status);
115 return 0; 115 return 0;
116 116
@@ -122,7 +122,7 @@ static inline int
122ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct) 122ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct)
123{ 123{
124 long timeout_l = ct->timeout.expires - jiffies; 124 long timeout_l = ct->timeout.expires - jiffies;
125 u_int32_t timeout; 125 __be32 timeout;
126 126
127 if (timeout_l < 0) 127 if (timeout_l < 0)
128 timeout = 0; 128 timeout = 0;
@@ -192,13 +192,13 @@ ctnetlink_dump_counters(struct sk_buff *skb, const struct ip_conntrack *ct,
192{ 192{
193 enum ctattr_type type = dir ? CTA_COUNTERS_REPLY: CTA_COUNTERS_ORIG; 193 enum ctattr_type type = dir ? CTA_COUNTERS_REPLY: CTA_COUNTERS_ORIG;
194 struct nfattr *nest_count = NFA_NEST(skb, type); 194 struct nfattr *nest_count = NFA_NEST(skb, type);
195 u_int32_t tmp; 195 __be32 tmp;
196 196
197 tmp = htonl(ct->counters[dir].packets); 197 tmp = htonl(ct->counters[dir].packets);
198 NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(u_int32_t), &tmp); 198 NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(__be32), &tmp);
199 199
200 tmp = htonl(ct->counters[dir].bytes); 200 tmp = htonl(ct->counters[dir].bytes);
201 NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(u_int32_t), &tmp); 201 NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(__be32), &tmp);
202 202
203 NFA_NEST_END(skb, nest_count); 203 NFA_NEST_END(skb, nest_count);
204 204
@@ -215,9 +215,9 @@ nfattr_failure:
215static inline int 215static inline int
216ctnetlink_dump_mark(struct sk_buff *skb, const struct ip_conntrack *ct) 216ctnetlink_dump_mark(struct sk_buff *skb, const struct ip_conntrack *ct)
217{ 217{
218 u_int32_t mark = htonl(ct->mark); 218 __be32 mark = htonl(ct->mark);
219 219
220 NFA_PUT(skb, CTA_MARK, sizeof(u_int32_t), &mark); 220 NFA_PUT(skb, CTA_MARK, sizeof(__be32), &mark);
221 return 0; 221 return 0;
222 222
223nfattr_failure: 223nfattr_failure:
@@ -230,8 +230,8 @@ nfattr_failure:
230static inline int 230static inline int
231ctnetlink_dump_id(struct sk_buff *skb, const struct ip_conntrack *ct) 231ctnetlink_dump_id(struct sk_buff *skb, const struct ip_conntrack *ct)
232{ 232{
233 u_int32_t id = htonl(ct->id); 233 __be32 id = htonl(ct->id);
234 NFA_PUT(skb, CTA_ID, sizeof(u_int32_t), &id); 234 NFA_PUT(skb, CTA_ID, sizeof(__be32), &id);
235 return 0; 235 return 0;
236 236
237nfattr_failure: 237nfattr_failure:
@@ -241,9 +241,9 @@ nfattr_failure:
241static inline int 241static inline int
242ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct) 242ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct)
243{ 243{
244 u_int32_t use = htonl(atomic_read(&ct->ct_general.use)); 244 __be32 use = htonl(atomic_read(&ct->ct_general.use));
245 245
246 NFA_PUT(skb, CTA_USE, sizeof(u_int32_t), &use); 246 NFA_PUT(skb, CTA_USE, sizeof(__be32), &use);
247 return 0; 247 return 0;
248 248
249nfattr_failure: 249nfattr_failure:
@@ -457,8 +457,8 @@ out:
457} 457}
458 458
459static const size_t cta_min_ip[CTA_IP_MAX] = { 459static const size_t cta_min_ip[CTA_IP_MAX] = {
460 [CTA_IP_V4_SRC-1] = sizeof(u_int32_t), 460 [CTA_IP_V4_SRC-1] = sizeof(__be32),
461 [CTA_IP_V4_DST-1] = sizeof(u_int32_t), 461 [CTA_IP_V4_DST-1] = sizeof(__be32),
462}; 462};
463 463
464static inline int 464static inline int
@@ -475,11 +475,11 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)
475 475
476 if (!tb[CTA_IP_V4_SRC-1]) 476 if (!tb[CTA_IP_V4_SRC-1])
477 return -EINVAL; 477 return -EINVAL;
478 tuple->src.ip = *(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_SRC-1]); 478 tuple->src.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_SRC-1]);
479 479
480 if (!tb[CTA_IP_V4_DST-1]) 480 if (!tb[CTA_IP_V4_DST-1])
481 return -EINVAL; 481 return -EINVAL;
482 tuple->dst.ip = *(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_DST-1]); 482 tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
483 483
484 DEBUGP("leaving\n"); 484 DEBUGP("leaving\n");
485 485
@@ -602,8 +602,8 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
602} 602}
603 603
604static const size_t cta_min_nat[CTA_NAT_MAX] = { 604static const size_t cta_min_nat[CTA_NAT_MAX] = {
605 [CTA_NAT_MINIP-1] = sizeof(u_int32_t), 605 [CTA_NAT_MINIP-1] = sizeof(__be32),
606 [CTA_NAT_MAXIP-1] = sizeof(u_int32_t), 606 [CTA_NAT_MAXIP-1] = sizeof(__be32),
607}; 607};
608 608
609static inline int 609static inline int
@@ -623,12 +623,12 @@ ctnetlink_parse_nat(struct nfattr *nat,
623 return -EINVAL; 623 return -EINVAL;
624 624
625 if (tb[CTA_NAT_MINIP-1]) 625 if (tb[CTA_NAT_MINIP-1])
626 range->min_ip = *(u_int32_t *)NFA_DATA(tb[CTA_NAT_MINIP-1]); 626 range->min_ip = *(__be32 *)NFA_DATA(tb[CTA_NAT_MINIP-1]);
627 627
628 if (!tb[CTA_NAT_MAXIP-1]) 628 if (!tb[CTA_NAT_MAXIP-1])
629 range->max_ip = range->min_ip; 629 range->max_ip = range->min_ip;
630 else 630 else
631 range->max_ip = *(u_int32_t *)NFA_DATA(tb[CTA_NAT_MAXIP-1]); 631 range->max_ip = *(__be32 *)NFA_DATA(tb[CTA_NAT_MAXIP-1]);
632 632
633 if (range->min_ip) 633 if (range->min_ip)
634 range->flags |= IP_NAT_RANGE_MAP_IPS; 634 range->flags |= IP_NAT_RANGE_MAP_IPS;
@@ -663,11 +663,11 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name)
663} 663}
664 664
665static const size_t cta_min[CTA_MAX] = { 665static const size_t cta_min[CTA_MAX] = {
666 [CTA_STATUS-1] = sizeof(u_int32_t), 666 [CTA_STATUS-1] = sizeof(__be32),
667 [CTA_TIMEOUT-1] = sizeof(u_int32_t), 667 [CTA_TIMEOUT-1] = sizeof(__be32),
668 [CTA_MARK-1] = sizeof(u_int32_t), 668 [CTA_MARK-1] = sizeof(__be32),
669 [CTA_USE-1] = sizeof(u_int32_t), 669 [CTA_USE-1] = sizeof(__be32),
670 [CTA_ID-1] = sizeof(u_int32_t) 670 [CTA_ID-1] = sizeof(__be32)
671}; 671};
672 672
673static int 673static int
@@ -706,7 +706,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
706 ct = tuplehash_to_ctrack(h); 706 ct = tuplehash_to_ctrack(h);
707 707
708 if (cda[CTA_ID-1]) { 708 if (cda[CTA_ID-1]) {
709 u_int32_t id = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_ID-1])); 709 u_int32_t id = ntohl(*(__be32 *)NFA_DATA(cda[CTA_ID-1]));
710 if (ct->id != id) { 710 if (ct->id != id) {
711 ip_conntrack_put(ct); 711 ip_conntrack_put(ct);
712 return -ENOENT; 712 return -ENOENT;
@@ -808,7 +808,7 @@ static inline int
808ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) 808ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[])
809{ 809{
810 unsigned long d; 810 unsigned long d;
811 unsigned status = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1])); 811 unsigned status = ntohl(*(__be32 *)NFA_DATA(cda[CTA_STATUS-1]));
812 d = ct->status ^ status; 812 d = ct->status ^ status;
813 813
814 if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING)) 814 if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING))
@@ -903,7 +903,7 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[])
903static inline int 903static inline int
904ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[]) 904ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[])
905{ 905{
906 u_int32_t timeout = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_TIMEOUT-1])); 906 u_int32_t timeout = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1]));
907 907
908 if (!del_timer(&ct->timeout)) 908 if (!del_timer(&ct->timeout))
909 return -ETIME; 909 return -ETIME;
@@ -966,7 +966,7 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
966 966
967#if defined(CONFIG_IP_NF_CONNTRACK_MARK) 967#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
968 if (cda[CTA_MARK-1]) 968 if (cda[CTA_MARK-1])
969 ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1])); 969 ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1]));
970#endif 970#endif
971 971
972 DEBUGP("all done\n"); 972 DEBUGP("all done\n");
@@ -989,7 +989,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
989 989
990 if (!cda[CTA_TIMEOUT-1]) 990 if (!cda[CTA_TIMEOUT-1])
991 goto err; 991 goto err;
992 ct->timeout.expires = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_TIMEOUT-1])); 992 ct->timeout.expires = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1]));
993 993
994 ct->timeout.expires = jiffies + ct->timeout.expires * HZ; 994 ct->timeout.expires = jiffies + ct->timeout.expires * HZ;
995 ct->status |= IPS_CONFIRMED; 995 ct->status |= IPS_CONFIRMED;
@@ -1006,7 +1006,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
1006 1006
1007#if defined(CONFIG_IP_NF_CONNTRACK_MARK) 1007#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
1008 if (cda[CTA_MARK-1]) 1008 if (cda[CTA_MARK-1])
1009 ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1])); 1009 ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1]));
1010#endif 1010#endif
1011 1011
1012 ct->helper = ip_conntrack_helper_find_get(rtuple); 1012 ct->helper = ip_conntrack_helper_find_get(rtuple);
@@ -1138,8 +1138,8 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb,
1138 const struct ip_conntrack_expect *exp) 1138 const struct ip_conntrack_expect *exp)
1139{ 1139{
1140 struct ip_conntrack *master = exp->master; 1140 struct ip_conntrack *master = exp->master;
1141 u_int32_t timeout = htonl((exp->timeout.expires - jiffies) / HZ); 1141 __be32 timeout = htonl((exp->timeout.expires - jiffies) / HZ);
1142 u_int32_t id = htonl(exp->id); 1142 __be32 id = htonl(exp->id);
1143 1143
1144 if (ctnetlink_exp_dump_tuple(skb, &exp->tuple, CTA_EXPECT_TUPLE) < 0) 1144 if (ctnetlink_exp_dump_tuple(skb, &exp->tuple, CTA_EXPECT_TUPLE) < 0)
1145 goto nfattr_failure; 1145 goto nfattr_failure;
@@ -1150,8 +1150,8 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb,
1150 CTA_EXPECT_MASTER) < 0) 1150 CTA_EXPECT_MASTER) < 0)
1151 goto nfattr_failure; 1151 goto nfattr_failure;
1152 1152
1153 NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(timeout), &timeout); 1153 NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(__be32), &timeout);
1154 NFA_PUT(skb, CTA_EXPECT_ID, sizeof(u_int32_t), &id); 1154 NFA_PUT(skb, CTA_EXPECT_ID, sizeof(__be32), &id);
1155 1155
1156 return 0; 1156 return 0;
1157 1157
@@ -1272,8 +1272,8 @@ out:
1272} 1272}
1273 1273
1274static const size_t cta_min_exp[CTA_EXPECT_MAX] = { 1274static const size_t cta_min_exp[CTA_EXPECT_MAX] = {
1275 [CTA_EXPECT_TIMEOUT-1] = sizeof(u_int32_t), 1275 [CTA_EXPECT_TIMEOUT-1] = sizeof(__be32),
1276 [CTA_EXPECT_ID-1] = sizeof(u_int32_t) 1276 [CTA_EXPECT_ID-1] = sizeof(__be32)
1277}; 1277};
1278 1278
1279static int 1279static int
@@ -1321,7 +1321,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
1321 return -ENOENT; 1321 return -ENOENT;
1322 1322
1323 if (cda[CTA_EXPECT_ID-1]) { 1323 if (cda[CTA_EXPECT_ID-1]) {
1324 u_int32_t id = *(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_ID-1]); 1324 __be32 id = *(__be32 *)NFA_DATA(cda[CTA_EXPECT_ID-1]);
1325 if (exp->id != ntohl(id)) { 1325 if (exp->id != ntohl(id)) {
1326 ip_conntrack_expect_put(exp); 1326 ip_conntrack_expect_put(exp);
1327 return -ENOENT; 1327 return -ENOENT;
@@ -1375,8 +1375,8 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
1375 return -ENOENT; 1375 return -ENOENT;
1376 1376
1377 if (cda[CTA_EXPECT_ID-1]) { 1377 if (cda[CTA_EXPECT_ID-1]) {
1378 u_int32_t id = 1378 __be32 id =
1379 *(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_ID-1]); 1379 *(__be32 *)NFA_DATA(cda[CTA_EXPECT_ID-1]);
1380 if (exp->id != ntohl(id)) { 1380 if (exp->id != ntohl(id)) {
1381 ip_conntrack_expect_put(exp); 1381 ip_conntrack_expect_put(exp);
1382 return -ENOENT; 1382 return -ENOENT;
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
index 09c40ebe3345..295b6fa340db 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
@@ -261,7 +261,7 @@ icmp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
261static int icmp_tuple_to_nfattr(struct sk_buff *skb, 261static int icmp_tuple_to_nfattr(struct sk_buff *skb,
262 const struct ip_conntrack_tuple *t) 262 const struct ip_conntrack_tuple *t)
263{ 263{
264 NFA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(u_int16_t), 264 NFA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(__be16),
265 &t->src.u.icmp.id); 265 &t->src.u.icmp.id);
266 NFA_PUT(skb, CTA_PROTO_ICMP_TYPE, sizeof(u_int8_t), 266 NFA_PUT(skb, CTA_PROTO_ICMP_TYPE, sizeof(u_int8_t),
267 &t->dst.u.icmp.type); 267 &t->dst.u.icmp.type);
@@ -287,7 +287,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[],
287 tuple->dst.u.icmp.code = 287 tuple->dst.u.icmp.code =
288 *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]); 288 *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]);
289 tuple->src.u.icmp.id = 289 tuple->src.u.icmp.id =
290 *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]); 290 *(__be16 *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]);
291 291
292 if (tuple->dst.u.icmp.type >= sizeof(invmap) 292 if (tuple->dst.u.icmp.type >= sizeof(invmap)
293 || !invmap[tuple->dst.u.icmp.type]) 293 || !invmap[tuple->dst.u.icmp.type])
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
index b908a4842e18..2443322e4128 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
@@ -210,7 +210,7 @@ static int sctp_print_conntrack(struct seq_file *s,
210for (offset = skb->nh.iph->ihl * 4 + sizeof(sctp_sctphdr_t), count = 0; \ 210for (offset = skb->nh.iph->ihl * 4 + sizeof(sctp_sctphdr_t), count = 0; \
211 offset < skb->len && \ 211 offset < skb->len && \
212 (sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch)); \ 212 (sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch)); \
213 offset += (htons(sch->length) + 3) & ~3, count++) 213 offset += (ntohs(sch->length) + 3) & ~3, count++)
214 214
215/* Some validity checks to make sure the chunks are fine */ 215/* Some validity checks to make sure the chunks are fine */
216static int do_basic_checks(struct ip_conntrack *conntrack, 216static int do_basic_checks(struct ip_conntrack *conntrack,
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index 03ae9a04cb37..06e4e8a6dd9f 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -519,8 +519,8 @@ static void tcp_sack(const struct sk_buff *skb,
519 519
520 /* Fast path for timestamp-only option */ 520 /* Fast path for timestamp-only option */
521 if (length == TCPOLEN_TSTAMP_ALIGNED*4 521 if (length == TCPOLEN_TSTAMP_ALIGNED*4
522 && *(__u32 *)ptr == 522 && *(__be32 *)ptr ==
523 __constant_ntohl((TCPOPT_NOP << 24) 523 __constant_htonl((TCPOPT_NOP << 24)
524 | (TCPOPT_NOP << 16) 524 | (TCPOPT_NOP << 16)
525 | (TCPOPT_TIMESTAMP << 8) 525 | (TCPOPT_TIMESTAMP << 8)
526 | TCPOLEN_TIMESTAMP)) 526 | TCPOLEN_TIMESTAMP))
@@ -551,7 +551,7 @@ static void tcp_sack(const struct sk_buff *skb,
551 for (i = 0; 551 for (i = 0;
552 i < (opsize - TCPOLEN_SACK_BASE); 552 i < (opsize - TCPOLEN_SACK_BASE);
553 i += TCPOLEN_SACK_PERBLOCK) { 553 i += TCPOLEN_SACK_PERBLOCK) {
554 tmp = ntohl(*((u_int32_t *)(ptr+i)+1)); 554 tmp = ntohl(*((__be32 *)(ptr+i)+1));
555 555
556 if (after(tmp, *sack)) 556 if (after(tmp, *sack))
557 *sack = tmp; 557 *sack = tmp;
diff --git a/net/ipv4/netfilter/ip_conntrack_sip.c b/net/ipv4/netfilter/ip_conntrack_sip.c
index 2893e9c74850..f4f75995a9e4 100644
--- a/net/ipv4/netfilter/ip_conntrack_sip.c
+++ b/net/ipv4/netfilter/ip_conntrack_sip.c
@@ -193,7 +193,7 @@ static int skp_digits_len(const char *dptr, const char *limit, int *shift)
193 193
194/* Simple ipaddr parser.. */ 194/* Simple ipaddr parser.. */
195static int parse_ipaddr(const char *cp, const char **endp, 195static int parse_ipaddr(const char *cp, const char **endp,
196 u_int32_t *ipaddr, const char *limit) 196 __be32 *ipaddr, const char *limit)
197{ 197{
198 unsigned long int val; 198 unsigned long int val;
199 int i, digit = 0; 199 int i, digit = 0;
@@ -227,7 +227,7 @@ static int parse_ipaddr(const char *cp, const char **endp,
227static int epaddr_len(const char *dptr, const char *limit, int *shift) 227static int epaddr_len(const char *dptr, const char *limit, int *shift)
228{ 228{
229 const char *aux = dptr; 229 const char *aux = dptr;
230 u_int32_t ip; 230 __be32 ip;
231 231
232 if (parse_ipaddr(dptr, &dptr, &ip, limit) < 0) { 232 if (parse_ipaddr(dptr, &dptr, &ip, limit) < 0) {
233 DEBUGP("ip: %s parse failed.!\n", dptr); 233 DEBUGP("ip: %s parse failed.!\n", dptr);
@@ -302,7 +302,7 @@ int ct_sip_get_info(const char *dptr, size_t dlen,
302static int set_expected_rtp(struct sk_buff **pskb, 302static int set_expected_rtp(struct sk_buff **pskb,
303 struct ip_conntrack *ct, 303 struct ip_conntrack *ct,
304 enum ip_conntrack_info ctinfo, 304 enum ip_conntrack_info ctinfo,
305 u_int32_t ipaddr, u_int16_t port, 305 __be32 ipaddr, u_int16_t port,
306 const char *dptr) 306 const char *dptr)
307{ 307{
308 struct ip_conntrack_expect *exp; 308 struct ip_conntrack_expect *exp;
@@ -319,10 +319,10 @@ static int set_expected_rtp(struct sk_buff **pskb,
319 exp->tuple.dst.u.udp.port = htons(port); 319 exp->tuple.dst.u.udp.port = htons(port);
320 exp->tuple.dst.protonum = IPPROTO_UDP; 320 exp->tuple.dst.protonum = IPPROTO_UDP;
321 321
322 exp->mask.src.ip = 0xFFFFFFFF; 322 exp->mask.src.ip = htonl(0xFFFFFFFF);
323 exp->mask.src.u.udp.port = 0; 323 exp->mask.src.u.udp.port = 0;
324 exp->mask.dst.ip = 0xFFFFFFFF; 324 exp->mask.dst.ip = htonl(0xFFFFFFFF);
325 exp->mask.dst.u.udp.port = 0xFFFF; 325 exp->mask.dst.u.udp.port = htons(0xFFFF);
326 exp->mask.dst.protonum = 0xFF; 326 exp->mask.dst.protonum = 0xFF;
327 327
328 exp->expectfn = NULL; 328 exp->expectfn = NULL;
@@ -349,7 +349,7 @@ static int sip_help(struct sk_buff **pskb,
349 const char *dptr; 349 const char *dptr;
350 int ret = NF_ACCEPT; 350 int ret = NF_ACCEPT;
351 int matchoff, matchlen; 351 int matchoff, matchlen;
352 u_int32_t ipaddr; 352 __be32 ipaddr;
353 u_int16_t port; 353 u_int16_t port;
354 354
355 /* No Data ? */ 355 /* No Data ? */
@@ -439,7 +439,7 @@ static int __init init(void)
439 439
440 sip[i].tuple.dst.protonum = IPPROTO_UDP; 440 sip[i].tuple.dst.protonum = IPPROTO_UDP;
441 sip[i].tuple.src.u.udp.port = htons(ports[i]); 441 sip[i].tuple.src.u.udp.port = htons(ports[i]);
442 sip[i].mask.src.u.udp.port = 0xFFFF; 442 sip[i].mask.src.u.udp.port = htons(0xFFFF);
443 sip[i].mask.dst.protonum = 0xFF; 443 sip[i].mask.dst.protonum = 0xFF;
444 sip[i].max_expected = 2; 444 sip[i].max_expected = 2;
445 sip[i].timeout = 3 * 60; /* 3 minutes */ 445 sip[i].timeout = 3 * 60; /* 3 minutes */
diff --git a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c
index 7e33d3bed5e3..fe0b634dd377 100644
--- a/net/ipv4/netfilter/ip_conntrack_tftp.c
+++ b/net/ipv4/netfilter/ip_conntrack_tftp.c
@@ -70,10 +70,10 @@ static int tftp_help(struct sk_buff **pskb,
70 return NF_DROP; 70 return NF_DROP;
71 71
72 exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; 72 exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple;
73 exp->mask.src.ip = 0xffffffff; 73 exp->mask.src.ip = htonl(0xffffffff);
74 exp->mask.src.u.udp.port = 0; 74 exp->mask.src.u.udp.port = 0;
75 exp->mask.dst.ip = 0xffffffff; 75 exp->mask.dst.ip = htonl(0xffffffff);
76 exp->mask.dst.u.udp.port = 0xffff; 76 exp->mask.dst.u.udp.port = htons(0xffff);
77 exp->mask.dst.protonum = 0xff; 77 exp->mask.dst.protonum = 0xff;
78 exp->expectfn = NULL; 78 exp->expectfn = NULL;
79 exp->flags = 0; 79 exp->flags = 0;
@@ -129,7 +129,7 @@ static int __init ip_conntrack_tftp_init(void)
129 tftp[i].tuple.dst.protonum = IPPROTO_UDP; 129 tftp[i].tuple.dst.protonum = IPPROTO_UDP;
130 tftp[i].tuple.src.u.udp.port = htons(ports[i]); 130 tftp[i].tuple.src.u.udp.port = htons(ports[i]);
131 tftp[i].mask.dst.protonum = 0xFF; 131 tftp[i].mask.dst.protonum = 0xFF;
132 tftp[i].mask.src.u.udp.port = 0xFFFF; 132 tftp[i].mask.src.u.udp.port = htons(0xFFFF);
133 tftp[i].max_expected = 1; 133 tftp[i].max_expected = 1;
134 tftp[i].timeout = 5 * 60; /* 5 minutes */ 134 tftp[i].timeout = 5 * 60; /* 5 minutes */
135 tftp[i].me = THIS_MODULE; 135 tftp[i].me = THIS_MODULE;