diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-09-21 15:44:58 -0400 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-09-21 15:51:22 -0400 |
commit | 6e27c9b4ee8f348770be5751e6a845ff52a31e19 (patch) | |
tree | c82f4b8f3d988a24c9abc8514a3b06b6a874a390 | |
parent | 2cbc78a29e76a2e92c172651204f3117491877d2 (diff) |
netfilter: ipset: Fix sparse warnings "incorrect type in assignment"
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ip.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipport.c | 13 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipportip.c | 13 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipportnet.c | 21 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_net.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_netiface.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_netport.c | 13 |
7 files changed, 39 insertions, 33 deletions
diff --git a/net/netfilter/ipset/ip_set_hash_ip.c b/net/netfilter/ipset/ip_set_hash_ip.c index a68dbd4f1e4e..42bccd58cbc6 100644 --- a/net/netfilter/ipset/ip_set_hash_ip.c +++ b/net/netfilter/ipset/ip_set_hash_ip.c | |||
@@ -114,7 +114,7 @@ nla_put_failure: | |||
114 | static inline void | 114 | static inline void |
115 | hash_ip4_data_next(struct ip_set_hash *h, const struct hash_ip4_elem *d) | 115 | hash_ip4_data_next(struct ip_set_hash *h, const struct hash_ip4_elem *d) |
116 | { | 116 | { |
117 | h->next.ip = ntohl(d->ip); | 117 | h->next.ip = d->ip; |
118 | } | 118 | } |
119 | 119 | ||
120 | static int | 120 | static int |
@@ -188,7 +188,7 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
188 | hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1); | 188 | hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1); |
189 | 189 | ||
190 | if (retried) | 190 | if (retried) |
191 | ip = h->next.ip; | 191 | ip = ntohl(h->next.ip); |
192 | for (; !before(ip_to, ip); ip += hosts) { | 192 | for (; !before(ip_to, ip); ip += hosts) { |
193 | nip = htonl(ip); | 193 | nip = htonl(ip); |
194 | if (nip == 0) | 194 | if (nip == 0) |
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c index 92722bb82eea..e0ce0daefac1 100644 --- a/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/net/netfilter/ipset/ip_set_hash_ipport.c | |||
@@ -130,8 +130,8 @@ static inline void | |||
130 | hash_ipport4_data_next(struct ip_set_hash *h, | 130 | hash_ipport4_data_next(struct ip_set_hash *h, |
131 | const struct hash_ipport4_elem *d) | 131 | const struct hash_ipport4_elem *d) |
132 | { | 132 | { |
133 | h->next.ip = ntohl(d->ip); | 133 | h->next.ip = d->ip; |
134 | h->next.port = ntohs(d->port); | 134 | h->next.port = d->port; |
135 | } | 135 | } |
136 | 136 | ||
137 | static int | 137 | static int |
@@ -231,9 +231,10 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
231 | } | 231 | } |
232 | 232 | ||
233 | if (retried) | 233 | if (retried) |
234 | ip = h->next.ip; | 234 | ip = ntohl(h->next.ip); |
235 | for (; !before(ip_to, ip); ip++) { | 235 | for (; !before(ip_to, ip); ip++) { |
236 | p = retried && ip == h->next.ip ? h->next.port : port; | 236 | p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port) |
237 | : port; | ||
237 | for (; p <= port_to; p++) { | 238 | for (; p <= port_to; p++) { |
238 | data.ip = htonl(ip); | 239 | data.ip = htonl(ip); |
239 | data.port = htons(p); | 240 | data.port = htons(p); |
@@ -349,7 +350,7 @@ static inline void | |||
349 | hash_ipport6_data_next(struct ip_set_hash *h, | 350 | hash_ipport6_data_next(struct ip_set_hash *h, |
350 | const struct hash_ipport6_elem *d) | 351 | const struct hash_ipport6_elem *d) |
351 | { | 352 | { |
352 | h->next.port = ntohs(d->port); | 353 | h->next.port = d->port; |
353 | } | 354 | } |
354 | 355 | ||
355 | static int | 356 | static int |
@@ -431,7 +432,7 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[], | |||
431 | swap(port, port_to); | 432 | swap(port, port_to); |
432 | 433 | ||
433 | if (retried) | 434 | if (retried) |
434 | port = h->next.port; | 435 | port = ntohs(h->next.port); |
435 | for (; port <= port_to; port++) { | 436 | for (; port <= port_to; port++) { |
436 | data.port = htons(port); | 437 | data.port = htons(port); |
437 | ret = adtfn(set, &data, timeout, flags); | 438 | ret = adtfn(set, &data, timeout, flags); |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c index 0637ce096def..c864bf40e6be 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/net/netfilter/ipset/ip_set_hash_ipportip.c | |||
@@ -133,8 +133,8 @@ static inline void | |||
133 | hash_ipportip4_data_next(struct ip_set_hash *h, | 133 | hash_ipportip4_data_next(struct ip_set_hash *h, |
134 | const struct hash_ipportip4_elem *d) | 134 | const struct hash_ipportip4_elem *d) |
135 | { | 135 | { |
136 | h->next.ip = ntohl(d->ip); | 136 | h->next.ip = d->ip; |
137 | h->next.port = ntohs(d->port); | 137 | h->next.port = d->port; |
138 | } | 138 | } |
139 | 139 | ||
140 | static int | 140 | static int |
@@ -239,9 +239,10 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
239 | } | 239 | } |
240 | 240 | ||
241 | if (retried) | 241 | if (retried) |
242 | ip = h->next.ip; | 242 | ip = ntohl(h->next.ip); |
243 | for (; !before(ip_to, ip); ip++) { | 243 | for (; !before(ip_to, ip); ip++) { |
244 | p = retried && ip == h->next.ip ? h->next.port : port; | 244 | p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port) |
245 | : port; | ||
245 | for (; p <= port_to; p++) { | 246 | for (; p <= port_to; p++) { |
246 | data.ip = htonl(ip); | 247 | data.ip = htonl(ip); |
247 | data.port = htons(p); | 248 | data.port = htons(p); |
@@ -362,7 +363,7 @@ static inline void | |||
362 | hash_ipportip6_data_next(struct ip_set_hash *h, | 363 | hash_ipportip6_data_next(struct ip_set_hash *h, |
363 | const struct hash_ipportip6_elem *d) | 364 | const struct hash_ipportip6_elem *d) |
364 | { | 365 | { |
365 | h->next.port = ntohs(d->port); | 366 | h->next.port = d->port; |
366 | } | 367 | } |
367 | 368 | ||
368 | static int | 369 | static int |
@@ -449,7 +450,7 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[], | |||
449 | swap(port, port_to); | 450 | swap(port, port_to); |
450 | 451 | ||
451 | if (retried) | 452 | if (retried) |
452 | port = h->next.port; | 453 | port = ntohs(h->next.port); |
453 | for (; port <= port_to; port++) { | 454 | for (; port <= port_to; port++) { |
454 | data.port = htons(port); | 455 | data.port = htons(port); |
455 | ret = adtfn(set, &data, timeout, flags); | 456 | ret = adtfn(set, &data, timeout, flags); |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index 1ce21ca976e1..2c704bb3cff1 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
@@ -173,9 +173,9 @@ static inline void | |||
173 | hash_ipportnet4_data_next(struct ip_set_hash *h, | 173 | hash_ipportnet4_data_next(struct ip_set_hash *h, |
174 | const struct hash_ipportnet4_elem *d) | 174 | const struct hash_ipportnet4_elem *d) |
175 | { | 175 | { |
176 | h->next.ip = ntohl(d->ip); | 176 | h->next.ip = d->ip; |
177 | h->next.port = ntohs(d->port); | 177 | h->next.port = d->port; |
178 | h->next.ip2 = ntohl(d->ip2); | 178 | h->next.ip2 = d->ip2; |
179 | } | 179 | } |
180 | 180 | ||
181 | static int | 181 | static int |
@@ -314,14 +314,17 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
314 | } | 314 | } |
315 | 315 | ||
316 | if (retried) | 316 | if (retried) |
317 | ip = h->next.ip; | 317 | ip = ntohl(h->next.ip); |
318 | for (; !before(ip_to, ip); ip++) { | 318 | for (; !before(ip_to, ip); ip++) { |
319 | data.ip = htonl(ip); | 319 | data.ip = htonl(ip); |
320 | p = retried && ip == h->next.ip ? h->next.port : port; | 320 | p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port) |
321 | : port; | ||
321 | for (; p <= port_to; p++) { | 322 | for (; p <= port_to; p++) { |
322 | data.port = htons(p); | 323 | data.port = htons(p); |
323 | ip2 = retried && ip == h->next.ip && p == h->next.port | 324 | ip2 = retried |
324 | ? h->next.ip2 : ip2_from; | 325 | && ip == ntohl(h->next.ip) |
326 | && p == ntohs(h->next.port) | ||
327 | ? ntohl(h->next.ip2) : ip2_from; | ||
325 | while (!after(ip2, ip2_to)) { | 328 | while (!after(ip2, ip2_to)) { |
326 | data.ip2 = htonl(ip2); | 329 | data.ip2 = htonl(ip2); |
327 | ip2_last = ip_set_range_to_cidr(ip2, ip2_to, | 330 | ip2_last = ip_set_range_to_cidr(ip2, ip2_to, |
@@ -486,7 +489,7 @@ static inline void | |||
486 | hash_ipportnet6_data_next(struct ip_set_hash *h, | 489 | hash_ipportnet6_data_next(struct ip_set_hash *h, |
487 | const struct hash_ipportnet6_elem *d) | 490 | const struct hash_ipportnet6_elem *d) |
488 | { | 491 | { |
489 | h->next.port = ntohs(d->port); | 492 | h->next.port = d->port; |
490 | } | 493 | } |
491 | 494 | ||
492 | static int | 495 | static int |
@@ -598,7 +601,7 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[], | |||
598 | swap(port, port_to); | 601 | swap(port, port_to); |
599 | 602 | ||
600 | if (retried) | 603 | if (retried) |
601 | port = h->next.port; | 604 | port = ntohs(h->next.port); |
602 | for (; port <= port_to; port++) { | 605 | for (; port <= port_to; port++) { |
603 | data.port = htons(port); | 606 | data.port = htons(port); |
604 | ret = adtfn(set, &data, timeout, flags); | 607 | ret = adtfn(set, &data, timeout, flags); |
diff --git a/net/netfilter/ipset/ip_set_hash_net.c b/net/netfilter/ipset/ip_set_hash_net.c index c57a6a09906d..d676093822b1 100644 --- a/net/netfilter/ipset/ip_set_hash_net.c +++ b/net/netfilter/ipset/ip_set_hash_net.c | |||
@@ -152,7 +152,7 @@ static inline void | |||
152 | hash_net4_data_next(struct ip_set_hash *h, | 152 | hash_net4_data_next(struct ip_set_hash *h, |
153 | const struct hash_net4_elem *d) | 153 | const struct hash_net4_elem *d) |
154 | { | 154 | { |
155 | h->next.ip = ntohl(d->ip); | 155 | h->next.ip = d->ip; |
156 | } | 156 | } |
157 | 157 | ||
158 | static int | 158 | static int |
@@ -235,7 +235,7 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
235 | return -IPSET_ERR_HASH_RANGE; | 235 | return -IPSET_ERR_HASH_RANGE; |
236 | } | 236 | } |
237 | if (retried) | 237 | if (retried) |
238 | ip = h->next.ip; | 238 | ip = ntohl(h->next.ip); |
239 | while (!after(ip, ip_to)) { | 239 | while (!after(ip, ip_to)) { |
240 | data.ip = htonl(ip); | 240 | data.ip = htonl(ip); |
241 | last = ip_set_range_to_cidr(ip, ip_to, &data.cidr); | 241 | last = ip_set_range_to_cidr(ip, ip_to, &data.cidr); |
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c index d5d3607ae7bc..632693f0beeb 100644 --- a/net/netfilter/ipset/ip_set_hash_netiface.c +++ b/net/netfilter/ipset/ip_set_hash_netiface.c | |||
@@ -277,7 +277,7 @@ static inline void | |||
277 | hash_netiface4_data_next(struct ip_set_hash *h, | 277 | hash_netiface4_data_next(struct ip_set_hash *h, |
278 | const struct hash_netiface4_elem *d) | 278 | const struct hash_netiface4_elem *d) |
279 | { | 279 | { |
280 | h->next.ip = ntohl(d->ip); | 280 | h->next.ip = d->ip; |
281 | } | 281 | } |
282 | 282 | ||
283 | static int | 283 | static int |
@@ -409,7 +409,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
409 | } | 409 | } |
410 | 410 | ||
411 | if (retried) | 411 | if (retried) |
412 | ip = h->next.ip; | 412 | ip = ntohl(h->next.ip); |
413 | while (!after(ip, ip_to)) { | 413 | while (!after(ip, ip_to)) { |
414 | data.ip = htonl(ip); | 414 | data.ip = htonl(ip); |
415 | last = ip_set_range_to_cidr(ip, ip_to, &data.cidr); | 415 | last = ip_set_range_to_cidr(ip, ip_to, &data.cidr); |
diff --git a/net/netfilter/ipset/ip_set_hash_netport.c b/net/netfilter/ipset/ip_set_hash_netport.c index fc3143a2d41b..3ec27fccddd7 100644 --- a/net/netfilter/ipset/ip_set_hash_netport.c +++ b/net/netfilter/ipset/ip_set_hash_netport.c | |||
@@ -171,8 +171,8 @@ static inline void | |||
171 | hash_netport4_data_next(struct ip_set_hash *h, | 171 | hash_netport4_data_next(struct ip_set_hash *h, |
172 | const struct hash_netport4_elem *d) | 172 | const struct hash_netport4_elem *d) |
173 | { | 173 | { |
174 | h->next.ip = ntohl(d->ip); | 174 | h->next.ip = d->ip; |
175 | h->next.port = ntohs(d->port); | 175 | h->next.port = d->port; |
176 | } | 176 | } |
177 | 177 | ||
178 | static int | 178 | static int |
@@ -289,12 +289,13 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
289 | } | 289 | } |
290 | 290 | ||
291 | if (retried) | 291 | if (retried) |
292 | ip = h->next.ip; | 292 | ip = ntohl(h->next.ip); |
293 | while (!after(ip, ip_to)) { | 293 | while (!after(ip, ip_to)) { |
294 | data.ip = htonl(ip); | 294 | data.ip = htonl(ip); |
295 | last = ip_set_range_to_cidr(ip, ip_to, &cidr); | 295 | last = ip_set_range_to_cidr(ip, ip_to, &cidr); |
296 | data.cidr = cidr - 1; | 296 | data.cidr = cidr - 1; |
297 | p = retried && ip == h->next.ip ? h->next.port : port; | 297 | p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port) |
298 | : port; | ||
298 | for (; p <= port_to; p++) { | 299 | for (; p <= port_to; p++) { |
299 | data.port = htons(p); | 300 | data.port = htons(p); |
300 | ret = adtfn(set, &data, timeout, flags); | 301 | ret = adtfn(set, &data, timeout, flags); |
@@ -450,7 +451,7 @@ static inline void | |||
450 | hash_netport6_data_next(struct ip_set_hash *h, | 451 | hash_netport6_data_next(struct ip_set_hash *h, |
451 | const struct hash_netport6_elem *d) | 452 | const struct hash_netport6_elem *d) |
452 | { | 453 | { |
453 | h->next.port = ntohs(d->port); | 454 | h->next.port = d->port; |
454 | } | 455 | } |
455 | 456 | ||
456 | static int | 457 | static int |
@@ -554,7 +555,7 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *tb[], | |||
554 | swap(port, port_to); | 555 | swap(port, port_to); |
555 | 556 | ||
556 | if (retried) | 557 | if (retried) |
557 | port = h->next.port; | 558 | port = ntohs(h->next.port); |
558 | for (; port <= port_to; port++) { | 559 | for (; port <= port_to; port++) { |
559 | data.port = htons(port); | 560 | data.port = htons(port); |
560 | ret = adtfn(set, &data, timeout, flags); | 561 | ret = adtfn(set, &data, timeout, flags); |