diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 02:03:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 02:03:42 -0400 |
commit | 3dcbbcda7c5b77c400791b26facd6593c5b176e0 (patch) | |
tree | 2e7b844c4d450cf43810a6ed0ddd5c702c245a88 /net/ipv4 | |
parent | c972398b7871d9fb58c6a317786065a7cc6ca4be (diff) | |
parent | 6fbe59b9569b2c8d5522d182263935c6c86fc40a (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (160 commits)
[ETHTOOL]: Remove some entries from non-root command list.
[Bluetooth]: Fix section mismatch of bt_sysfs_cleanup()
[Bluetooth]: Don't update disconnect timer for incoming connections
[ETHTOOL]: let mortals use ethtool
[NetLabel]: add audit support for configuration changes
[TCP]: Fix and simplify microsecond rtt sampling
[TCP] tcp-lp: prevent chance for oops
[SUNRPC]: Remove unnecessary check in net/sunrpc/svcsock.c
[IPVS] bug: endianness breakage in ip_vs_ftp
[IPVS]: ipvs annotations
[NETFILTER]: h323 annotations
[NETFILTER]: ipt annotations
[NETFILTER]: NAT annotations
[NETFILTER]: conntrack annotations
[NETFILTER]: netfilter misc annotations
[NET]: Annotate dst_ops protocol
[NET]: is it Andy or Andi ??
[IPVS]: Make sure ip_vs_ftp ports are valid: module_param_array approach
[IPVS]: Reverse valid ip_vs_ftp ports fix: port check approach
[IrDA] stir4200: removing undocumented bits handling
...
Diffstat (limited to 'net/ipv4')
88 files changed, 631 insertions, 631 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index fdd89e37b9aa..edcf0932ac6d 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -996,7 +996,7 @@ static int inet_sk_reselect_saddr(struct sock *sk) | |||
996 | struct rtable *rt; | 996 | struct rtable *rt; |
997 | __u32 old_saddr = inet->saddr; | 997 | __u32 old_saddr = inet->saddr; |
998 | __u32 new_saddr; | 998 | __u32 new_saddr; |
999 | __u32 daddr = inet->daddr; | 999 | __be32 daddr = inet->daddr; |
1000 | 1000 | ||
1001 | if (inet->opt && inet->opt->srr) | 1001 | if (inet->opt && inet->opt->srr) |
1002 | daddr = inet->opt->faddr; | 1002 | daddr = inet->opt->faddr; |
@@ -1043,7 +1043,7 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1043 | { | 1043 | { |
1044 | struct inet_sock *inet = inet_sk(sk); | 1044 | struct inet_sock *inet = inet_sk(sk); |
1045 | struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); | 1045 | struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); |
1046 | u32 daddr; | 1046 | __be32 daddr; |
1047 | int err; | 1047 | int err; |
1048 | 1048 | ||
1049 | /* Route is OK, nothing to do. */ | 1049 | /* Route is OK, nothing to do. */ |
@@ -1342,10 +1342,10 @@ static int __init inet_init(void) | |||
1342 | rc = 0; | 1342 | rc = 0; |
1343 | out: | 1343 | out: |
1344 | return rc; | 1344 | return rc; |
1345 | out_unregister_tcp_proto: | ||
1346 | proto_unregister(&tcp_prot); | ||
1347 | out_unregister_udp_proto: | 1345 | out_unregister_udp_proto: |
1348 | proto_unregister(&udp_prot); | 1346 | proto_unregister(&udp_prot); |
1347 | out_unregister_tcp_proto: | ||
1348 | proto_unregister(&tcp_prot); | ||
1349 | goto out; | 1349 | goto out; |
1350 | } | 1350 | } |
1351 | 1351 | ||
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index c8a3723bc001..cfe5c8474286 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -234,7 +234,7 @@ static u32 arp_hash(const void *pkey, const struct net_device *dev) | |||
234 | 234 | ||
235 | static int arp_constructor(struct neighbour *neigh) | 235 | static int arp_constructor(struct neighbour *neigh) |
236 | { | 236 | { |
237 | u32 addr = *(u32*)neigh->primary_key; | 237 | __be32 addr = *(__be32*)neigh->primary_key; |
238 | struct net_device *dev = neigh->dev; | 238 | struct net_device *dev = neigh->dev; |
239 | struct in_device *in_dev; | 239 | struct in_device *in_dev; |
240 | struct neigh_parms *parms; | 240 | struct neigh_parms *parms; |
@@ -330,10 +330,10 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb) | |||
330 | 330 | ||
331 | static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | 331 | static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) |
332 | { | 332 | { |
333 | u32 saddr = 0; | 333 | __be32 saddr = 0; |
334 | u8 *dst_ha = NULL; | 334 | u8 *dst_ha = NULL; |
335 | struct net_device *dev = neigh->dev; | 335 | struct net_device *dev = neigh->dev; |
336 | u32 target = *(u32*)neigh->primary_key; | 336 | __be32 target = *(__be32*)neigh->primary_key; |
337 | int probes = atomic_read(&neigh->probes); | 337 | int probes = atomic_read(&neigh->probes); |
338 | struct in_device *in_dev = in_dev_get(dev); | 338 | struct in_device *in_dev = in_dev_get(dev); |
339 | 339 | ||
@@ -385,7 +385,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
385 | } | 385 | } |
386 | 386 | ||
387 | static int arp_ignore(struct in_device *in_dev, struct net_device *dev, | 387 | static int arp_ignore(struct in_device *in_dev, struct net_device *dev, |
388 | u32 sip, u32 tip) | 388 | __be32 sip, __be32 tip) |
389 | { | 389 | { |
390 | int scope; | 390 | int scope; |
391 | 391 | ||
@@ -420,7 +420,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev, | |||
420 | return !inet_confirm_addr(dev, sip, tip, scope); | 420 | return !inet_confirm_addr(dev, sip, tip, scope); |
421 | } | 421 | } |
422 | 422 | ||
423 | static int arp_filter(__u32 sip, __u32 tip, struct net_device *dev) | 423 | static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) |
424 | { | 424 | { |
425 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, | 425 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, |
426 | .saddr = tip } } }; | 426 | .saddr = tip } } }; |
@@ -449,7 +449,7 @@ static int arp_filter(__u32 sip, __u32 tip, struct net_device *dev) | |||
449 | * is allowed to use this function, it is scheduled to be removed. --ANK | 449 | * is allowed to use this function, it is scheduled to be removed. --ANK |
450 | */ | 450 | */ |
451 | 451 | ||
452 | static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, struct net_device * dev) | 452 | static int arp_set_predefined(int addr_hint, unsigned char * haddr, __be32 paddr, struct net_device * dev) |
453 | { | 453 | { |
454 | switch (addr_hint) { | 454 | switch (addr_hint) { |
455 | case RTN_LOCAL: | 455 | case RTN_LOCAL: |
@@ -470,7 +470,7 @@ static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, s | |||
470 | int arp_find(unsigned char *haddr, struct sk_buff *skb) | 470 | int arp_find(unsigned char *haddr, struct sk_buff *skb) |
471 | { | 471 | { |
472 | struct net_device *dev = skb->dev; | 472 | struct net_device *dev = skb->dev; |
473 | u32 paddr; | 473 | __be32 paddr; |
474 | struct neighbour *n; | 474 | struct neighbour *n; |
475 | 475 | ||
476 | if (!skb->dst) { | 476 | if (!skb->dst) { |
@@ -511,7 +511,7 @@ int arp_bind_neighbour(struct dst_entry *dst) | |||
511 | if (dev == NULL) | 511 | if (dev == NULL) |
512 | return -EINVAL; | 512 | return -EINVAL; |
513 | if (n == NULL) { | 513 | if (n == NULL) { |
514 | u32 nexthop = ((struct rtable*)dst)->rt_gateway; | 514 | __be32 nexthop = ((struct rtable*)dst)->rt_gateway; |
515 | if (dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT)) | 515 | if (dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT)) |
516 | nexthop = 0; | 516 | nexthop = 0; |
517 | n = __neigh_lookup_errno( | 517 | n = __neigh_lookup_errno( |
@@ -560,8 +560,8 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, struct rtable *rt) | |||
560 | * Create an arp packet. If (dest_hw == NULL), we create a broadcast | 560 | * Create an arp packet. If (dest_hw == NULL), we create a broadcast |
561 | * message. | 561 | * message. |
562 | */ | 562 | */ |
563 | struct sk_buff *arp_create(int type, int ptype, u32 dest_ip, | 563 | struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, |
564 | struct net_device *dev, u32 src_ip, | 564 | struct net_device *dev, __be32 src_ip, |
565 | unsigned char *dest_hw, unsigned char *src_hw, | 565 | unsigned char *dest_hw, unsigned char *src_hw, |
566 | unsigned char *target_hw) | 566 | unsigned char *target_hw) |
567 | { | 567 | { |
@@ -675,8 +675,8 @@ void arp_xmit(struct sk_buff *skb) | |||
675 | /* | 675 | /* |
676 | * Create and send an arp packet. | 676 | * Create and send an arp packet. |
677 | */ | 677 | */ |
678 | void arp_send(int type, int ptype, u32 dest_ip, | 678 | void arp_send(int type, int ptype, __be32 dest_ip, |
679 | struct net_device *dev, u32 src_ip, | 679 | struct net_device *dev, __be32 src_ip, |
680 | unsigned char *dest_hw, unsigned char *src_hw, | 680 | unsigned char *dest_hw, unsigned char *src_hw, |
681 | unsigned char *target_hw) | 681 | unsigned char *target_hw) |
682 | { | 682 | { |
@@ -710,7 +710,7 @@ static int arp_process(struct sk_buff *skb) | |||
710 | unsigned char *arp_ptr; | 710 | unsigned char *arp_ptr; |
711 | struct rtable *rt; | 711 | struct rtable *rt; |
712 | unsigned char *sha, *tha; | 712 | unsigned char *sha, *tha; |
713 | u32 sip, tip; | 713 | __be32 sip, tip; |
714 | u16 dev_type = dev->type; | 714 | u16 dev_type = dev->type; |
715 | int addr_type; | 715 | int addr_type; |
716 | struct neighbour *n; | 716 | struct neighbour *n; |
@@ -969,13 +969,13 @@ out_of_mem: | |||
969 | 969 | ||
970 | static int arp_req_set(struct arpreq *r, struct net_device * dev) | 970 | static int arp_req_set(struct arpreq *r, struct net_device * dev) |
971 | { | 971 | { |
972 | u32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; | 972 | __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; |
973 | struct neighbour *neigh; | 973 | struct neighbour *neigh; |
974 | int err; | 974 | int err; |
975 | 975 | ||
976 | if (r->arp_flags&ATF_PUBL) { | 976 | if (r->arp_flags&ATF_PUBL) { |
977 | u32 mask = ((struct sockaddr_in *) &r->arp_netmask)->sin_addr.s_addr; | 977 | __be32 mask = ((struct sockaddr_in *) &r->arp_netmask)->sin_addr.s_addr; |
978 | if (mask && mask != 0xFFFFFFFF) | 978 | if (mask && mask != htonl(0xFFFFFFFF)) |
979 | return -EINVAL; | 979 | return -EINVAL; |
980 | if (!dev && (r->arp_flags & ATF_COM)) { | 980 | if (!dev && (r->arp_flags & ATF_COM)) { |
981 | dev = dev_getbyhwaddr(r->arp_ha.sa_family, r->arp_ha.sa_data); | 981 | dev = dev_getbyhwaddr(r->arp_ha.sa_family, r->arp_ha.sa_data); |
@@ -1063,7 +1063,7 @@ static unsigned arp_state_to_flags(struct neighbour *neigh) | |||
1063 | 1063 | ||
1064 | static int arp_req_get(struct arpreq *r, struct net_device *dev) | 1064 | static int arp_req_get(struct arpreq *r, struct net_device *dev) |
1065 | { | 1065 | { |
1066 | u32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; | 1066 | __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; |
1067 | struct neighbour *neigh; | 1067 | struct neighbour *neigh; |
1068 | int err = -ENXIO; | 1068 | int err = -ENXIO; |
1069 | 1069 | ||
@@ -1084,13 +1084,13 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) | |||
1084 | static int arp_req_delete(struct arpreq *r, struct net_device * dev) | 1084 | static int arp_req_delete(struct arpreq *r, struct net_device * dev) |
1085 | { | 1085 | { |
1086 | int err; | 1086 | int err; |
1087 | u32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; | 1087 | __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; |
1088 | struct neighbour *neigh; | 1088 | struct neighbour *neigh; |
1089 | 1089 | ||
1090 | if (r->arp_flags & ATF_PUBL) { | 1090 | if (r->arp_flags & ATF_PUBL) { |
1091 | u32 mask = | 1091 | __be32 mask = |
1092 | ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; | 1092 | ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; |
1093 | if (mask == 0xFFFFFFFF) | 1093 | if (mask == htonl(0xFFFFFFFF)) |
1094 | return pneigh_delete(&arp_tbl, &ip, dev); | 1094 | return pneigh_delete(&arp_tbl, &ip, dev); |
1095 | if (mask == 0) { | 1095 | if (mask == 0) { |
1096 | if (dev == NULL) { | 1096 | if (dev == NULL) { |
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index e6ce0b3ba62a..c4e469ff842d 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -474,6 +474,7 @@ doi_add_failure_rlock: | |||
474 | /** | 474 | /** |
475 | * cipso_v4_doi_remove - Remove an existing DOI from the CIPSO protocol engine | 475 | * cipso_v4_doi_remove - Remove an existing DOI from the CIPSO protocol engine |
476 | * @doi: the DOI value | 476 | * @doi: the DOI value |
477 | * @audit_secid: the LSM secid to use in the audit message | ||
477 | * @callback: the DOI cleanup/free callback | 478 | * @callback: the DOI cleanup/free callback |
478 | * | 479 | * |
479 | * Description: | 480 | * Description: |
@@ -483,7 +484,9 @@ doi_add_failure_rlock: | |||
483 | * success and negative values on failure. | 484 | * success and negative values on failure. |
484 | * | 485 | * |
485 | */ | 486 | */ |
486 | int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)) | 487 | int cipso_v4_doi_remove(u32 doi, |
488 | u32 audit_secid, | ||
489 | void (*callback) (struct rcu_head * head)) | ||
487 | { | 490 | { |
488 | struct cipso_v4_doi *doi_def; | 491 | struct cipso_v4_doi *doi_def; |
489 | struct cipso_v4_domhsh_entry *dom_iter; | 492 | struct cipso_v4_domhsh_entry *dom_iter; |
@@ -502,7 +505,8 @@ int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)) | |||
502 | spin_unlock(&cipso_v4_doi_list_lock); | 505 | spin_unlock(&cipso_v4_doi_list_lock); |
503 | list_for_each_entry_rcu(dom_iter, &doi_def->dom_list, list) | 506 | list_for_each_entry_rcu(dom_iter, &doi_def->dom_list, list) |
504 | if (dom_iter->valid) | 507 | if (dom_iter->valid) |
505 | netlbl_domhsh_remove(dom_iter->domain); | 508 | netlbl_domhsh_remove(dom_iter->domain, |
509 | audit_secid); | ||
506 | cipso_v4_cache_invalidate(); | 510 | cipso_v4_cache_invalidate(); |
507 | rcu_read_unlock(); | 511 | rcu_read_unlock(); |
508 | 512 | ||
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index ec5da4fbd9f4..7b068a891953 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c | |||
@@ -25,7 +25,7 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
25 | struct inet_sock *inet = inet_sk(sk); | 25 | struct inet_sock *inet = inet_sk(sk); |
26 | struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; | 26 | struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; |
27 | struct rtable *rt; | 27 | struct rtable *rt; |
28 | u32 saddr; | 28 | __be32 saddr; |
29 | int oif; | 29 | int oif; |
30 | int err; | 30 | int err; |
31 | 31 | ||
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 8e8d1f17d77a..7602c79a389b 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -224,7 +224,7 @@ static void inetdev_destroy(struct in_device *in_dev) | |||
224 | call_rcu(&in_dev->rcu_head, in_dev_rcu_put); | 224 | call_rcu(&in_dev->rcu_head, in_dev_rcu_put); |
225 | } | 225 | } |
226 | 226 | ||
227 | int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b) | 227 | int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b) |
228 | { | 228 | { |
229 | rcu_read_lock(); | 229 | rcu_read_lock(); |
230 | for_primary_ifa(in_dev) { | 230 | for_primary_ifa(in_dev) { |
@@ -429,8 +429,8 @@ struct in_device *inetdev_by_index(int ifindex) | |||
429 | 429 | ||
430 | /* Called only from RTNL semaphored context. No locks. */ | 430 | /* Called only from RTNL semaphored context. No locks. */ |
431 | 431 | ||
432 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, | 432 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, |
433 | u32 mask) | 433 | __be32 mask) |
434 | { | 434 | { |
435 | ASSERT_RTNL(); | 435 | ASSERT_RTNL(); |
436 | 436 | ||
@@ -467,7 +467,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
467 | for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; | 467 | for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; |
468 | ifap = &ifa->ifa_next) { | 468 | ifap = &ifa->ifa_next) { |
469 | if (tb[IFA_LOCAL] && | 469 | if (tb[IFA_LOCAL] && |
470 | ifa->ifa_local != nla_get_u32(tb[IFA_LOCAL])) | 470 | ifa->ifa_local != nla_get_be32(tb[IFA_LOCAL])) |
471 | continue; | 471 | continue; |
472 | 472 | ||
473 | if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label)) | 473 | if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label)) |
@@ -475,7 +475,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
475 | 475 | ||
476 | if (tb[IFA_ADDRESS] && | 476 | if (tb[IFA_ADDRESS] && |
477 | (ifm->ifa_prefixlen != ifa->ifa_prefixlen || | 477 | (ifm->ifa_prefixlen != ifa->ifa_prefixlen || |
478 | !inet_ifa_match(nla_get_u32(tb[IFA_ADDRESS]), ifa))) | 478 | !inet_ifa_match(nla_get_be32(tb[IFA_ADDRESS]), ifa))) |
479 | continue; | 479 | continue; |
480 | 480 | ||
481 | __inet_del_ifa(in_dev, ifap, 1, nlh, NETLINK_CB(skb).pid); | 481 | __inet_del_ifa(in_dev, ifap, 1, nlh, NETLINK_CB(skb).pid); |
@@ -540,14 +540,14 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh) | |||
540 | ifa->ifa_scope = ifm->ifa_scope; | 540 | ifa->ifa_scope = ifm->ifa_scope; |
541 | ifa->ifa_dev = in_dev; | 541 | ifa->ifa_dev = in_dev; |
542 | 542 | ||
543 | ifa->ifa_local = nla_get_u32(tb[IFA_LOCAL]); | 543 | ifa->ifa_local = nla_get_be32(tb[IFA_LOCAL]); |
544 | ifa->ifa_address = nla_get_u32(tb[IFA_ADDRESS]); | 544 | ifa->ifa_address = nla_get_be32(tb[IFA_ADDRESS]); |
545 | 545 | ||
546 | if (tb[IFA_BROADCAST]) | 546 | if (tb[IFA_BROADCAST]) |
547 | ifa->ifa_broadcast = nla_get_u32(tb[IFA_BROADCAST]); | 547 | ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]); |
548 | 548 | ||
549 | if (tb[IFA_ANYCAST]) | 549 | if (tb[IFA_ANYCAST]) |
550 | ifa->ifa_anycast = nla_get_u32(tb[IFA_ANYCAST]); | 550 | ifa->ifa_anycast = nla_get_be32(tb[IFA_ANYCAST]); |
551 | 551 | ||
552 | if (tb[IFA_LABEL]) | 552 | if (tb[IFA_LABEL]) |
553 | nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ); | 553 | nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ); |
@@ -805,7 +805,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg) | |||
805 | break; | 805 | break; |
806 | ret = 0; | 806 | ret = 0; |
807 | if (ifa->ifa_mask != sin->sin_addr.s_addr) { | 807 | if (ifa->ifa_mask != sin->sin_addr.s_addr) { |
808 | u32 old_mask = ifa->ifa_mask; | 808 | __be32 old_mask = ifa->ifa_mask; |
809 | inet_del_ifa(in_dev, ifap, 0); | 809 | inet_del_ifa(in_dev, ifap, 0); |
810 | ifa->ifa_mask = sin->sin_addr.s_addr; | 810 | ifa->ifa_mask = sin->sin_addr.s_addr; |
811 | ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask); | 811 | ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask); |
@@ -876,9 +876,9 @@ out: | |||
876 | return done; | 876 | return done; |
877 | } | 877 | } |
878 | 878 | ||
879 | u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope) | 879 | __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope) |
880 | { | 880 | { |
881 | u32 addr = 0; | 881 | __be32 addr = 0; |
882 | struct in_device *in_dev; | 882 | struct in_device *in_dev; |
883 | 883 | ||
884 | rcu_read_lock(); | 884 | rcu_read_lock(); |
@@ -927,11 +927,11 @@ out: | |||
927 | return addr; | 927 | return addr; |
928 | } | 928 | } |
929 | 929 | ||
930 | static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst, | 930 | static __be32 confirm_addr_indev(struct in_device *in_dev, __be32 dst, |
931 | u32 local, int scope) | 931 | __be32 local, int scope) |
932 | { | 932 | { |
933 | int same = 0; | 933 | int same = 0; |
934 | u32 addr = 0; | 934 | __be32 addr = 0; |
935 | 935 | ||
936 | for_ifa(in_dev) { | 936 | for_ifa(in_dev) { |
937 | if (!addr && | 937 | if (!addr && |
@@ -971,9 +971,9 @@ static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst, | |||
971 | * - local: address, 0=autoselect the local address | 971 | * - local: address, 0=autoselect the local address |
972 | * - scope: maximum allowed scope value for the local address | 972 | * - scope: maximum allowed scope value for the local address |
973 | */ | 973 | */ |
974 | u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope) | 974 | __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope) |
975 | { | 975 | { |
976 | u32 addr = 0; | 976 | __be32 addr = 0; |
977 | struct in_device *in_dev; | 977 | struct in_device *in_dev; |
978 | 978 | ||
979 | if (dev) { | 979 | if (dev) { |
@@ -1138,16 +1138,16 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, | |||
1138 | ifm->ifa_index = ifa->ifa_dev->dev->ifindex; | 1138 | ifm->ifa_index = ifa->ifa_dev->dev->ifindex; |
1139 | 1139 | ||
1140 | if (ifa->ifa_address) | 1140 | if (ifa->ifa_address) |
1141 | NLA_PUT_U32(skb, IFA_ADDRESS, ifa->ifa_address); | 1141 | NLA_PUT_BE32(skb, IFA_ADDRESS, ifa->ifa_address); |
1142 | 1142 | ||
1143 | if (ifa->ifa_local) | 1143 | if (ifa->ifa_local) |
1144 | NLA_PUT_U32(skb, IFA_LOCAL, ifa->ifa_local); | 1144 | NLA_PUT_BE32(skb, IFA_LOCAL, ifa->ifa_local); |
1145 | 1145 | ||
1146 | if (ifa->ifa_broadcast) | 1146 | if (ifa->ifa_broadcast) |
1147 | NLA_PUT_U32(skb, IFA_BROADCAST, ifa->ifa_broadcast); | 1147 | NLA_PUT_BE32(skb, IFA_BROADCAST, ifa->ifa_broadcast); |
1148 | 1148 | ||
1149 | if (ifa->ifa_anycast) | 1149 | if (ifa->ifa_anycast) |
1150 | NLA_PUT_U32(skb, IFA_ANYCAST, ifa->ifa_anycast); | 1150 | NLA_PUT_BE32(skb, IFA_ANYCAST, ifa->ifa_anycast); |
1151 | 1151 | ||
1152 | if (ifa->ifa_label[0]) | 1152 | if (ifa->ifa_label[0]) |
1153 | NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); | 1153 | NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index cfb527c060e4..9c399a70dd5d 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -122,7 +122,7 @@ static void fib_flush(void) | |||
122 | * Find the first device with a given source address. | 122 | * Find the first device with a given source address. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | struct net_device * ip_dev_find(u32 addr) | 125 | struct net_device * ip_dev_find(__be32 addr) |
126 | { | 126 | { |
127 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; | 127 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; |
128 | struct fib_result res; | 128 | struct fib_result res; |
@@ -146,7 +146,7 @@ out: | |||
146 | return dev; | 146 | return dev; |
147 | } | 147 | } |
148 | 148 | ||
149 | unsigned inet_addr_type(u32 addr) | 149 | unsigned inet_addr_type(__be32 addr) |
150 | { | 150 | { |
151 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; | 151 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; |
152 | struct fib_result res; | 152 | struct fib_result res; |
@@ -180,8 +180,8 @@ unsigned inet_addr_type(u32 addr) | |||
180 | - check, that packet arrived from expected physical interface. | 180 | - check, that packet arrived from expected physical interface. |
181 | */ | 181 | */ |
182 | 182 | ||
183 | int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, | 183 | int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
184 | struct net_device *dev, u32 *spec_dst, u32 *itag) | 184 | struct net_device *dev, __be32 *spec_dst, u32 *itag) |
185 | { | 185 | { |
186 | struct in_device *in_dev; | 186 | struct in_device *in_dev; |
187 | struct flowi fl = { .nl_u = { .ip4_u = | 187 | struct flowi fl = { .nl_u = { .ip4_u = |
@@ -253,7 +253,7 @@ e_inval: | |||
253 | 253 | ||
254 | #ifndef CONFIG_IP_NOSIOCRT | 254 | #ifndef CONFIG_IP_NOSIOCRT |
255 | 255 | ||
256 | static inline u32 sk_extract_addr(struct sockaddr *addr) | 256 | static inline __be32 sk_extract_addr(struct sockaddr *addr) |
257 | { | 257 | { |
258 | return ((struct sockaddr_in *) addr)->sin_addr.s_addr; | 258 | return ((struct sockaddr_in *) addr)->sin_addr.s_addr; |
259 | } | 259 | } |
@@ -273,7 +273,7 @@ static int put_rtax(struct nlattr *mx, int len, int type, u32 value) | |||
273 | static int rtentry_to_fib_config(int cmd, struct rtentry *rt, | 273 | static int rtentry_to_fib_config(int cmd, struct rtentry *rt, |
274 | struct fib_config *cfg) | 274 | struct fib_config *cfg) |
275 | { | 275 | { |
276 | u32 addr; | 276 | __be32 addr; |
277 | int plen; | 277 | int plen; |
278 | 278 | ||
279 | memset(cfg, 0, sizeof(*cfg)); | 279 | memset(cfg, 0, sizeof(*cfg)); |
@@ -292,7 +292,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, | |||
292 | plen = 32; | 292 | plen = 32; |
293 | addr = sk_extract_addr(&rt->rt_dst); | 293 | addr = sk_extract_addr(&rt->rt_dst); |
294 | if (!(rt->rt_flags & RTF_HOST)) { | 294 | if (!(rt->rt_flags & RTF_HOST)) { |
295 | u32 mask = sk_extract_addr(&rt->rt_genmask); | 295 | __be32 mask = sk_extract_addr(&rt->rt_genmask); |
296 | 296 | ||
297 | if (rt->rt_genmask.sa_family != AF_INET) { | 297 | if (rt->rt_genmask.sa_family != AF_INET) { |
298 | if (mask || rt->rt_genmask.sa_family) | 298 | if (mask || rt->rt_genmask.sa_family) |
@@ -499,22 +499,22 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
499 | nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { | 499 | nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { |
500 | switch (attr->nla_type) { | 500 | switch (attr->nla_type) { |
501 | case RTA_DST: | 501 | case RTA_DST: |
502 | cfg->fc_dst = nla_get_u32(attr); | 502 | cfg->fc_dst = nla_get_be32(attr); |
503 | break; | 503 | break; |
504 | case RTA_SRC: | 504 | case RTA_SRC: |
505 | cfg->fc_src = nla_get_u32(attr); | 505 | cfg->fc_src = nla_get_be32(attr); |
506 | break; | 506 | break; |
507 | case RTA_OIF: | 507 | case RTA_OIF: |
508 | cfg->fc_oif = nla_get_u32(attr); | 508 | cfg->fc_oif = nla_get_u32(attr); |
509 | break; | 509 | break; |
510 | case RTA_GATEWAY: | 510 | case RTA_GATEWAY: |
511 | cfg->fc_gw = nla_get_u32(attr); | 511 | cfg->fc_gw = nla_get_be32(attr); |
512 | break; | 512 | break; |
513 | case RTA_PRIORITY: | 513 | case RTA_PRIORITY: |
514 | cfg->fc_priority = nla_get_u32(attr); | 514 | cfg->fc_priority = nla_get_u32(attr); |
515 | break; | 515 | break; |
516 | case RTA_PREFSRC: | 516 | case RTA_PREFSRC: |
517 | cfg->fc_prefsrc = nla_get_u32(attr); | 517 | cfg->fc_prefsrc = nla_get_be32(attr); |
518 | break; | 518 | break; |
519 | case RTA_METRICS: | 519 | case RTA_METRICS: |
520 | cfg->fc_mx = nla_data(attr); | 520 | cfg->fc_mx = nla_data(attr); |
@@ -627,8 +627,7 @@ out: | |||
627 | only when netlink is already locked. | 627 | only when netlink is already locked. |
628 | */ | 628 | */ |
629 | 629 | ||
630 | static void fib_magic(int cmd, int type, u32 dst, int dst_len, | 630 | static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) |
631 | struct in_ifaddr *ifa) | ||
632 | { | 631 | { |
633 | struct fib_table *tb; | 632 | struct fib_table *tb; |
634 | struct fib_config cfg = { | 633 | struct fib_config cfg = { |
@@ -667,9 +666,9 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) | |||
667 | struct in_device *in_dev = ifa->ifa_dev; | 666 | struct in_device *in_dev = ifa->ifa_dev; |
668 | struct net_device *dev = in_dev->dev; | 667 | struct net_device *dev = in_dev->dev; |
669 | struct in_ifaddr *prim = ifa; | 668 | struct in_ifaddr *prim = ifa; |
670 | u32 mask = ifa->ifa_mask; | 669 | __be32 mask = ifa->ifa_mask; |
671 | u32 addr = ifa->ifa_local; | 670 | __be32 addr = ifa->ifa_local; |
672 | u32 prefix = ifa->ifa_address&mask; | 671 | __be32 prefix = ifa->ifa_address&mask; |
673 | 672 | ||
674 | if (ifa->ifa_flags&IFA_F_SECONDARY) { | 673 | if (ifa->ifa_flags&IFA_F_SECONDARY) { |
675 | prim = inet_ifa_byprefix(in_dev, prefix, mask); | 674 | prim = inet_ifa_byprefix(in_dev, prefix, mask); |
@@ -685,7 +684,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) | |||
685 | return; | 684 | return; |
686 | 685 | ||
687 | /* Add broadcast address, if it is explicitly assigned. */ | 686 | /* Add broadcast address, if it is explicitly assigned. */ |
688 | if (ifa->ifa_broadcast && ifa->ifa_broadcast != 0xFFFFFFFF) | 687 | if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF)) |
689 | fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim); | 688 | fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim); |
690 | 689 | ||
691 | if (!ZERONET(prefix) && !(ifa->ifa_flags&IFA_F_SECONDARY) && | 690 | if (!ZERONET(prefix) && !(ifa->ifa_flags&IFA_F_SECONDARY) && |
@@ -707,8 +706,8 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa) | |||
707 | struct net_device *dev = in_dev->dev; | 706 | struct net_device *dev = in_dev->dev; |
708 | struct in_ifaddr *ifa1; | 707 | struct in_ifaddr *ifa1; |
709 | struct in_ifaddr *prim = ifa; | 708 | struct in_ifaddr *prim = ifa; |
710 | u32 brd = ifa->ifa_address|~ifa->ifa_mask; | 709 | __be32 brd = ifa->ifa_address|~ifa->ifa_mask; |
711 | u32 any = ifa->ifa_address&ifa->ifa_mask; | 710 | __be32 any = ifa->ifa_address&ifa->ifa_mask; |
712 | #define LOCAL_OK 1 | 711 | #define LOCAL_OK 1 |
713 | #define BRD_OK 2 | 712 | #define BRD_OK 2 |
714 | #define BRD0_OK 4 | 713 | #define BRD0_OK 4 |
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 88133b383dc5..107bb6cbb0b3 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -51,7 +51,7 @@ static kmem_cache_t *fn_alias_kmem __read_mostly; | |||
51 | struct fib_node { | 51 | struct fib_node { |
52 | struct hlist_node fn_hash; | 52 | struct hlist_node fn_hash; |
53 | struct list_head fn_alias; | 53 | struct list_head fn_alias; |
54 | u32 fn_key; | 54 | __be32 fn_key; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | struct fn_zone { | 57 | struct fn_zone { |
@@ -64,7 +64,7 @@ struct fn_zone { | |||
64 | #define FZ_HASHMASK(fz) ((fz)->fz_hashmask) | 64 | #define FZ_HASHMASK(fz) ((fz)->fz_hashmask) |
65 | 65 | ||
66 | int fz_order; /* Zone order */ | 66 | int fz_order; /* Zone order */ |
67 | u32 fz_mask; | 67 | __be32 fz_mask; |
68 | #define FZ_MASK(fz) ((fz)->fz_mask) | 68 | #define FZ_MASK(fz) ((fz)->fz_mask) |
69 | }; | 69 | }; |
70 | 70 | ||
@@ -77,7 +77,7 @@ struct fn_hash { | |||
77 | struct fn_zone *fn_zone_list; | 77 | struct fn_zone *fn_zone_list; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static inline u32 fn_hash(u32 key, struct fn_zone *fz) | 80 | static inline u32 fn_hash(__be32 key, struct fn_zone *fz) |
81 | { | 81 | { |
82 | u32 h = ntohl(key)>>(32 - fz->fz_order); | 82 | u32 h = ntohl(key)>>(32 - fz->fz_order); |
83 | h ^= (h>>20); | 83 | h ^= (h>>20); |
@@ -87,7 +87,7 @@ static inline u32 fn_hash(u32 key, struct fn_zone *fz) | |||
87 | return h; | 87 | return h; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline u32 fz_key(u32 dst, struct fn_zone *fz) | 90 | static inline __be32 fz_key(__be32 dst, struct fn_zone *fz) |
91 | { | 91 | { |
92 | return dst & FZ_MASK(fz); | 92 | return dst & FZ_MASK(fz); |
93 | } | 93 | } |
@@ -254,7 +254,7 @@ fn_hash_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result | |||
254 | struct hlist_head *head; | 254 | struct hlist_head *head; |
255 | struct hlist_node *node; | 255 | struct hlist_node *node; |
256 | struct fib_node *f; | 256 | struct fib_node *f; |
257 | u32 k = fz_key(flp->fl4_dst, fz); | 257 | __be32 k = fz_key(flp->fl4_dst, fz); |
258 | 258 | ||
259 | head = &fz->fz_hash[fn_hash(k, fz)]; | 259 | head = &fz->fz_hash[fn_hash(k, fz)]; |
260 | hlist_for_each_entry(f, node, head, fn_hash) { | 260 | hlist_for_each_entry(f, node, head, fn_hash) { |
@@ -365,7 +365,7 @@ static inline void fib_insert_node(struct fn_zone *fz, struct fib_node *f) | |||
365 | } | 365 | } |
366 | 366 | ||
367 | /* Return the node in FZ matching KEY. */ | 367 | /* Return the node in FZ matching KEY. */ |
368 | static struct fib_node *fib_find_node(struct fn_zone *fz, u32 key) | 368 | static struct fib_node *fib_find_node(struct fn_zone *fz, __be32 key) |
369 | { | 369 | { |
370 | struct hlist_head *head = &fz->fz_hash[fn_hash(key, fz)]; | 370 | struct hlist_head *head = &fz->fz_hash[fn_hash(key, fz)]; |
371 | struct hlist_node *node; | 371 | struct hlist_node *node; |
@@ -387,7 +387,7 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg) | |||
387 | struct fn_zone *fz; | 387 | struct fn_zone *fz; |
388 | struct fib_info *fi; | 388 | struct fib_info *fi; |
389 | u8 tos = cfg->fc_tos; | 389 | u8 tos = cfg->fc_tos; |
390 | u32 key; | 390 | __be32 key; |
391 | int err; | 391 | int err; |
392 | 392 | ||
393 | if (cfg->fc_dst_len > 32) | 393 | if (cfg->fc_dst_len > 32) |
@@ -541,7 +541,7 @@ static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg) | |||
541 | struct fib_node *f; | 541 | struct fib_node *f; |
542 | struct fib_alias *fa, *fa_to_delete; | 542 | struct fib_alias *fa, *fa_to_delete; |
543 | struct fn_zone *fz; | 543 | struct fn_zone *fz; |
544 | u32 key; | 544 | __be32 key; |
545 | 545 | ||
546 | if (cfg->fc_dst_len > 32) | 546 | if (cfg->fc_dst_len > 32) |
547 | return -EINVAL; | 547 | return -EINVAL; |
@@ -966,7 +966,7 @@ static void fib_seq_stop(struct seq_file *seq, void *v) | |||
966 | read_unlock(&fib_hash_lock); | 966 | read_unlock(&fib_hash_lock); |
967 | } | 967 | } |
968 | 968 | ||
969 | static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) | 969 | static unsigned fib_flag_trans(int type, __be32 mask, struct fib_info *fi) |
970 | { | 970 | { |
971 | static const unsigned type2flags[RTN_MAX + 1] = { | 971 | static const unsigned type2flags[RTN_MAX + 1] = { |
972 | [7] = RTF_REJECT, [8] = RTF_REJECT, | 972 | [7] = RTF_REJECT, [8] = RTF_REJECT, |
@@ -975,7 +975,7 @@ static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) | |||
975 | 975 | ||
976 | if (fi && fi->fib_nh->nh_gw) | 976 | if (fi && fi->fib_nh->nh_gw) |
977 | flags |= RTF_GATEWAY; | 977 | flags |= RTF_GATEWAY; |
978 | if (mask == 0xFFFFFFFF) | 978 | if (mask == htonl(0xFFFFFFFF)) |
979 | flags |= RTF_HOST; | 979 | flags |= RTF_HOST; |
980 | flags |= RTF_UP; | 980 | flags |= RTF_UP; |
981 | return flags; | 981 | return flags; |
@@ -991,7 +991,7 @@ static int fib_seq_show(struct seq_file *seq, void *v) | |||
991 | { | 991 | { |
992 | struct fib_iter_state *iter; | 992 | struct fib_iter_state *iter; |
993 | char bf[128]; | 993 | char bf[128]; |
994 | u32 prefix, mask; | 994 | __be32 prefix, mask; |
995 | unsigned flags; | 995 | unsigned flags; |
996 | struct fib_node *f; | 996 | struct fib_node *f; |
997 | struct fib_alias *fa; | 997 | struct fib_alias *fa; |
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h index fd6f7769f8ab..0e8b70bad4e1 100644 --- a/net/ipv4/fib_lookup.h +++ b/net/ipv4/fib_lookup.h | |||
@@ -20,16 +20,16 @@ struct fib_alias { | |||
20 | /* Exported by fib_semantics.c */ | 20 | /* Exported by fib_semantics.c */ |
21 | extern int fib_semantic_match(struct list_head *head, | 21 | extern int fib_semantic_match(struct list_head *head, |
22 | const struct flowi *flp, | 22 | const struct flowi *flp, |
23 | struct fib_result *res, __u32 zone, __u32 mask, | 23 | struct fib_result *res, __be32 zone, __be32 mask, |
24 | int prefixlen); | 24 | int prefixlen); |
25 | extern void fib_release_info(struct fib_info *); | 25 | extern void fib_release_info(struct fib_info *); |
26 | extern struct fib_info *fib_create_info(struct fib_config *cfg); | 26 | extern struct fib_info *fib_create_info(struct fib_config *cfg); |
27 | extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi); | 27 | extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi); |
28 | extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | 28 | extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, |
29 | u32 tb_id, u8 type, u8 scope, u32 dst, | 29 | u32 tb_id, u8 type, u8 scope, __be32 dst, |
30 | int dst_len, u8 tos, struct fib_info *fi, | 30 | int dst_len, u8 tos, struct fib_info *fi, |
31 | unsigned int); | 31 | unsigned int); |
32 | extern void rtmsg_fib(int event, u32 key, struct fib_alias *fa, | 32 | extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, |
33 | int dst_len, u32 tb_id, struct nl_info *info); | 33 | int dst_len, u32 tb_id, struct nl_info *info); |
34 | extern struct fib_alias *fib_find_alias(struct list_head *fah, | 34 | extern struct fib_alias *fib_find_alias(struct list_head *fah, |
35 | u8 tos, u32 prio); | 35 | u8 tos, u32 prio); |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 52b2adae4f22..0852b9cd065a 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -40,10 +40,10 @@ struct fib4_rule | |||
40 | u8 dst_len; | 40 | u8 dst_len; |
41 | u8 src_len; | 41 | u8 src_len; |
42 | u8 tos; | 42 | u8 tos; |
43 | u32 src; | 43 | __be32 src; |
44 | u32 srcmask; | 44 | __be32 srcmask; |
45 | u32 dst; | 45 | __be32 dst; |
46 | u32 dstmask; | 46 | __be32 dstmask; |
47 | #ifdef CONFIG_IP_ROUTE_FWMARK | 47 | #ifdef CONFIG_IP_ROUTE_FWMARK |
48 | u32 fwmark; | 48 | u32 fwmark; |
49 | u32 fwmask; | 49 | u32 fwmask; |
@@ -150,8 +150,8 @@ void fib_select_default(const struct flowi *flp, struct fib_result *res) | |||
150 | static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | 150 | static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) |
151 | { | 151 | { |
152 | struct fib4_rule *r = (struct fib4_rule *) rule; | 152 | struct fib4_rule *r = (struct fib4_rule *) rule; |
153 | u32 daddr = fl->fl4_dst; | 153 | __be32 daddr = fl->fl4_dst; |
154 | u32 saddr = fl->fl4_src; | 154 | __be32 saddr = fl->fl4_src; |
155 | 155 | ||
156 | if (((saddr ^ r->src) & r->srcmask) || | 156 | if (((saddr ^ r->src) & r->srcmask) || |
157 | ((daddr ^ r->dst) & r->dstmask)) | 157 | ((daddr ^ r->dst) & r->dstmask)) |
@@ -215,10 +215,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | |||
215 | } | 215 | } |
216 | 216 | ||
217 | if (tb[FRA_SRC]) | 217 | if (tb[FRA_SRC]) |
218 | rule4->src = nla_get_u32(tb[FRA_SRC]); | 218 | rule4->src = nla_get_be32(tb[FRA_SRC]); |
219 | 219 | ||
220 | if (tb[FRA_DST]) | 220 | if (tb[FRA_DST]) |
221 | rule4->dst = nla_get_u32(tb[FRA_DST]); | 221 | rule4->dst = nla_get_be32(tb[FRA_DST]); |
222 | 222 | ||
223 | #ifdef CONFIG_IP_ROUTE_FWMARK | 223 | #ifdef CONFIG_IP_ROUTE_FWMARK |
224 | if (tb[FRA_FWMARK]) { | 224 | if (tb[FRA_FWMARK]) { |
@@ -277,10 +277,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, | |||
277 | return 0; | 277 | return 0; |
278 | #endif | 278 | #endif |
279 | 279 | ||
280 | if (tb[FRA_SRC] && (rule4->src != nla_get_u32(tb[FRA_SRC]))) | 280 | if (tb[FRA_SRC] && (rule4->src != nla_get_be32(tb[FRA_SRC]))) |
281 | return 0; | 281 | return 0; |
282 | 282 | ||
283 | if (tb[FRA_DST] && (rule4->dst != nla_get_u32(tb[FRA_DST]))) | 283 | if (tb[FRA_DST] && (rule4->dst != nla_get_be32(tb[FRA_DST]))) |
284 | return 0; | 284 | return 0; |
285 | 285 | ||
286 | return 1; | 286 | return 1; |
@@ -305,10 +305,10 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb, | |||
305 | #endif | 305 | #endif |
306 | 306 | ||
307 | if (rule4->dst_len) | 307 | if (rule4->dst_len) |
308 | NLA_PUT_U32(skb, FRA_DST, rule4->dst); | 308 | NLA_PUT_BE32(skb, FRA_DST, rule4->dst); |
309 | 309 | ||
310 | if (rule4->src_len) | 310 | if (rule4->src_len) |
311 | NLA_PUT_U32(skb, FRA_SRC, rule4->src); | 311 | NLA_PUT_BE32(skb, FRA_SRC, rule4->src); |
312 | 312 | ||
313 | #ifdef CONFIG_NET_CLS_ROUTE | 313 | #ifdef CONFIG_NET_CLS_ROUTE |
314 | if (rule4->tclassid) | 314 | if (rule4->tclassid) |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 2ead09543f68..884d176e0082 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -203,7 +203,7 @@ static inline unsigned int fib_info_hashfn(const struct fib_info *fi) | |||
203 | unsigned int val = fi->fib_nhs; | 203 | unsigned int val = fi->fib_nhs; |
204 | 204 | ||
205 | val ^= fi->fib_protocol; | 205 | val ^= fi->fib_protocol; |
206 | val ^= fi->fib_prefsrc; | 206 | val ^= (__force u32)fi->fib_prefsrc; |
207 | val ^= fi->fib_priority; | 207 | val ^= fi->fib_priority; |
208 | 208 | ||
209 | return (val ^ (val >> 7) ^ (val >> 12)) & mask; | 209 | return (val ^ (val >> 7) ^ (val >> 12)) & mask; |
@@ -248,7 +248,7 @@ static inline unsigned int fib_devindex_hashfn(unsigned int val) | |||
248 | Used only by redirect accept routine. | 248 | Used only by redirect accept routine. |
249 | */ | 249 | */ |
250 | 250 | ||
251 | int ip_fib_check_default(u32 gw, struct net_device *dev) | 251 | int ip_fib_check_default(__be32 gw, struct net_device *dev) |
252 | { | 252 | { |
253 | struct hlist_head *head; | 253 | struct hlist_head *head; |
254 | struct hlist_node *node; | 254 | struct hlist_node *node; |
@@ -273,7 +273,7 @@ int ip_fib_check_default(u32 gw, struct net_device *dev) | |||
273 | return -1; | 273 | return -1; |
274 | } | 274 | } |
275 | 275 | ||
276 | void rtmsg_fib(int event, u32 key, struct fib_alias *fa, | 276 | void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, |
277 | int dst_len, u32 tb_id, struct nl_info *info) | 277 | int dst_len, u32 tb_id, struct nl_info *info) |
278 | { | 278 | { |
279 | struct sk_buff *skb; | 279 | struct sk_buff *skb; |
@@ -374,7 +374,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh, | |||
374 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); | 374 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); |
375 | 375 | ||
376 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); | 376 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); |
377 | nh->nh_gw = nla ? nla_get_u32(nla) : 0; | 377 | nh->nh_gw = nla ? nla_get_be32(nla) : 0; |
378 | #ifdef CONFIG_NET_CLS_ROUTE | 378 | #ifdef CONFIG_NET_CLS_ROUTE |
379 | nla = nla_find(attrs, attrlen, RTA_FLOW); | 379 | nla = nla_find(attrs, attrlen, RTA_FLOW); |
380 | nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; | 380 | nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; |
@@ -427,7 +427,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) | |||
427 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); | 427 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); |
428 | 428 | ||
429 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); | 429 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); |
430 | if (nla && nla_get_u32(nla) != nh->nh_gw) | 430 | if (nla && nla_get_be32(nla) != nh->nh_gw) |
431 | return 1; | 431 | return 1; |
432 | #ifdef CONFIG_NET_CLS_ROUTE | 432 | #ifdef CONFIG_NET_CLS_ROUTE |
433 | nla = nla_find(attrs, attrlen, RTA_FLOW); | 433 | nla = nla_find(attrs, attrlen, RTA_FLOW); |
@@ -568,11 +568,11 @@ out: | |||
568 | return 0; | 568 | return 0; |
569 | } | 569 | } |
570 | 570 | ||
571 | static inline unsigned int fib_laddr_hashfn(u32 val) | 571 | static inline unsigned int fib_laddr_hashfn(__be32 val) |
572 | { | 572 | { |
573 | unsigned int mask = (fib_hash_size - 1); | 573 | unsigned int mask = (fib_hash_size - 1); |
574 | 574 | ||
575 | return (val ^ (val >> 7) ^ (val >> 14)) & mask; | 575 | return ((__force u32)val ^ ((__force u32)val >> 7) ^ ((__force u32)val >> 14)) & mask; |
576 | } | 576 | } |
577 | 577 | ||
578 | static struct hlist_head *fib_hash_alloc(int bytes) | 578 | static struct hlist_head *fib_hash_alloc(int bytes) |
@@ -847,7 +847,7 @@ failure: | |||
847 | 847 | ||
848 | /* Note! fib_semantic_match intentionally uses RCU list functions. */ | 848 | /* Note! fib_semantic_match intentionally uses RCU list functions. */ |
849 | int fib_semantic_match(struct list_head *head, const struct flowi *flp, | 849 | int fib_semantic_match(struct list_head *head, const struct flowi *flp, |
850 | struct fib_result *res, __u32 zone, __u32 mask, | 850 | struct fib_result *res, __be32 zone, __be32 mask, |
851 | int prefixlen) | 851 | int prefixlen) |
852 | { | 852 | { |
853 | struct fib_alias *fa; | 853 | struct fib_alias *fa; |
@@ -914,8 +914,7 @@ out_fill_res: | |||
914 | res->fi = fa->fa_info; | 914 | res->fi = fa->fa_info; |
915 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED | 915 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED |
916 | res->netmask = mask; | 916 | res->netmask = mask; |
917 | res->network = zone & | 917 | res->network = zone & inet_make_mask(prefixlen); |
918 | (0xFFFFFFFF >> (32 - prefixlen)); | ||
919 | #endif | 918 | #endif |
920 | atomic_inc(&res->fi->fib_clntref); | 919 | atomic_inc(&res->fi->fib_clntref); |
921 | return 0; | 920 | return 0; |
@@ -923,13 +922,13 @@ out_fill_res: | |||
923 | 922 | ||
924 | /* Find appropriate source address to this destination */ | 923 | /* Find appropriate source address to this destination */ |
925 | 924 | ||
926 | u32 __fib_res_prefsrc(struct fib_result *res) | 925 | __be32 __fib_res_prefsrc(struct fib_result *res) |
927 | { | 926 | { |
928 | return inet_select_addr(FIB_RES_DEV(*res), FIB_RES_GW(*res), res->scope); | 927 | return inet_select_addr(FIB_RES_DEV(*res), FIB_RES_GW(*res), res->scope); |
929 | } | 928 | } |
930 | 929 | ||
931 | int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | 930 | int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, |
932 | u32 tb_id, u8 type, u8 scope, u32 dst, int dst_len, u8 tos, | 931 | u32 tb_id, u8 type, u8 scope, __be32 dst, int dst_len, u8 tos, |
933 | struct fib_info *fi, unsigned int flags) | 932 | struct fib_info *fi, unsigned int flags) |
934 | { | 933 | { |
935 | struct nlmsghdr *nlh; | 934 | struct nlmsghdr *nlh; |
@@ -952,7 +951,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
952 | rtm->rtm_protocol = fi->fib_protocol; | 951 | rtm->rtm_protocol = fi->fib_protocol; |
953 | 952 | ||
954 | if (rtm->rtm_dst_len) | 953 | if (rtm->rtm_dst_len) |
955 | NLA_PUT_U32(skb, RTA_DST, dst); | 954 | NLA_PUT_BE32(skb, RTA_DST, dst); |
956 | 955 | ||
957 | if (fi->fib_priority) | 956 | if (fi->fib_priority) |
958 | NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority); | 957 | NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority); |
@@ -961,11 +960,11 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
961 | goto nla_put_failure; | 960 | goto nla_put_failure; |
962 | 961 | ||
963 | if (fi->fib_prefsrc) | 962 | if (fi->fib_prefsrc) |
964 | NLA_PUT_U32(skb, RTA_PREFSRC, fi->fib_prefsrc); | 963 | NLA_PUT_BE32(skb, RTA_PREFSRC, fi->fib_prefsrc); |
965 | 964 | ||
966 | if (fi->fib_nhs == 1) { | 965 | if (fi->fib_nhs == 1) { |
967 | if (fi->fib_nh->nh_gw) | 966 | if (fi->fib_nh->nh_gw) |
968 | NLA_PUT_U32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw); | 967 | NLA_PUT_BE32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw); |
969 | 968 | ||
970 | if (fi->fib_nh->nh_oif) | 969 | if (fi->fib_nh->nh_oif) |
971 | NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); | 970 | NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); |
@@ -993,7 +992,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
993 | rtnh->rtnh_ifindex = nh->nh_oif; | 992 | rtnh->rtnh_ifindex = nh->nh_oif; |
994 | 993 | ||
995 | if (nh->nh_gw) | 994 | if (nh->nh_gw) |
996 | NLA_PUT_U32(skb, RTA_GATEWAY, nh->nh_gw); | 995 | NLA_PUT_BE32(skb, RTA_GATEWAY, nh->nh_gw); |
997 | #ifdef CONFIG_NET_CLS_ROUTE | 996 | #ifdef CONFIG_NET_CLS_ROUTE |
998 | if (nh->nh_tclassid) | 997 | if (nh->nh_tclassid) |
999 | NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); | 998 | NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); |
@@ -1018,7 +1017,7 @@ nla_put_failure: | |||
1018 | - device went down -> we must shutdown all nexthops going via it. | 1017 | - device went down -> we must shutdown all nexthops going via it. |
1019 | */ | 1018 | */ |
1020 | 1019 | ||
1021 | int fib_sync_down(u32 local, struct net_device *dev, int force) | 1020 | int fib_sync_down(__be32 local, struct net_device *dev, int force) |
1022 | { | 1021 | { |
1023 | int ret = 0; | 1022 | int ret = 0; |
1024 | int scope = RT_SCOPE_NOWHERE; | 1023 | int scope = RT_SCOPE_NOWHERE; |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 9c3ff6ba6e21..d17990ec724f 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1834,7 +1834,7 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fi | |||
1834 | int i, s_i; | 1834 | int i, s_i; |
1835 | struct fib_alias *fa; | 1835 | struct fib_alias *fa; |
1836 | 1836 | ||
1837 | u32 xkey = htonl(key); | 1837 | __be32 xkey = htonl(key); |
1838 | 1838 | ||
1839 | s_i = cb->args[4]; | 1839 | s_i = cb->args[4]; |
1840 | i = 0; | 1840 | i = 0; |
@@ -2281,7 +2281,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) | |||
2281 | 2281 | ||
2282 | if (IS_TNODE(n)) { | 2282 | if (IS_TNODE(n)) { |
2283 | struct tnode *tn = (struct tnode *) n; | 2283 | struct tnode *tn = (struct tnode *) n; |
2284 | t_key prf = ntohl(MASK_PFX(tn->key, tn->pos)); | 2284 | __be32 prf = htonl(MASK_PFX(tn->key, tn->pos)); |
2285 | 2285 | ||
2286 | if (!NODE_PARENT(n)) { | 2286 | if (!NODE_PARENT(n)) { |
2287 | if (iter->trie == trie_local) | 2287 | if (iter->trie == trie_local) |
@@ -2297,7 +2297,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) | |||
2297 | } else { | 2297 | } else { |
2298 | struct leaf *l = (struct leaf *) n; | 2298 | struct leaf *l = (struct leaf *) n; |
2299 | int i; | 2299 | int i; |
2300 | u32 val = ntohl(l->key); | 2300 | __be32 val = htonl(l->key); |
2301 | 2301 | ||
2302 | seq_indent(seq, iter->depth); | 2302 | seq_indent(seq, iter->depth); |
2303 | seq_printf(seq, " |-- %d.%d.%d.%d\n", NIPQUAD(val)); | 2303 | seq_printf(seq, " |-- %d.%d.%d.%d\n", NIPQUAD(val)); |
@@ -2360,7 +2360,7 @@ static struct file_operations fib_trie_fops = { | |||
2360 | .release = seq_release_private, | 2360 | .release = seq_release_private, |
2361 | }; | 2361 | }; |
2362 | 2362 | ||
2363 | static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi) | 2363 | static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi) |
2364 | { | 2364 | { |
2365 | static unsigned type2flags[RTN_MAX + 1] = { | 2365 | static unsigned type2flags[RTN_MAX + 1] = { |
2366 | [7] = RTF_REJECT, [8] = RTF_REJECT, | 2366 | [7] = RTF_REJECT, [8] = RTF_REJECT, |
@@ -2369,7 +2369,7 @@ static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi) | |||
2369 | 2369 | ||
2370 | if (fi && fi->fib_nh->nh_gw) | 2370 | if (fi && fi->fib_nh->nh_gw) |
2371 | flags |= RTF_GATEWAY; | 2371 | flags |= RTF_GATEWAY; |
2372 | if (mask == 0xFFFFFFFF) | 2372 | if (mask == htonl(0xFFFFFFFF)) |
2373 | flags |= RTF_HOST; | 2373 | flags |= RTF_HOST; |
2374 | flags |= RTF_UP; | 2374 | flags |= RTF_UP; |
2375 | return flags; | 2375 | return flags; |
@@ -2403,7 +2403,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v) | |||
2403 | for (i=32; i>=0; i--) { | 2403 | for (i=32; i>=0; i--) { |
2404 | struct leaf_info *li = find_leaf_info(l, i); | 2404 | struct leaf_info *li = find_leaf_info(l, i); |
2405 | struct fib_alias *fa; | 2405 | struct fib_alias *fa; |
2406 | u32 mask, prefix; | 2406 | __be32 mask, prefix; |
2407 | 2407 | ||
2408 | if (!li) | 2408 | if (!li) |
2409 | continue; | 2409 | continue; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index c2ad07e48ab4..b39a37a47545 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -104,7 +104,7 @@ struct icmp_bxm { | |||
104 | 104 | ||
105 | struct { | 105 | struct { |
106 | struct icmphdr icmph; | 106 | struct icmphdr icmph; |
107 | __u32 times[3]; | 107 | __be32 times[3]; |
108 | } data; | 108 | } data; |
109 | int head_len; | 109 | int head_len; |
110 | struct ip_options replyopts; | 110 | struct ip_options replyopts; |
@@ -381,7 +381,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) | |||
381 | struct inet_sock *inet = inet_sk(sk); | 381 | struct inet_sock *inet = inet_sk(sk); |
382 | struct ipcm_cookie ipc; | 382 | struct ipcm_cookie ipc; |
383 | struct rtable *rt = (struct rtable *)skb->dst; | 383 | struct rtable *rt = (struct rtable *)skb->dst; |
384 | u32 daddr; | 384 | __be32 daddr; |
385 | 385 | ||
386 | if (ip_options_echo(&icmp_param->replyopts, skb)) | 386 | if (ip_options_echo(&icmp_param->replyopts, skb)) |
387 | return; | 387 | return; |
@@ -430,14 +430,14 @@ out_unlock: | |||
430 | * MUST reply to only the first fragment. | 430 | * MUST reply to only the first fragment. |
431 | */ | 431 | */ |
432 | 432 | ||
433 | void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info) | 433 | void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
434 | { | 434 | { |
435 | struct iphdr *iph; | 435 | struct iphdr *iph; |
436 | int room; | 436 | int room; |
437 | struct icmp_bxm icmp_param; | 437 | struct icmp_bxm icmp_param; |
438 | struct rtable *rt = (struct rtable *)skb_in->dst; | 438 | struct rtable *rt = (struct rtable *)skb_in->dst; |
439 | struct ipcm_cookie ipc; | 439 | struct ipcm_cookie ipc; |
440 | u32 saddr; | 440 | __be32 saddr; |
441 | u8 tos; | 441 | u8 tos; |
442 | 442 | ||
443 | if (!rt) | 443 | if (!rt) |
@@ -895,7 +895,7 @@ static void icmp_address_reply(struct sk_buff *skb) | |||
895 | if (in_dev->ifa_list && | 895 | if (in_dev->ifa_list && |
896 | IN_DEV_LOG_MARTIANS(in_dev) && | 896 | IN_DEV_LOG_MARTIANS(in_dev) && |
897 | IN_DEV_FORWARD(in_dev)) { | 897 | IN_DEV_FORWARD(in_dev)) { |
898 | u32 _mask, *mp; | 898 | __be32 _mask, *mp; |
899 | 899 | ||
900 | mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); | 900 | mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); |
901 | BUG_ON(mp == NULL); | 901 | BUG_ON(mp == NULL); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 58be8227b0cb..6eee71647b7c 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -138,14 +138,14 @@ | |||
138 | time_before(jiffies, (in_dev)->mr_v2_seen))) | 138 | time_before(jiffies, (in_dev)->mr_v2_seen))) |
139 | 139 | ||
140 | static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im); | 140 | static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im); |
141 | static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr); | 141 | static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr); |
142 | static void igmpv3_clear_delrec(struct in_device *in_dev); | 142 | static void igmpv3_clear_delrec(struct in_device *in_dev); |
143 | static int sf_setstate(struct ip_mc_list *pmc); | 143 | static int sf_setstate(struct ip_mc_list *pmc); |
144 | static void sf_markstate(struct ip_mc_list *pmc); | 144 | static void sf_markstate(struct ip_mc_list *pmc); |
145 | #endif | 145 | #endif |
146 | static void ip_mc_clear_src(struct ip_mc_list *pmc); | 146 | static void ip_mc_clear_src(struct ip_mc_list *pmc); |
147 | static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode, | 147 | static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
148 | int sfcount, __u32 *psfsrc, int delta); | 148 | int sfcount, __be32 *psfsrc, int delta); |
149 | 149 | ||
150 | static void ip_ma_put(struct ip_mc_list *im) | 150 | static void ip_ma_put(struct ip_mc_list *im) |
151 | { | 151 | { |
@@ -426,7 +426,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
426 | first = 1; | 426 | first = 1; |
427 | psf_prev = NULL; | 427 | psf_prev = NULL; |
428 | for (psf=*psf_list; psf; psf=psf_next) { | 428 | for (psf=*psf_list; psf; psf=psf_next) { |
429 | u32 *psrc; | 429 | __be32 *psrc; |
430 | 430 | ||
431 | psf_next = psf->sf_next; | 431 | psf_next = psf->sf_next; |
432 | 432 | ||
@@ -439,7 +439,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
439 | if (isquery) | 439 | if (isquery) |
440 | psf->sf_gsresp = 0; | 440 | psf->sf_gsresp = 0; |
441 | 441 | ||
442 | if (AVAILABLE(skb) < sizeof(u32) + | 442 | if (AVAILABLE(skb) < sizeof(__be32) + |
443 | first*sizeof(struct igmpv3_grec)) { | 443 | first*sizeof(struct igmpv3_grec)) { |
444 | if (truncate && !first) | 444 | if (truncate && !first) |
445 | break; /* truncate these */ | 445 | break; /* truncate these */ |
@@ -455,7 +455,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
455 | skb = add_grhead(skb, pmc, type, &pgr); | 455 | skb = add_grhead(skb, pmc, type, &pgr); |
456 | first = 0; | 456 | first = 0; |
457 | } | 457 | } |
458 | psrc = (u32 *)skb_put(skb, sizeof(u32)); | 458 | psrc = (__be32 *)skb_put(skb, sizeof(__be32)); |
459 | *psrc = psf->sf_inaddr; | 459 | *psrc = psf->sf_inaddr; |
460 | scount++; stotal++; | 460 | scount++; stotal++; |
461 | if ((type == IGMPV3_ALLOW_NEW_SOURCES || | 461 | if ((type == IGMPV3_ALLOW_NEW_SOURCES || |
@@ -630,8 +630,8 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, | |||
630 | struct igmphdr *ih; | 630 | struct igmphdr *ih; |
631 | struct rtable *rt; | 631 | struct rtable *rt; |
632 | struct net_device *dev = in_dev->dev; | 632 | struct net_device *dev = in_dev->dev; |
633 | u32 group = pmc ? pmc->multiaddr : 0; | 633 | __be32 group = pmc ? pmc->multiaddr : 0; |
634 | u32 dst; | 634 | __be32 dst; |
635 | 635 | ||
636 | if (type == IGMPV3_HOST_MEMBERSHIP_REPORT) | 636 | if (type == IGMPV3_HOST_MEMBERSHIP_REPORT) |
637 | return igmpv3_send_report(in_dev, pmc); | 637 | return igmpv3_send_report(in_dev, pmc); |
@@ -748,7 +748,7 @@ static void igmp_timer_expire(unsigned long data) | |||
748 | } | 748 | } |
749 | 749 | ||
750 | /* mark EXCLUDE-mode sources */ | 750 | /* mark EXCLUDE-mode sources */ |
751 | static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | 751 | static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) |
752 | { | 752 | { |
753 | struct ip_sf_list *psf; | 753 | struct ip_sf_list *psf; |
754 | int i, scount; | 754 | int i, scount; |
@@ -775,7 +775,7 @@ static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | |||
775 | return 1; | 775 | return 1; |
776 | } | 776 | } |
777 | 777 | ||
778 | static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | 778 | static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) |
779 | { | 779 | { |
780 | struct ip_sf_list *psf; | 780 | struct ip_sf_list *psf; |
781 | int i, scount; | 781 | int i, scount; |
@@ -803,7 +803,7 @@ static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | |||
803 | return 1; | 803 | return 1; |
804 | } | 804 | } |
805 | 805 | ||
806 | static void igmp_heard_report(struct in_device *in_dev, u32 group) | 806 | static void igmp_heard_report(struct in_device *in_dev, __be32 group) |
807 | { | 807 | { |
808 | struct ip_mc_list *im; | 808 | struct ip_mc_list *im; |
809 | 809 | ||
@@ -828,7 +828,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
828 | struct igmphdr *ih = skb->h.igmph; | 828 | struct igmphdr *ih = skb->h.igmph; |
829 | struct igmpv3_query *ih3 = (struct igmpv3_query *)ih; | 829 | struct igmpv3_query *ih3 = (struct igmpv3_query *)ih; |
830 | struct ip_mc_list *im; | 830 | struct ip_mc_list *im; |
831 | u32 group = ih->group; | 831 | __be32 group = ih->group; |
832 | int max_delay; | 832 | int max_delay; |
833 | int mark = 0; | 833 | int mark = 0; |
834 | 834 | ||
@@ -862,7 +862,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
862 | ih3 = (struct igmpv3_query *) skb->h.raw; | 862 | ih3 = (struct igmpv3_query *) skb->h.raw; |
863 | if (ih3->nsrcs) { | 863 | if (ih3->nsrcs) { |
864 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) | 864 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) |
865 | + ntohs(ih3->nsrcs)*sizeof(__u32))) | 865 | + ntohs(ih3->nsrcs)*sizeof(__be32))) |
866 | return; | 866 | return; |
867 | ih3 = (struct igmpv3_query *) skb->h.raw; | 867 | ih3 = (struct igmpv3_query *) skb->h.raw; |
868 | } | 868 | } |
@@ -985,7 +985,7 @@ drop: | |||
985 | * Add a filter to a device | 985 | * Add a filter to a device |
986 | */ | 986 | */ |
987 | 987 | ||
988 | static void ip_mc_filter_add(struct in_device *in_dev, u32 addr) | 988 | static void ip_mc_filter_add(struct in_device *in_dev, __be32 addr) |
989 | { | 989 | { |
990 | char buf[MAX_ADDR_LEN]; | 990 | char buf[MAX_ADDR_LEN]; |
991 | struct net_device *dev = in_dev->dev; | 991 | struct net_device *dev = in_dev->dev; |
@@ -1005,7 +1005,7 @@ static void ip_mc_filter_add(struct in_device *in_dev, u32 addr) | |||
1005 | * Remove a filter from a device | 1005 | * Remove a filter from a device |
1006 | */ | 1006 | */ |
1007 | 1007 | ||
1008 | static void ip_mc_filter_del(struct in_device *in_dev, u32 addr) | 1008 | static void ip_mc_filter_del(struct in_device *in_dev, __be32 addr) |
1009 | { | 1009 | { |
1010 | char buf[MAX_ADDR_LEN]; | 1010 | char buf[MAX_ADDR_LEN]; |
1011 | struct net_device *dev = in_dev->dev; | 1011 | struct net_device *dev = in_dev->dev; |
@@ -1055,7 +1055,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) | |||
1055 | spin_unlock_bh(&in_dev->mc_tomb_lock); | 1055 | spin_unlock_bh(&in_dev->mc_tomb_lock); |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr) | 1058 | static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr) |
1059 | { | 1059 | { |
1060 | struct ip_mc_list *pmc, *pmc_prev; | 1060 | struct ip_mc_list *pmc, *pmc_prev; |
1061 | struct ip_sf_list *psf, *psf_next; | 1061 | struct ip_sf_list *psf, *psf_next; |
@@ -1193,7 +1193,7 @@ static void igmp_group_added(struct ip_mc_list *im) | |||
1193 | * A socket has joined a multicast group on device dev. | 1193 | * A socket has joined a multicast group on device dev. |
1194 | */ | 1194 | */ |
1195 | 1195 | ||
1196 | void ip_mc_inc_group(struct in_device *in_dev, u32 addr) | 1196 | void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) |
1197 | { | 1197 | { |
1198 | struct ip_mc_list *im; | 1198 | struct ip_mc_list *im; |
1199 | 1199 | ||
@@ -1252,7 +1252,7 @@ out: | |||
1252 | * A socket has left a multicast group on device dev | 1252 | * A socket has left a multicast group on device dev |
1253 | */ | 1253 | */ |
1254 | 1254 | ||
1255 | void ip_mc_dec_group(struct in_device *in_dev, u32 addr) | 1255 | void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) |
1256 | { | 1256 | { |
1257 | struct ip_mc_list *i, **ip; | 1257 | struct ip_mc_list *i, **ip; |
1258 | 1258 | ||
@@ -1402,7 +1402,7 @@ int sysctl_igmp_max_msf __read_mostly = IP_MAX_MSF; | |||
1402 | 1402 | ||
1403 | 1403 | ||
1404 | static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, | 1404 | static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, |
1405 | __u32 *psfsrc) | 1405 | __be32 *psfsrc) |
1406 | { | 1406 | { |
1407 | struct ip_sf_list *psf, *psf_prev; | 1407 | struct ip_sf_list *psf, *psf_prev; |
1408 | int rv = 0; | 1408 | int rv = 0; |
@@ -1450,8 +1450,8 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, | |||
1450 | #define igmp_ifc_event(x) do { } while (0) | 1450 | #define igmp_ifc_event(x) do { } while (0) |
1451 | #endif | 1451 | #endif |
1452 | 1452 | ||
1453 | static int ip_mc_del_src(struct in_device *in_dev, __u32 *pmca, int sfmode, | 1453 | static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
1454 | int sfcount, __u32 *psfsrc, int delta) | 1454 | int sfcount, __be32 *psfsrc, int delta) |
1455 | { | 1455 | { |
1456 | struct ip_mc_list *pmc; | 1456 | struct ip_mc_list *pmc; |
1457 | int changerec = 0; | 1457 | int changerec = 0; |
@@ -1517,7 +1517,7 @@ out_unlock: | |||
1517 | * Add multicast single-source filter to the interface list | 1517 | * Add multicast single-source filter to the interface list |
1518 | */ | 1518 | */ |
1519 | static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, | 1519 | static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, |
1520 | __u32 *psfsrc, int delta) | 1520 | __be32 *psfsrc, int delta) |
1521 | { | 1521 | { |
1522 | struct ip_sf_list *psf, *psf_prev; | 1522 | struct ip_sf_list *psf, *psf_prev; |
1523 | 1523 | ||
@@ -1623,8 +1623,8 @@ static int sf_setstate(struct ip_mc_list *pmc) | |||
1623 | /* | 1623 | /* |
1624 | * Add multicast source filter list to the interface list | 1624 | * Add multicast source filter list to the interface list |
1625 | */ | 1625 | */ |
1626 | static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode, | 1626 | static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
1627 | int sfcount, __u32 *psfsrc, int delta) | 1627 | int sfcount, __be32 *psfsrc, int delta) |
1628 | { | 1628 | { |
1629 | struct ip_mc_list *pmc; | 1629 | struct ip_mc_list *pmc; |
1630 | int isexclude; | 1630 | int isexclude; |
@@ -1717,7 +1717,7 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc) | |||
1717 | int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) | 1717 | int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) |
1718 | { | 1718 | { |
1719 | int err; | 1719 | int err; |
1720 | u32 addr = imr->imr_multiaddr.s_addr; | 1720 | __be32 addr = imr->imr_multiaddr.s_addr; |
1721 | struct ip_mc_socklist *iml=NULL, *i; | 1721 | struct ip_mc_socklist *iml=NULL, *i; |
1722 | struct in_device *in_dev; | 1722 | struct in_device *in_dev; |
1723 | struct inet_sock *inet = inet_sk(sk); | 1723 | struct inet_sock *inet = inet_sk(sk); |
@@ -1791,7 +1791,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr) | |||
1791 | struct inet_sock *inet = inet_sk(sk); | 1791 | struct inet_sock *inet = inet_sk(sk); |
1792 | struct ip_mc_socklist *iml, **imlp; | 1792 | struct ip_mc_socklist *iml, **imlp; |
1793 | struct in_device *in_dev; | 1793 | struct in_device *in_dev; |
1794 | u32 group = imr->imr_multiaddr.s_addr; | 1794 | __be32 group = imr->imr_multiaddr.s_addr; |
1795 | u32 ifindex; | 1795 | u32 ifindex; |
1796 | int ret = -EADDRNOTAVAIL; | 1796 | int ret = -EADDRNOTAVAIL; |
1797 | 1797 | ||
@@ -1829,7 +1829,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1829 | { | 1829 | { |
1830 | int err; | 1830 | int err; |
1831 | struct ip_mreqn imr; | 1831 | struct ip_mreqn imr; |
1832 | u32 addr = mreqs->imr_multiaddr; | 1832 | __be32 addr = mreqs->imr_multiaddr; |
1833 | struct ip_mc_socklist *pmc; | 1833 | struct ip_mc_socklist *pmc; |
1834 | struct in_device *in_dev = NULL; | 1834 | struct in_device *in_dev = NULL; |
1835 | struct inet_sock *inet = inet_sk(sk); | 1835 | struct inet_sock *inet = inet_sk(sk); |
@@ -1883,7 +1883,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1883 | rv = !0; | 1883 | rv = !0; |
1884 | for (i=0; i<psl->sl_count; i++) { | 1884 | for (i=0; i<psl->sl_count; i++) { |
1885 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, | 1885 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, |
1886 | sizeof(__u32)); | 1886 | sizeof(__be32)); |
1887 | if (rv == 0) | 1887 | if (rv == 0) |
1888 | break; | 1888 | break; |
1889 | } | 1889 | } |
@@ -1935,7 +1935,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1935 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ | 1935 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ |
1936 | for (i=0; i<psl->sl_count; i++) { | 1936 | for (i=0; i<psl->sl_count; i++) { |
1937 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, | 1937 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, |
1938 | sizeof(__u32)); | 1938 | sizeof(__be32)); |
1939 | if (rv == 0) | 1939 | if (rv == 0) |
1940 | break; | 1940 | break; |
1941 | } | 1941 | } |
@@ -1960,7 +1960,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex) | |||
1960 | { | 1960 | { |
1961 | int err = 0; | 1961 | int err = 0; |
1962 | struct ip_mreqn imr; | 1962 | struct ip_mreqn imr; |
1963 | u32 addr = msf->imsf_multiaddr; | 1963 | __be32 addr = msf->imsf_multiaddr; |
1964 | struct ip_mc_socklist *pmc; | 1964 | struct ip_mc_socklist *pmc; |
1965 | struct in_device *in_dev; | 1965 | struct in_device *in_dev; |
1966 | struct inet_sock *inet = inet_sk(sk); | 1966 | struct inet_sock *inet = inet_sk(sk); |
@@ -2044,7 +2044,7 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, | |||
2044 | { | 2044 | { |
2045 | int err, len, count, copycount; | 2045 | int err, len, count, copycount; |
2046 | struct ip_mreqn imr; | 2046 | struct ip_mreqn imr; |
2047 | u32 addr = msf->imsf_multiaddr; | 2047 | __be32 addr = msf->imsf_multiaddr; |
2048 | struct ip_mc_socklist *pmc; | 2048 | struct ip_mc_socklist *pmc; |
2049 | struct in_device *in_dev; | 2049 | struct in_device *in_dev; |
2050 | struct inet_sock *inet = inet_sk(sk); | 2050 | struct inet_sock *inet = inet_sk(sk); |
@@ -2103,7 +2103,7 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | |||
2103 | { | 2103 | { |
2104 | int err, i, count, copycount; | 2104 | int err, i, count, copycount; |
2105 | struct sockaddr_in *psin; | 2105 | struct sockaddr_in *psin; |
2106 | u32 addr; | 2106 | __be32 addr; |
2107 | struct ip_mc_socklist *pmc; | 2107 | struct ip_mc_socklist *pmc; |
2108 | struct inet_sock *inet = inet_sk(sk); | 2108 | struct inet_sock *inet = inet_sk(sk); |
2109 | struct ip_sf_socklist *psl; | 2109 | struct ip_sf_socklist *psl; |
@@ -2156,7 +2156,7 @@ done: | |||
2156 | /* | 2156 | /* |
2157 | * check if a multicast source filter allows delivery for a given <src,dst,intf> | 2157 | * check if a multicast source filter allows delivery for a given <src,dst,intf> |
2158 | */ | 2158 | */ |
2159 | int ip_mc_sf_allow(struct sock *sk, u32 loc_addr, u32 rmt_addr, int dif) | 2159 | int ip_mc_sf_allow(struct sock *sk, __be32 loc_addr, __be32 rmt_addr, int dif) |
2160 | { | 2160 | { |
2161 | struct inet_sock *inet = inet_sk(sk); | 2161 | struct inet_sock *inet = inet_sk(sk); |
2162 | struct ip_mc_socklist *pmc; | 2162 | struct ip_mc_socklist *pmc; |
@@ -2216,7 +2216,7 @@ void ip_mc_drop_socket(struct sock *sk) | |||
2216 | rtnl_unlock(); | 2216 | rtnl_unlock(); |
2217 | } | 2217 | } |
2218 | 2218 | ||
2219 | int ip_check_mc(struct in_device *in_dev, u32 mc_addr, u32 src_addr, u16 proto) | 2219 | int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto) |
2220 | { | 2220 | { |
2221 | struct ip_mc_list *im; | 2221 | struct ip_mc_list *im; |
2222 | struct ip_sf_list *psf; | 2222 | struct ip_sf_list *psf; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 07204391d083..96bbe2a0aa1b 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -39,7 +39,7 @@ int sysctl_local_port_range[2] = { 1024, 4999 }; | |||
39 | int inet_csk_bind_conflict(const struct sock *sk, | 39 | int inet_csk_bind_conflict(const struct sock *sk, |
40 | const struct inet_bind_bucket *tb) | 40 | const struct inet_bind_bucket *tb) |
41 | { | 41 | { |
42 | const u32 sk_rcv_saddr = inet_rcv_saddr(sk); | 42 | const __be32 sk_rcv_saddr = inet_rcv_saddr(sk); |
43 | struct sock *sk2; | 43 | struct sock *sk2; |
44 | struct hlist_node *node; | 44 | struct hlist_node *node; |
45 | int reuse = sk->sk_reuse; | 45 | int reuse = sk->sk_reuse; |
@@ -52,7 +52,7 @@ int inet_csk_bind_conflict(const struct sock *sk, | |||
52 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { | 52 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { |
53 | if (!reuse || !sk2->sk_reuse || | 53 | if (!reuse || !sk2->sk_reuse || |
54 | sk2->sk_state == TCP_LISTEN) { | 54 | sk2->sk_state == TCP_LISTEN) { |
55 | const u32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | 55 | const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); |
56 | if (!sk2_rcv_saddr || !sk_rcv_saddr || | 56 | if (!sk2_rcv_saddr || !sk_rcv_saddr || |
57 | sk2_rcv_saddr == sk_rcv_saddr) | 57 | sk2_rcv_saddr == sk_rcv_saddr) |
58 | break; | 58 | break; |
@@ -342,10 +342,10 @@ struct dst_entry* inet_csk_route_req(struct sock *sk, | |||
342 | 342 | ||
343 | EXPORT_SYMBOL_GPL(inet_csk_route_req); | 343 | EXPORT_SYMBOL_GPL(inet_csk_route_req); |
344 | 344 | ||
345 | static inline u32 inet_synq_hash(const u32 raddr, const u16 rport, | 345 | static inline u32 inet_synq_hash(const __be32 raddr, const __be16 rport, |
346 | const u32 rnd, const u16 synq_hsize) | 346 | const u32 rnd, const u16 synq_hsize) |
347 | { | 347 | { |
348 | return jhash_2words(raddr, (u32)rport, rnd) & (synq_hsize - 1); | 348 | return jhash_2words((__force u32)raddr, (__force u32)rport, rnd) & (synq_hsize - 1); |
349 | } | 349 | } |
350 | 350 | ||
351 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 351 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
@@ -356,8 +356,8 @@ static inline u32 inet_synq_hash(const u32 raddr, const u16 rport, | |||
356 | 356 | ||
357 | struct request_sock *inet_csk_search_req(const struct sock *sk, | 357 | struct request_sock *inet_csk_search_req(const struct sock *sk, |
358 | struct request_sock ***prevp, | 358 | struct request_sock ***prevp, |
359 | const __u16 rport, const __u32 raddr, | 359 | const __be16 rport, const __be32 raddr, |
360 | const __u32 laddr) | 360 | const __be32 laddr) |
361 | { | 361 | { |
362 | const struct inet_connection_sock *icsk = inet_csk(sk); | 362 | const struct inet_connection_sock *icsk = inet_csk(sk); |
363 | struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; | 363 | struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 492858e6faf0..77761ac4f7bb 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -36,8 +36,8 @@ | |||
36 | static const struct inet_diag_handler **inet_diag_table; | 36 | static const struct inet_diag_handler **inet_diag_table; |
37 | 37 | ||
38 | struct inet_diag_entry { | 38 | struct inet_diag_entry { |
39 | u32 *saddr; | 39 | __be32 *saddr; |
40 | u32 *daddr; | 40 | __be32 *daddr; |
41 | u16 sport; | 41 | u16 sport; |
42 | u16 dport; | 42 | u16 dport; |
43 | u16 family; | 43 | u16 family; |
@@ -294,7 +294,7 @@ out: | |||
294 | return err; | 294 | return err; |
295 | } | 295 | } |
296 | 296 | ||
297 | static int bitstring_match(const u32 *a1, const u32 *a2, int bits) | 297 | static int bitstring_match(const __be32 *a1, const __be32 *a2, int bits) |
298 | { | 298 | { |
299 | int words = bits >> 5; | 299 | int words = bits >> 5; |
300 | 300 | ||
@@ -305,8 +305,8 @@ static int bitstring_match(const u32 *a1, const u32 *a2, int bits) | |||
305 | return 0; | 305 | return 0; |
306 | } | 306 | } |
307 | if (bits) { | 307 | if (bits) { |
308 | __u32 w1, w2; | 308 | __be32 w1, w2; |
309 | __u32 mask; | 309 | __be32 mask; |
310 | 310 | ||
311 | w1 = a1[words]; | 311 | w1 = a1[words]; |
312 | w2 = a2[words]; | 312 | w2 = a2[words]; |
@@ -352,7 +352,7 @@ static int inet_diag_bc_run(const void *bc, int len, | |||
352 | case INET_DIAG_BC_S_COND: | 352 | case INET_DIAG_BC_S_COND: |
353 | case INET_DIAG_BC_D_COND: { | 353 | case INET_DIAG_BC_D_COND: { |
354 | struct inet_diag_hostcond *cond; | 354 | struct inet_diag_hostcond *cond; |
355 | u32 *addr; | 355 | __be32 *addr; |
356 | 356 | ||
357 | cond = (struct inet_diag_hostcond *)(op + 1); | 357 | cond = (struct inet_diag_hostcond *)(op + 1); |
358 | if (cond->port != -1 && | 358 | if (cond->port != -1 && |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index fb296c9a7f3f..244c4f445c7d 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -125,7 +125,7 @@ EXPORT_SYMBOL(inet_listen_wlock); | |||
125 | * wildcarded during the search since they can never be otherwise. | 125 | * wildcarded during the search since they can never be otherwise. |
126 | */ | 126 | */ |
127 | static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, | 127 | static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, |
128 | const u32 daddr, | 128 | const __be32 daddr, |
129 | const unsigned short hnum, | 129 | const unsigned short hnum, |
130 | const int dif) | 130 | const int dif) |
131 | { | 131 | { |
@@ -137,7 +137,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, | |||
137 | const struct inet_sock *inet = inet_sk(sk); | 137 | const struct inet_sock *inet = inet_sk(sk); |
138 | 138 | ||
139 | if (inet->num == hnum && !ipv6_only_sock(sk)) { | 139 | if (inet->num == hnum && !ipv6_only_sock(sk)) { |
140 | const __u32 rcv_saddr = inet->rcv_saddr; | 140 | const __be32 rcv_saddr = inet->rcv_saddr; |
141 | int score = sk->sk_family == PF_INET ? 1 : 0; | 141 | int score = sk->sk_family == PF_INET ? 1 : 0; |
142 | 142 | ||
143 | if (rcv_saddr) { | 143 | if (rcv_saddr) { |
@@ -163,7 +163,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, | |||
163 | 163 | ||
164 | /* Optimize the common listener case. */ | 164 | /* Optimize the common listener case. */ |
165 | struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, | 165 | struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, |
166 | const u32 daddr, const unsigned short hnum, | 166 | const __be32 daddr, const unsigned short hnum, |
167 | const int dif) | 167 | const int dif) |
168 | { | 168 | { |
169 | struct sock *sk = NULL; | 169 | struct sock *sk = NULL; |
@@ -197,11 +197,11 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row, | |||
197 | { | 197 | { |
198 | struct inet_hashinfo *hinfo = death_row->hashinfo; | 198 | struct inet_hashinfo *hinfo = death_row->hashinfo; |
199 | struct inet_sock *inet = inet_sk(sk); | 199 | struct inet_sock *inet = inet_sk(sk); |
200 | u32 daddr = inet->rcv_saddr; | 200 | __be32 daddr = inet->rcv_saddr; |
201 | u32 saddr = inet->daddr; | 201 | __be32 saddr = inet->daddr; |
202 | int dif = sk->sk_bound_dev_if; | 202 | int dif = sk->sk_bound_dev_if; |
203 | INET_ADDR_COOKIE(acookie, saddr, daddr) | 203 | INET_ADDR_COOKIE(acookie, saddr, daddr) |
204 | const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); | 204 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); |
205 | unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); | 205 | unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); |
206 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 206 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
207 | struct sock *sk2; | 207 | struct sock *sk2; |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index a675602ef295..2b1a54b59c48 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -163,7 +163,7 @@ static void unlink_from_unused(struct inet_peer *p) | |||
163 | for (u = peer_root; u != peer_avl_empty; ) { \ | 163 | for (u = peer_root; u != peer_avl_empty; ) { \ |
164 | if (daddr == u->v4daddr) \ | 164 | if (daddr == u->v4daddr) \ |
165 | break; \ | 165 | break; \ |
166 | if (daddr < u->v4daddr) \ | 166 | if ((__force __u32)daddr < (__force __u32)u->v4daddr) \ |
167 | v = &u->avl_left; \ | 167 | v = &u->avl_left; \ |
168 | else \ | 168 | else \ |
169 | v = &u->avl_right; \ | 169 | v = &u->avl_right; \ |
@@ -368,7 +368,7 @@ static int cleanup_once(unsigned long ttl) | |||
368 | } | 368 | } |
369 | 369 | ||
370 | /* Called with or without local BH being disabled. */ | 370 | /* Called with or without local BH being disabled. */ |
371 | struct inet_peer *inet_getpeer(__u32 daddr, int create) | 371 | struct inet_peer *inet_getpeer(__be32 daddr, int create) |
372 | { | 372 | { |
373 | struct inet_peer *p, *n; | 373 | struct inet_peer *p, *n; |
374 | struct inet_peer **stack[PEER_MAXDEPTH], ***stackptr; | 374 | struct inet_peer **stack[PEER_MAXDEPTH], ***stackptr; |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 165d72859ddf..74046efdf875 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -77,9 +77,9 @@ struct ipq { | |||
77 | struct hlist_node list; | 77 | struct hlist_node list; |
78 | struct list_head lru_list; /* lru list member */ | 78 | struct list_head lru_list; /* lru list member */ |
79 | u32 user; | 79 | u32 user; |
80 | u32 saddr; | 80 | __be32 saddr; |
81 | u32 daddr; | 81 | __be32 daddr; |
82 | u16 id; | 82 | __be16 id; |
83 | u8 protocol; | 83 | u8 protocol; |
84 | u8 last_in; | 84 | u8 last_in; |
85 | #define COMPLETE 4 | 85 | #define COMPLETE 4 |
@@ -123,9 +123,10 @@ static __inline__ void ipq_unlink(struct ipq *ipq) | |||
123 | write_unlock(&ipfrag_lock); | 123 | write_unlock(&ipfrag_lock); |
124 | } | 124 | } |
125 | 125 | ||
126 | static unsigned int ipqhashfn(u16 id, u32 saddr, u32 daddr, u8 prot) | 126 | static unsigned int ipqhashfn(__be16 id, __be32 saddr, __be32 daddr, u8 prot) |
127 | { | 127 | { |
128 | return jhash_3words((u32)id << 16 | prot, saddr, daddr, | 128 | return jhash_3words((__force u32)id << 16 | prot, |
129 | (__force u32)saddr, (__force u32)daddr, | ||
129 | ipfrag_hash_rnd) & (IPQ_HASHSZ - 1); | 130 | ipfrag_hash_rnd) & (IPQ_HASHSZ - 1); |
130 | } | 131 | } |
131 | 132 | ||
@@ -387,8 +388,8 @@ out_nomem: | |||
387 | static inline struct ipq *ip_find(struct iphdr *iph, u32 user) | 388 | static inline struct ipq *ip_find(struct iphdr *iph, u32 user) |
388 | { | 389 | { |
389 | __be16 id = iph->id; | 390 | __be16 id = iph->id; |
390 | __u32 saddr = iph->saddr; | 391 | __be32 saddr = iph->saddr; |
391 | __u32 daddr = iph->daddr; | 392 | __be32 daddr = iph->daddr; |
392 | __u8 protocol = iph->protocol; | 393 | __u8 protocol = iph->protocol; |
393 | unsigned int hash; | 394 | unsigned int hash; |
394 | struct ipq *qp; | 395 | struct ipq *qp; |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index e7437c091326..8dabbfc31267 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -38,7 +38,7 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | void ip_options_build(struct sk_buff * skb, struct ip_options * opt, | 40 | void ip_options_build(struct sk_buff * skb, struct ip_options * opt, |
41 | u32 daddr, struct rtable *rt, int is_frag) | 41 | __be32 daddr, struct rtable *rt, int is_frag) |
42 | { | 42 | { |
43 | unsigned char * iph = skb->nh.raw; | 43 | unsigned char * iph = skb->nh.raw; |
44 | 44 | ||
@@ -57,7 +57,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, | |||
57 | ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt); | 57 | ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt); |
58 | if (opt->ts_needtime) { | 58 | if (opt->ts_needtime) { |
59 | struct timeval tv; | 59 | struct timeval tv; |
60 | __u32 midtime; | 60 | __be32 midtime; |
61 | do_gettimeofday(&tv); | 61 | do_gettimeofday(&tv); |
62 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); | 62 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); |
63 | memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); | 63 | memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); |
@@ -91,7 +91,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
91 | unsigned char *sptr, *dptr; | 91 | unsigned char *sptr, *dptr; |
92 | int soffset, doffset; | 92 | int soffset, doffset; |
93 | int optlen; | 93 | int optlen; |
94 | u32 daddr; | 94 | __be32 daddr; |
95 | 95 | ||
96 | memset(dopt, 0, sizeof(struct ip_options)); | 96 | memset(dopt, 0, sizeof(struct ip_options)); |
97 | 97 | ||
@@ -148,7 +148,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
148 | dopt->ts_needtime = 0; | 148 | dopt->ts_needtime = 0; |
149 | 149 | ||
150 | if (soffset + 8 <= optlen) { | 150 | if (soffset + 8 <= optlen) { |
151 | __u32 addr; | 151 | __be32 addr; |
152 | 152 | ||
153 | memcpy(&addr, sptr+soffset-1, 4); | 153 | memcpy(&addr, sptr+soffset-1, 4); |
154 | if (inet_addr_type(addr) != RTN_LOCAL) { | 154 | if (inet_addr_type(addr) != RTN_LOCAL) { |
@@ -165,7 +165,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
165 | } | 165 | } |
166 | if (sopt->srr) { | 166 | if (sopt->srr) { |
167 | unsigned char * start = sptr+sopt->srr; | 167 | unsigned char * start = sptr+sopt->srr; |
168 | u32 faddr; | 168 | __be32 faddr; |
169 | 169 | ||
170 | optlen = start[1]; | 170 | optlen = start[1]; |
171 | soffset = start[2]; | 171 | soffset = start[2]; |
@@ -362,7 +362,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
362 | goto error; | 362 | goto error; |
363 | } | 363 | } |
364 | if (optptr[2] <= optlen) { | 364 | if (optptr[2] <= optlen) { |
365 | __u32 * timeptr = NULL; | 365 | __be32 *timeptr = NULL; |
366 | if (optptr[2]+3 > optptr[1]) { | 366 | if (optptr[2]+3 > optptr[1]) { |
367 | pp_ptr = optptr + 2; | 367 | pp_ptr = optptr + 2; |
368 | goto error; | 368 | goto error; |
@@ -371,7 +371,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
371 | case IPOPT_TS_TSONLY: | 371 | case IPOPT_TS_TSONLY: |
372 | opt->ts = optptr - iph; | 372 | opt->ts = optptr - iph; |
373 | if (skb) | 373 | if (skb) |
374 | timeptr = (__u32*)&optptr[optptr[2]-1]; | 374 | timeptr = (__be32*)&optptr[optptr[2]-1]; |
375 | opt->ts_needtime = 1; | 375 | opt->ts_needtime = 1; |
376 | optptr[2] += 4; | 376 | optptr[2] += 4; |
377 | break; | 377 | break; |
@@ -383,7 +383,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
383 | opt->ts = optptr - iph; | 383 | opt->ts = optptr - iph; |
384 | if (skb) { | 384 | if (skb) { |
385 | memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); | 385 | memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); |
386 | timeptr = (__u32*)&optptr[optptr[2]+3]; | 386 | timeptr = (__be32*)&optptr[optptr[2]+3]; |
387 | } | 387 | } |
388 | opt->ts_needaddr = 1; | 388 | opt->ts_needaddr = 1; |
389 | opt->ts_needtime = 1; | 389 | opt->ts_needtime = 1; |
@@ -396,12 +396,12 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
396 | } | 396 | } |
397 | opt->ts = optptr - iph; | 397 | opt->ts = optptr - iph; |
398 | { | 398 | { |
399 | u32 addr; | 399 | __be32 addr; |
400 | memcpy(&addr, &optptr[optptr[2]-1], 4); | 400 | memcpy(&addr, &optptr[optptr[2]-1], 4); |
401 | if (inet_addr_type(addr) == RTN_UNICAST) | 401 | if (inet_addr_type(addr) == RTN_UNICAST) |
402 | break; | 402 | break; |
403 | if (skb) | 403 | if (skb) |
404 | timeptr = (__u32*)&optptr[optptr[2]+3]; | 404 | timeptr = (__be32*)&optptr[optptr[2]+3]; |
405 | } | 405 | } |
406 | opt->ts_needtime = 1; | 406 | opt->ts_needtime = 1; |
407 | optptr[2] += 8; | 407 | optptr[2] += 8; |
@@ -415,10 +415,10 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
415 | } | 415 | } |
416 | if (timeptr) { | 416 | if (timeptr) { |
417 | struct timeval tv; | 417 | struct timeval tv; |
418 | __u32 midtime; | 418 | __be32 midtime; |
419 | do_gettimeofday(&tv); | 419 | do_gettimeofday(&tv); |
420 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); | 420 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); |
421 | memcpy(timeptr, &midtime, sizeof(__u32)); | 421 | memcpy(timeptr, &midtime, sizeof(__be32)); |
422 | opt->is_changed = 1; | 422 | opt->is_changed = 1; |
423 | } | 423 | } |
424 | } else { | 424 | } else { |
@@ -607,7 +607,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) | |||
607 | { | 607 | { |
608 | struct ip_options *opt = &(IPCB(skb)->opt); | 608 | struct ip_options *opt = &(IPCB(skb)->opt); |
609 | int srrspace, srrptr; | 609 | int srrspace, srrptr; |
610 | u32 nexthop; | 610 | __be32 nexthop; |
611 | struct iphdr *iph = skb->nh.iph; | 611 | struct iphdr *iph = skb->nh.iph; |
612 | unsigned char * optptr = skb->nh.raw + opt->srr; | 612 | unsigned char * optptr = skb->nh.raw + opt->srr; |
613 | struct rtable *rt = (struct rtable*)skb->dst; | 613 | struct rtable *rt = (struct rtable*)skb->dst; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 97aee76fb746..fc195a44fc2e 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -118,7 +118,7 @@ static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) | |||
118 | * | 118 | * |
119 | */ | 119 | */ |
120 | int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | 120 | int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, |
121 | u32 saddr, u32 daddr, struct ip_options *opt) | 121 | __be32 saddr, __be32 daddr, struct ip_options *opt) |
122 | { | 122 | { |
123 | struct inet_sock *inet = inet_sk(sk); | 123 | struct inet_sock *inet = inet_sk(sk); |
124 | struct rtable *rt = (struct rtable *)skb->dst; | 124 | struct rtable *rt = (struct rtable *)skb->dst; |
@@ -306,7 +306,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) | |||
306 | /* Make sure we can route this packet. */ | 306 | /* Make sure we can route this packet. */ |
307 | rt = (struct rtable *)__sk_dst_check(sk, 0); | 307 | rt = (struct rtable *)__sk_dst_check(sk, 0); |
308 | if (rt == NULL) { | 308 | if (rt == NULL) { |
309 | u32 daddr; | 309 | __be32 daddr; |
310 | 310 | ||
311 | /* Use correct destination address if we have options. */ | 311 | /* Use correct destination address if we have options. */ |
312 | daddr = inet->daddr; | 312 | daddr = inet->daddr; |
@@ -1340,7 +1340,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1340 | char data[40]; | 1340 | char data[40]; |
1341 | } replyopts; | 1341 | } replyopts; |
1342 | struct ipcm_cookie ipc; | 1342 | struct ipcm_cookie ipc; |
1343 | u32 daddr; | 1343 | __be32 daddr; |
1344 | struct rtable *rt = (struct rtable*)skb->dst; | 1344 | struct rtable *rt = (struct rtable*)skb->dst; |
1345 | 1345 | ||
1346 | if (ip_options_echo(&replyopts.opt, skb)) | 1346 | if (ip_options_echo(&replyopts.opt, skb)) |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 2d05c4133d3e..4b132953bcc2 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -254,7 +254,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s | |||
254 | } | 254 | } |
255 | 255 | ||
256 | void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | 256 | void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, |
257 | u16 port, u32 info, u8 *payload) | 257 | __be16 port, u32 info, u8 *payload) |
258 | { | 258 | { |
259 | struct inet_sock *inet = inet_sk(sk); | 259 | struct inet_sock *inet = inet_sk(sk); |
260 | struct sock_exterr_skb *serr; | 260 | struct sock_exterr_skb *serr; |
@@ -283,7 +283,7 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | |||
283 | kfree_skb(skb); | 283 | kfree_skb(skb); |
284 | } | 284 | } |
285 | 285 | ||
286 | void ip_local_error(struct sock *sk, int err, u32 daddr, u16 port, u32 info) | 286 | void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 info) |
287 | { | 287 | { |
288 | struct inet_sock *inet = inet_sk(sk); | 288 | struct inet_sock *inet = inet_sk(sk); |
289 | struct sock_exterr_skb *serr; | 289 | struct sock_exterr_skb *serr; |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 17342430a843..2017d36024d4 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -183,7 +183,7 @@ out_ok: | |||
183 | 183 | ||
184 | static void ipcomp4_err(struct sk_buff *skb, u32 info) | 184 | static void ipcomp4_err(struct sk_buff *skb, u32 info) |
185 | { | 185 | { |
186 | u32 spi; | 186 | __be32 spi; |
187 | struct iphdr *iph = (struct iphdr *)skb->data; | 187 | struct iphdr *iph = (struct iphdr *)skb->data; |
188 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); | 188 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); |
189 | struct xfrm_state *x; | 189 | struct xfrm_state *x; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index ba49588da242..97cfa97c8abb 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -462,7 +462,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) | |||
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | 464 | ||
465 | static struct mfc_cache *ipmr_cache_find(__u32 origin, __u32 mcastgrp) | 465 | static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp) |
466 | { | 466 | { |
467 | int line=MFC_HASH(mcastgrp,origin); | 467 | int line=MFC_HASH(mcastgrp,origin); |
468 | struct mfc_cache *c; | 468 | struct mfc_cache *c; |
@@ -1097,7 +1097,7 @@ static struct notifier_block ip_mr_notifier={ | |||
1097 | * important for multicast video. | 1097 | * important for multicast video. |
1098 | */ | 1098 | */ |
1099 | 1099 | ||
1100 | static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr) | 1100 | static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) |
1101 | { | 1101 | { |
1102 | struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); | 1102 | struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); |
1103 | 1103 | ||
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index 87b83813cf2c..8832eb517d52 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
@@ -115,9 +115,9 @@ static inline void ct_write_unlock_bh(unsigned key) | |||
115 | /* | 115 | /* |
116 | * Returns hash value for IPVS connection entry | 116 | * Returns hash value for IPVS connection entry |
117 | */ | 117 | */ |
118 | static unsigned int ip_vs_conn_hashkey(unsigned proto, __u32 addr, __u16 port) | 118 | static unsigned int ip_vs_conn_hashkey(unsigned proto, __be32 addr, __be16 port) |
119 | { | 119 | { |
120 | return jhash_3words(addr, port, proto, ip_vs_conn_rnd) | 120 | return jhash_3words((__force u32)addr, (__force u32)port, proto, ip_vs_conn_rnd) |
121 | & IP_VS_CONN_TAB_MASK; | 121 | & IP_VS_CONN_TAB_MASK; |
122 | } | 122 | } |
123 | 123 | ||
@@ -188,7 +188,7 @@ static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp) | |||
188 | * d_addr, d_port: pkt dest address (load balancer) | 188 | * d_addr, d_port: pkt dest address (load balancer) |
189 | */ | 189 | */ |
190 | static inline struct ip_vs_conn *__ip_vs_conn_in_get | 190 | static inline struct ip_vs_conn *__ip_vs_conn_in_get |
191 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 191 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
192 | { | 192 | { |
193 | unsigned hash; | 193 | unsigned hash; |
194 | struct ip_vs_conn *cp; | 194 | struct ip_vs_conn *cp; |
@@ -215,7 +215,7 @@ static inline struct ip_vs_conn *__ip_vs_conn_in_get | |||
215 | } | 215 | } |
216 | 216 | ||
217 | struct ip_vs_conn *ip_vs_conn_in_get | 217 | struct ip_vs_conn *ip_vs_conn_in_get |
218 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 218 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
219 | { | 219 | { |
220 | struct ip_vs_conn *cp; | 220 | struct ip_vs_conn *cp; |
221 | 221 | ||
@@ -234,7 +234,7 @@ struct ip_vs_conn *ip_vs_conn_in_get | |||
234 | 234 | ||
235 | /* Get reference to connection template */ | 235 | /* Get reference to connection template */ |
236 | struct ip_vs_conn *ip_vs_ct_in_get | 236 | struct ip_vs_conn *ip_vs_ct_in_get |
237 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 237 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
238 | { | 238 | { |
239 | unsigned hash; | 239 | unsigned hash; |
240 | struct ip_vs_conn *cp; | 240 | struct ip_vs_conn *cp; |
@@ -274,7 +274,7 @@ struct ip_vs_conn *ip_vs_ct_in_get | |||
274 | * d_addr, d_port: pkt dest address (foreign host) | 274 | * d_addr, d_port: pkt dest address (foreign host) |
275 | */ | 275 | */ |
276 | struct ip_vs_conn *ip_vs_conn_out_get | 276 | struct ip_vs_conn *ip_vs_conn_out_get |
277 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 277 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
278 | { | 278 | { |
279 | unsigned hash; | 279 | unsigned hash; |
280 | struct ip_vs_conn *cp, *ret=NULL; | 280 | struct ip_vs_conn *cp, *ret=NULL; |
@@ -324,7 +324,7 @@ void ip_vs_conn_put(struct ip_vs_conn *cp) | |||
324 | /* | 324 | /* |
325 | * Fill a no_client_port connection with a client port number | 325 | * Fill a no_client_port connection with a client port number |
326 | */ | 326 | */ |
327 | void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport) | 327 | void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport) |
328 | { | 328 | { |
329 | if (ip_vs_conn_unhash(cp)) { | 329 | if (ip_vs_conn_unhash(cp)) { |
330 | spin_lock(&cp->lock); | 330 | spin_lock(&cp->lock); |
@@ -508,10 +508,10 @@ int ip_vs_check_template(struct ip_vs_conn *ct) | |||
508 | /* | 508 | /* |
509 | * Invalidate the connection template | 509 | * Invalidate the connection template |
510 | */ | 510 | */ |
511 | if (ct->vport != 65535) { | 511 | if (ct->vport != htons(0xffff)) { |
512 | if (ip_vs_conn_unhash(ct)) { | 512 | if (ip_vs_conn_unhash(ct)) { |
513 | ct->dport = 65535; | 513 | ct->dport = htons(0xffff); |
514 | ct->vport = 65535; | 514 | ct->vport = htons(0xffff); |
515 | ct->cport = 0; | 515 | ct->cport = 0; |
516 | ip_vs_conn_hash(ct); | 516 | ip_vs_conn_hash(ct); |
517 | } | 517 | } |
@@ -596,8 +596,8 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp) | |||
596 | * Create a new connection entry and hash it into the ip_vs_conn_tab | 596 | * Create a new connection entry and hash it into the ip_vs_conn_tab |
597 | */ | 597 | */ |
598 | struct ip_vs_conn * | 598 | struct ip_vs_conn * |
599 | ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport, | 599 | ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport, |
600 | __u32 daddr, __u16 dport, unsigned flags, | 600 | __be32 daddr, __be16 dport, unsigned flags, |
601 | struct ip_vs_dest *dest) | 601 | struct ip_vs_dest *dest) |
602 | { | 602 | { |
603 | struct ip_vs_conn *cp; | 603 | struct ip_vs_conn *cp; |
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index 3f47ad8e1cad..6dee03935f78 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c | |||
@@ -209,14 +209,14 @@ int ip_vs_make_skb_writable(struct sk_buff **pskb, int writable_len) | |||
209 | static struct ip_vs_conn * | 209 | static struct ip_vs_conn * |
210 | ip_vs_sched_persist(struct ip_vs_service *svc, | 210 | ip_vs_sched_persist(struct ip_vs_service *svc, |
211 | const struct sk_buff *skb, | 211 | const struct sk_buff *skb, |
212 | __u16 ports[2]) | 212 | __be16 ports[2]) |
213 | { | 213 | { |
214 | struct ip_vs_conn *cp = NULL; | 214 | struct ip_vs_conn *cp = NULL; |
215 | struct iphdr *iph = skb->nh.iph; | 215 | struct iphdr *iph = skb->nh.iph; |
216 | struct ip_vs_dest *dest; | 216 | struct ip_vs_dest *dest; |
217 | struct ip_vs_conn *ct; | 217 | struct ip_vs_conn *ct; |
218 | __u16 dport; /* destination port to forward */ | 218 | __be16 dport; /* destination port to forward */ |
219 | __u32 snet; /* source network of the client, after masking */ | 219 | __be32 snet; /* source network of the client, after masking */ |
220 | 220 | ||
221 | /* Mask saddr with the netmask to adjust template granularity */ | 221 | /* Mask saddr with the netmask to adjust template granularity */ |
222 | snet = iph->saddr & svc->netmask; | 222 | snet = iph->saddr & svc->netmask; |
@@ -383,7 +383,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
383 | struct ip_vs_conn *cp = NULL; | 383 | struct ip_vs_conn *cp = NULL; |
384 | struct iphdr *iph = skb->nh.iph; | 384 | struct iphdr *iph = skb->nh.iph; |
385 | struct ip_vs_dest *dest; | 385 | struct ip_vs_dest *dest; |
386 | __u16 _ports[2], *pptr; | 386 | __be16 _ports[2], *pptr; |
387 | 387 | ||
388 | pptr = skb_header_pointer(skb, iph->ihl*4, | 388 | pptr = skb_header_pointer(skb, iph->ihl*4, |
389 | sizeof(_ports), _ports); | 389 | sizeof(_ports), _ports); |
@@ -446,7 +446,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
446 | int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, | 446 | int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, |
447 | struct ip_vs_protocol *pp) | 447 | struct ip_vs_protocol *pp) |
448 | { | 448 | { |
449 | __u16 _ports[2], *pptr; | 449 | __be16 _ports[2], *pptr; |
450 | struct iphdr *iph = skb->nh.iph; | 450 | struct iphdr *iph = skb->nh.iph; |
451 | 451 | ||
452 | pptr = skb_header_pointer(skb, iph->ihl*4, | 452 | pptr = skb_header_pointer(skb, iph->ihl*4, |
@@ -576,7 +576,7 @@ void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
576 | 576 | ||
577 | /* the TCP/UDP port */ | 577 | /* the TCP/UDP port */ |
578 | if (IPPROTO_TCP == ciph->protocol || IPPROTO_UDP == ciph->protocol) { | 578 | if (IPPROTO_TCP == ciph->protocol || IPPROTO_UDP == ciph->protocol) { |
579 | __u16 *ports = (void *)ciph + ciph->ihl*4; | 579 | __be16 *ports = (void *)ciph + ciph->ihl*4; |
580 | 580 | ||
581 | if (inout) | 581 | if (inout) |
582 | ports[1] = cp->vport; | 582 | ports[1] = cp->vport; |
@@ -775,7 +775,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb, | |||
775 | if (sysctl_ip_vs_nat_icmp_send && | 775 | if (sysctl_ip_vs_nat_icmp_send && |
776 | (pp->protocol == IPPROTO_TCP || | 776 | (pp->protocol == IPPROTO_TCP || |
777 | pp->protocol == IPPROTO_UDP)) { | 777 | pp->protocol == IPPROTO_UDP)) { |
778 | __u16 _ports[2], *pptr; | 778 | __be16 _ports[2], *pptr; |
779 | 779 | ||
780 | pptr = skb_header_pointer(skb, ihl, | 780 | pptr = skb_header_pointer(skb, ihl, |
781 | sizeof(_ports), _ports); | 781 | sizeof(_ports), _ports); |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 6a28fafe910c..f261616e4602 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -283,7 +283,7 @@ static atomic_t ip_vs_nullsvc_counter = ATOMIC_INIT(0); | |||
283 | * Returns hash value for virtual service | 283 | * Returns hash value for virtual service |
284 | */ | 284 | */ |
285 | static __inline__ unsigned | 285 | static __inline__ unsigned |
286 | ip_vs_svc_hashkey(unsigned proto, __u32 addr, __u16 port) | 286 | ip_vs_svc_hashkey(unsigned proto, __be32 addr, __be16 port) |
287 | { | 287 | { |
288 | register unsigned porth = ntohs(port); | 288 | register unsigned porth = ntohs(port); |
289 | 289 | ||
@@ -365,7 +365,7 @@ static int ip_vs_svc_unhash(struct ip_vs_service *svc) | |||
365 | * Get service by {proto,addr,port} in the service table. | 365 | * Get service by {proto,addr,port} in the service table. |
366 | */ | 366 | */ |
367 | static __inline__ struct ip_vs_service * | 367 | static __inline__ struct ip_vs_service * |
368 | __ip_vs_service_get(__u16 protocol, __u32 vaddr, __u16 vport) | 368 | __ip_vs_service_get(__u16 protocol, __be32 vaddr, __be16 vport) |
369 | { | 369 | { |
370 | unsigned hash; | 370 | unsigned hash; |
371 | struct ip_vs_service *svc; | 371 | struct ip_vs_service *svc; |
@@ -410,7 +410,7 @@ static __inline__ struct ip_vs_service *__ip_vs_svc_fwm_get(__u32 fwmark) | |||
410 | } | 410 | } |
411 | 411 | ||
412 | struct ip_vs_service * | 412 | struct ip_vs_service * |
413 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport) | 413 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport) |
414 | { | 414 | { |
415 | struct ip_vs_service *svc; | 415 | struct ip_vs_service *svc; |
416 | 416 | ||
@@ -480,7 +480,7 @@ __ip_vs_unbind_svc(struct ip_vs_dest *dest) | |||
480 | /* | 480 | /* |
481 | * Returns hash value for real service | 481 | * Returns hash value for real service |
482 | */ | 482 | */ |
483 | static __inline__ unsigned ip_vs_rs_hashkey(__u32 addr, __u16 port) | 483 | static __inline__ unsigned ip_vs_rs_hashkey(__be32 addr, __be16 port) |
484 | { | 484 | { |
485 | register unsigned porth = ntohs(port); | 485 | register unsigned porth = ntohs(port); |
486 | 486 | ||
@@ -531,7 +531,7 @@ static int ip_vs_rs_unhash(struct ip_vs_dest *dest) | |||
531 | * Lookup real service by <proto,addr,port> in the real service table. | 531 | * Lookup real service by <proto,addr,port> in the real service table. |
532 | */ | 532 | */ |
533 | struct ip_vs_dest * | 533 | struct ip_vs_dest * |
534 | ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport) | 534 | ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport) |
535 | { | 535 | { |
536 | unsigned hash; | 536 | unsigned hash; |
537 | struct ip_vs_dest *dest; | 537 | struct ip_vs_dest *dest; |
@@ -562,7 +562,7 @@ ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport) | |||
562 | * Lookup destination by {addr,port} in the given service | 562 | * Lookup destination by {addr,port} in the given service |
563 | */ | 563 | */ |
564 | static struct ip_vs_dest * | 564 | static struct ip_vs_dest * |
565 | ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) | 565 | ip_vs_lookup_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport) |
566 | { | 566 | { |
567 | struct ip_vs_dest *dest; | 567 | struct ip_vs_dest *dest; |
568 | 568 | ||
@@ -591,7 +591,7 @@ ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) | |||
591 | * scheduling. | 591 | * scheduling. |
592 | */ | 592 | */ |
593 | static struct ip_vs_dest * | 593 | static struct ip_vs_dest * |
594 | ip_vs_trash_get_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) | 594 | ip_vs_trash_get_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport) |
595 | { | 595 | { |
596 | struct ip_vs_dest *dest, *nxt; | 596 | struct ip_vs_dest *dest, *nxt; |
597 | 597 | ||
@@ -773,8 +773,8 @@ static int | |||
773 | ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) | 773 | ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) |
774 | { | 774 | { |
775 | struct ip_vs_dest *dest; | 775 | struct ip_vs_dest *dest; |
776 | __u32 daddr = udest->addr; | 776 | __be32 daddr = udest->addr; |
777 | __u16 dport = udest->port; | 777 | __be16 dport = udest->port; |
778 | int ret; | 778 | int ret; |
779 | 779 | ||
780 | EnterFunction(2); | 780 | EnterFunction(2); |
@@ -879,8 +879,8 @@ static int | |||
879 | ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) | 879 | ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) |
880 | { | 880 | { |
881 | struct ip_vs_dest *dest; | 881 | struct ip_vs_dest *dest; |
882 | __u32 daddr = udest->addr; | 882 | __be32 daddr = udest->addr; |
883 | __u16 dport = udest->port; | 883 | __be16 dport = udest->port; |
884 | 884 | ||
885 | EnterFunction(2); | 885 | EnterFunction(2); |
886 | 886 | ||
@@ -991,8 +991,8 @@ static int | |||
991 | ip_vs_del_dest(struct ip_vs_service *svc,struct ip_vs_dest_user *udest) | 991 | ip_vs_del_dest(struct ip_vs_service *svc,struct ip_vs_dest_user *udest) |
992 | { | 992 | { |
993 | struct ip_vs_dest *dest; | 993 | struct ip_vs_dest *dest; |
994 | __u32 daddr = udest->addr; | 994 | __be32 daddr = udest->addr; |
995 | __u16 dport = udest->port; | 995 | __be16 dport = udest->port; |
996 | 996 | ||
997 | EnterFunction(2); | 997 | EnterFunction(2); |
998 | 998 | ||
diff --git a/net/ipv4/ipvs/ip_vs_dh.c b/net/ipv4/ipvs/ip_vs_dh.c index 9fee19c4c617..502111fba872 100644 --- a/net/ipv4/ipvs/ip_vs_dh.c +++ b/net/ipv4/ipvs/ip_vs_dh.c | |||
@@ -66,7 +66,7 @@ struct ip_vs_dh_bucket { | |||
66 | /* | 66 | /* |
67 | * Returns hash value for IPVS DH entry | 67 | * Returns hash value for IPVS DH entry |
68 | */ | 68 | */ |
69 | static inline unsigned ip_vs_dh_hashkey(__u32 addr) | 69 | static inline unsigned ip_vs_dh_hashkey(__be32 addr) |
70 | { | 70 | { |
71 | return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK; | 71 | return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK; |
72 | } | 72 | } |
@@ -76,7 +76,7 @@ static inline unsigned ip_vs_dh_hashkey(__u32 addr) | |||
76 | * Get ip_vs_dest associated with supplied parameters. | 76 | * Get ip_vs_dest associated with supplied parameters. |
77 | */ | 77 | */ |
78 | static inline struct ip_vs_dest * | 78 | static inline struct ip_vs_dest * |
79 | ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __u32 addr) | 79 | ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __be32 addr) |
80 | { | 80 | { |
81 | return (tbl[ip_vs_dh_hashkey(addr)]).dest; | 81 | return (tbl[ip_vs_dh_hashkey(addr)]).dest; |
82 | } | 82 | } |
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c index 37fafb1fbcff..e433cb0ff894 100644 --- a/net/ipv4/ipvs/ip_vs_ftp.c +++ b/net/ipv4/ipvs/ip_vs_ftp.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
33 | #include <net/protocol.h> | 33 | #include <net/protocol.h> |
34 | #include <net/tcp.h> | 34 | #include <net/tcp.h> |
35 | #include <asm/unaligned.h> | ||
35 | 36 | ||
36 | #include <net/ip_vs.h> | 37 | #include <net/ip_vs.h> |
37 | 38 | ||
@@ -44,8 +45,8 @@ | |||
44 | * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper | 45 | * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper |
45 | * First port is set to the default port. | 46 | * First port is set to the default port. |
46 | */ | 47 | */ |
47 | static int ports[IP_VS_APP_MAX_PORTS] = {21, 0}; | 48 | static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0}; |
48 | module_param_array(ports, int, NULL, 0); | 49 | module_param_array(ports, ushort, NULL, 0); |
49 | MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); | 50 | MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); |
50 | 51 | ||
51 | 52 | ||
@@ -74,7 +75,7 @@ ip_vs_ftp_done_conn(struct ip_vs_app *app, struct ip_vs_conn *cp) | |||
74 | */ | 75 | */ |
75 | static int ip_vs_ftp_get_addrport(char *data, char *data_limit, | 76 | static int ip_vs_ftp_get_addrport(char *data, char *data_limit, |
76 | const char *pattern, size_t plen, char term, | 77 | const char *pattern, size_t plen, char term, |
77 | __u32 *addr, __u16 *port, | 78 | __be32 *addr, __be16 *port, |
78 | char **start, char **end) | 79 | char **start, char **end) |
79 | { | 80 | { |
80 | unsigned char p[6]; | 81 | unsigned char p[6]; |
@@ -114,8 +115,8 @@ static int ip_vs_ftp_get_addrport(char *data, char *data_limit, | |||
114 | if (i != 5) | 115 | if (i != 5) |
115 | return -1; | 116 | return -1; |
116 | 117 | ||
117 | *addr = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0]; | 118 | *addr = get_unaligned((__be32 *)p); |
118 | *port = (p[5]<<8) | p[4]; | 119 | *port = get_unaligned((__be16 *)(p + 4)); |
119 | return 1; | 120 | return 1; |
120 | } | 121 | } |
121 | 122 | ||
@@ -140,8 +141,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
140 | struct tcphdr *th; | 141 | struct tcphdr *th; |
141 | char *data, *data_limit; | 142 | char *data, *data_limit; |
142 | char *start, *end; | 143 | char *start, *end; |
143 | __u32 from; | 144 | __be32 from; |
144 | __u16 port; | 145 | __be16 port; |
145 | struct ip_vs_conn *n_cp; | 146 | struct ip_vs_conn *n_cp; |
146 | char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */ | 147 | char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */ |
147 | unsigned buf_len; | 148 | unsigned buf_len; |
@@ -199,7 +200,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
199 | from = n_cp->vaddr; | 200 | from = n_cp->vaddr; |
200 | port = n_cp->vport; | 201 | port = n_cp->vport; |
201 | sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from), | 202 | sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from), |
202 | port&255, (port>>8)&255); | 203 | ntohs(port)&255, (ntohs(port)>>8)&255); |
203 | buf_len = strlen(buf); | 204 | buf_len = strlen(buf); |
204 | 205 | ||
205 | /* | 206 | /* |
@@ -243,8 +244,8 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
243 | struct tcphdr *th; | 244 | struct tcphdr *th; |
244 | char *data, *data_start, *data_limit; | 245 | char *data, *data_start, *data_limit; |
245 | char *start, *end; | 246 | char *start, *end; |
246 | __u32 to; | 247 | __be32 to; |
247 | __u16 port; | 248 | __be16 port; |
248 | struct ip_vs_conn *n_cp; | 249 | struct ip_vs_conn *n_cp; |
249 | 250 | ||
250 | /* no diff required for incoming packets */ | 251 | /* no diff required for incoming packets */ |
@@ -365,12 +366,6 @@ static int __init ip_vs_ftp_init(void) | |||
365 | for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { | 366 | for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { |
366 | if (!ports[i]) | 367 | if (!ports[i]) |
367 | continue; | 368 | continue; |
368 | if (ports[i] < 0 || ports[i] > 0xffff) { | ||
369 | IP_VS_WARNING("ip_vs_ftp: Ignoring invalid " | ||
370 | "configuration port[%d] = %d\n", | ||
371 | i, ports[i]); | ||
372 | continue; | ||
373 | } | ||
374 | ret = register_ip_vs_app_inc(app, app->protocol, ports[i]); | 369 | ret = register_ip_vs_app_inc(app, app->protocol, ports[i]); |
375 | if (ret) | 370 | if (ret) |
376 | break; | 371 | break; |
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c index 6e5cb92a5c83..524751e031de 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/ipv4/ipvs/ip_vs_lblc.c | |||
@@ -87,7 +87,7 @@ static int sysctl_ip_vs_lblc_expiration = 24*60*60*HZ; | |||
87 | */ | 87 | */ |
88 | struct ip_vs_lblc_entry { | 88 | struct ip_vs_lblc_entry { |
89 | struct list_head list; | 89 | struct list_head list; |
90 | __u32 addr; /* destination IP address */ | 90 | __be32 addr; /* destination IP address */ |
91 | struct ip_vs_dest *dest; /* real server (cache) */ | 91 | struct ip_vs_dest *dest; /* real server (cache) */ |
92 | unsigned long lastuse; /* last used time */ | 92 | unsigned long lastuse; /* last used time */ |
93 | }; | 93 | }; |
@@ -160,7 +160,7 @@ static struct ctl_table_header * sysctl_header; | |||
160 | * IP address to a server. | 160 | * IP address to a server. |
161 | */ | 161 | */ |
162 | static inline struct ip_vs_lblc_entry * | 162 | static inline struct ip_vs_lblc_entry * |
163 | ip_vs_lblc_new(__u32 daddr, struct ip_vs_dest *dest) | 163 | ip_vs_lblc_new(__be32 daddr, struct ip_vs_dest *dest) |
164 | { | 164 | { |
165 | struct ip_vs_lblc_entry *en; | 165 | struct ip_vs_lblc_entry *en; |
166 | 166 | ||
@@ -195,7 +195,7 @@ static inline void ip_vs_lblc_free(struct ip_vs_lblc_entry *en) | |||
195 | /* | 195 | /* |
196 | * Returns hash value for IPVS LBLC entry | 196 | * Returns hash value for IPVS LBLC entry |
197 | */ | 197 | */ |
198 | static inline unsigned ip_vs_lblc_hashkey(__u32 addr) | 198 | static inline unsigned ip_vs_lblc_hashkey(__be32 addr) |
199 | { | 199 | { |
200 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLC_TAB_MASK; | 200 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLC_TAB_MASK; |
201 | } | 201 | } |
@@ -234,7 +234,7 @@ ip_vs_lblc_hash(struct ip_vs_lblc_table *tbl, struct ip_vs_lblc_entry *en) | |||
234 | * Get ip_vs_lblc_entry associated with supplied parameters. | 234 | * Get ip_vs_lblc_entry associated with supplied parameters. |
235 | */ | 235 | */ |
236 | static inline struct ip_vs_lblc_entry * | 236 | static inline struct ip_vs_lblc_entry * |
237 | ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __u32 addr) | 237 | ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __be32 addr) |
238 | { | 238 | { |
239 | unsigned hash; | 239 | unsigned hash; |
240 | struct ip_vs_lblc_entry *en; | 240 | struct ip_vs_lblc_entry *en; |
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index 32ba37ba72d8..08990192b6ec 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c | |||
@@ -276,7 +276,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) | |||
276 | */ | 276 | */ |
277 | struct ip_vs_lblcr_entry { | 277 | struct ip_vs_lblcr_entry { |
278 | struct list_head list; | 278 | struct list_head list; |
279 | __u32 addr; /* destination IP address */ | 279 | __be32 addr; /* destination IP address */ |
280 | struct ip_vs_dest_set set; /* destination server set */ | 280 | struct ip_vs_dest_set set; /* destination server set */ |
281 | unsigned long lastuse; /* last used time */ | 281 | unsigned long lastuse; /* last used time */ |
282 | }; | 282 | }; |
@@ -348,7 +348,7 @@ static struct ctl_table_header * sysctl_header; | |||
348 | * new/free a ip_vs_lblcr_entry, which is a mapping of a destination | 348 | * new/free a ip_vs_lblcr_entry, which is a mapping of a destination |
349 | * IP address to a server. | 349 | * IP address to a server. |
350 | */ | 350 | */ |
351 | static inline struct ip_vs_lblcr_entry *ip_vs_lblcr_new(__u32 daddr) | 351 | static inline struct ip_vs_lblcr_entry *ip_vs_lblcr_new(__be32 daddr) |
352 | { | 352 | { |
353 | struct ip_vs_lblcr_entry *en; | 353 | struct ip_vs_lblcr_entry *en; |
354 | 354 | ||
@@ -381,7 +381,7 @@ static inline void ip_vs_lblcr_free(struct ip_vs_lblcr_entry *en) | |||
381 | /* | 381 | /* |
382 | * Returns hash value for IPVS LBLCR entry | 382 | * Returns hash value for IPVS LBLCR entry |
383 | */ | 383 | */ |
384 | static inline unsigned ip_vs_lblcr_hashkey(__u32 addr) | 384 | static inline unsigned ip_vs_lblcr_hashkey(__be32 addr) |
385 | { | 385 | { |
386 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLCR_TAB_MASK; | 386 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLCR_TAB_MASK; |
387 | } | 387 | } |
@@ -420,7 +420,7 @@ ip_vs_lblcr_hash(struct ip_vs_lblcr_table *tbl, struct ip_vs_lblcr_entry *en) | |||
420 | * Get ip_vs_lblcr_entry associated with supplied parameters. | 420 | * Get ip_vs_lblcr_entry associated with supplied parameters. |
421 | */ | 421 | */ |
422 | static inline struct ip_vs_lblcr_entry * | 422 | static inline struct ip_vs_lblcr_entry * |
423 | ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __u32 addr) | 423 | ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __be32 addr) |
424 | { | 424 | { |
425 | unsigned hash; | 425 | unsigned hash; |
426 | struct ip_vs_lblcr_entry *en; | 426 | struct ip_vs_lblcr_entry *en; |
diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c index 867d4e9c6594..c4528b5c800d 100644 --- a/net/ipv4/ipvs/ip_vs_proto.c +++ b/net/ipv4/ipvs/ip_vs_proto.c | |||
@@ -176,7 +176,7 @@ ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, | |||
176 | pp->name, NIPQUAD(ih->saddr), | 176 | pp->name, NIPQUAD(ih->saddr), |
177 | NIPQUAD(ih->daddr)); | 177 | NIPQUAD(ih->daddr)); |
178 | else { | 178 | else { |
179 | __u16 _ports[2], *pptr | 179 | __be16 _ports[2], *pptr |
180 | ; | 180 | ; |
181 | pptr = skb_header_pointer(skb, offset + ih->ihl*4, | 181 | pptr = skb_header_pointer(skb, offset + ih->ihl*4, |
182 | sizeof(_ports), _ports); | 182 | sizeof(_ports), _ports); |
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c index 820e8318d10d..bfe779e74590 100644 --- a/net/ipv4/ipvs/ip_vs_proto_tcp.c +++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c | |||
@@ -29,7 +29,7 @@ static struct ip_vs_conn * | |||
29 | tcp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | 29 | tcp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, |
30 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 30 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
31 | { | 31 | { |
32 | __u16 _ports[2], *pptr; | 32 | __be16 _ports[2], *pptr; |
33 | 33 | ||
34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); | 34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); |
35 | if (pptr == NULL) | 35 | if (pptr == NULL) |
@@ -50,7 +50,7 @@ static struct ip_vs_conn * | |||
50 | tcp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | 50 | tcp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, |
51 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 51 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
52 | { | 52 | { |
53 | __u16 _ports[2], *pptr; | 53 | __be16 _ports[2], *pptr; |
54 | 54 | ||
55 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); | 55 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); |
56 | if (pptr == NULL) | 56 | if (pptr == NULL) |
@@ -112,12 +112,12 @@ tcp_conn_schedule(struct sk_buff *skb, | |||
112 | 112 | ||
113 | 113 | ||
114 | static inline void | 114 | static inline void |
115 | tcp_fast_csum_update(struct tcphdr *tcph, u32 oldip, u32 newip, | 115 | tcp_fast_csum_update(struct tcphdr *tcph, __be32 oldip, __be32 newip, |
116 | u16 oldport, u16 newport) | 116 | __be16 oldport, __be16 newport) |
117 | { | 117 | { |
118 | tcph->check = | 118 | tcph->check = |
119 | ip_vs_check_diff(~oldip, newip, | 119 | ip_vs_check_diff(~oldip, newip, |
120 | ip_vs_check_diff(oldport ^ 0xFFFF, | 120 | ip_vs_check_diff(oldport ^ htonl(0xFFFF), |
121 | newport, tcph->check)); | 121 | newport, tcph->check)); |
122 | } | 122 | } |
123 | 123 | ||
diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/ipv4/ipvs/ip_vs_proto_udp.c index 90c8166c0ec1..54aa7603591f 100644 --- a/net/ipv4/ipvs/ip_vs_proto_udp.c +++ b/net/ipv4/ipvs/ip_vs_proto_udp.c | |||
@@ -29,7 +29,7 @@ udp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
29 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 29 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
30 | { | 30 | { |
31 | struct ip_vs_conn *cp; | 31 | struct ip_vs_conn *cp; |
32 | __u16 _ports[2], *pptr; | 32 | __be16 _ports[2], *pptr; |
33 | 33 | ||
34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); | 34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); |
35 | if (pptr == NULL) | 35 | if (pptr == NULL) |
@@ -54,7 +54,7 @@ udp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
54 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 54 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
55 | { | 55 | { |
56 | struct ip_vs_conn *cp; | 56 | struct ip_vs_conn *cp; |
57 | __u16 _ports[2], *pptr; | 57 | __be16 _ports[2], *pptr; |
58 | 58 | ||
59 | pptr = skb_header_pointer(skb, skb->nh.iph->ihl*4, | 59 | pptr = skb_header_pointer(skb, skb->nh.iph->ihl*4, |
60 | sizeof(_ports), _ports); | 60 | sizeof(_ports), _ports); |
@@ -117,15 +117,15 @@ udp_conn_schedule(struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
117 | 117 | ||
118 | 118 | ||
119 | static inline void | 119 | static inline void |
120 | udp_fast_csum_update(struct udphdr *uhdr, u32 oldip, u32 newip, | 120 | udp_fast_csum_update(struct udphdr *uhdr, __be32 oldip, __be32 newip, |
121 | u16 oldport, u16 newport) | 121 | __be16 oldport, __be16 newport) |
122 | { | 122 | { |
123 | uhdr->check = | 123 | uhdr->check = |
124 | ip_vs_check_diff(~oldip, newip, | 124 | ip_vs_check_diff(~oldip, newip, |
125 | ip_vs_check_diff(oldport ^ 0xFFFF, | 125 | ip_vs_check_diff(oldport ^ htonl(0xFFFF), |
126 | newport, uhdr->check)); | 126 | newport, uhdr->check)); |
127 | if (!uhdr->check) | 127 | if (!uhdr->check) |
128 | uhdr->check = 0xFFFF; | 128 | uhdr->check = htonl(0xFFFF); |
129 | } | 129 | } |
130 | 130 | ||
131 | static int | 131 | static int |
@@ -173,7 +173,7 @@ udp_snat_handler(struct sk_buff **pskb, | |||
173 | cp->protocol, | 173 | cp->protocol, |
174 | (*pskb)->csum); | 174 | (*pskb)->csum); |
175 | if (udph->check == 0) | 175 | if (udph->check == 0) |
176 | udph->check = 0xFFFF; | 176 | udph->check = htonl(0xFFFF); |
177 | IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n", | 177 | IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n", |
178 | pp->name, udph->check, | 178 | pp->name, udph->check, |
179 | (char*)&(udph->check) - (char*)udph); | 179 | (char*)&(udph->check) - (char*)udph); |
diff --git a/net/ipv4/ipvs/ip_vs_sh.c b/net/ipv4/ipvs/ip_vs_sh.c index 7775e6cc68be..338668f88fe2 100644 --- a/net/ipv4/ipvs/ip_vs_sh.c +++ b/net/ipv4/ipvs/ip_vs_sh.c | |||
@@ -63,7 +63,7 @@ struct ip_vs_sh_bucket { | |||
63 | /* | 63 | /* |
64 | * Returns hash value for IPVS SH entry | 64 | * Returns hash value for IPVS SH entry |
65 | */ | 65 | */ |
66 | static inline unsigned ip_vs_sh_hashkey(__u32 addr) | 66 | static inline unsigned ip_vs_sh_hashkey(__be32 addr) |
67 | { | 67 | { |
68 | return (ntohl(addr)*2654435761UL) & IP_VS_SH_TAB_MASK; | 68 | return (ntohl(addr)*2654435761UL) & IP_VS_SH_TAB_MASK; |
69 | } | 69 | } |
@@ -73,7 +73,7 @@ static inline unsigned ip_vs_sh_hashkey(__u32 addr) | |||
73 | * Get ip_vs_dest associated with supplied parameters. | 73 | * Get ip_vs_dest associated with supplied parameters. |
74 | */ | 74 | */ |
75 | static inline struct ip_vs_dest * | 75 | static inline struct ip_vs_dest * |
76 | ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __u32 addr) | 76 | ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __be32 addr) |
77 | { | 77 | { |
78 | return (tbl[ip_vs_sh_hashkey(addr)]).dest; | 78 | return (tbl[ip_vs_sh_hashkey(addr)]).dest; |
79 | } | 79 | } |
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 1bca714bda3d..6ab57d72b615 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c | |||
@@ -48,16 +48,16 @@ struct ip_vs_sync_conn { | |||
48 | 48 | ||
49 | /* Protocol, addresses and port numbers */ | 49 | /* Protocol, addresses and port numbers */ |
50 | __u8 protocol; /* Which protocol (TCP/UDP) */ | 50 | __u8 protocol; /* Which protocol (TCP/UDP) */ |
51 | __u16 cport; | 51 | __be16 cport; |
52 | __u16 vport; | 52 | __be16 vport; |
53 | __u16 dport; | 53 | __be16 dport; |
54 | __u32 caddr; /* client address */ | 54 | __be32 caddr; /* client address */ |
55 | __u32 vaddr; /* virtual address */ | 55 | __be32 vaddr; /* virtual address */ |
56 | __u32 daddr; /* destination address */ | 56 | __be32 daddr; /* destination address */ |
57 | 57 | ||
58 | /* Flags and state transition */ | 58 | /* Flags and state transition */ |
59 | __u16 flags; /* status flags */ | 59 | __be16 flags; /* status flags */ |
60 | __u16 state; /* state info */ | 60 | __be16 state; /* state info */ |
61 | 61 | ||
62 | /* The sequence options start here */ | 62 | /* The sequence options start here */ |
63 | }; | 63 | }; |
@@ -464,7 +464,7 @@ join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname) | |||
464 | static int bind_mcastif_addr(struct socket *sock, char *ifname) | 464 | static int bind_mcastif_addr(struct socket *sock, char *ifname) |
465 | { | 465 | { |
466 | struct net_device *dev; | 466 | struct net_device *dev; |
467 | u32 addr; | 467 | __be32 addr; |
468 | struct sockaddr_in sin; | 468 | struct sockaddr_in sin; |
469 | 469 | ||
470 | if ((dev = __dev_get_by_name(ifname)) == NULL) | 470 | if ((dev = __dev_get_by_name(ifname)) == NULL) |
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c index 52c12e9edbbc..e1f77bd7c9a5 100644 --- a/net/ipv4/ipvs/ip_vs_xmit.c +++ b/net/ipv4/ipvs/ip_vs_xmit.c | |||
@@ -232,7 +232,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
232 | 232 | ||
233 | /* check if it is a connection of no-client-port */ | 233 | /* check if it is a connection of no-client-port */ |
234 | if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT)) { | 234 | if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT)) { |
235 | __u16 _pt, *p; | 235 | __be16 _pt, *p; |
236 | p = skb_header_pointer(skb, iph->ihl*4, sizeof(_pt), &_pt); | 236 | p = skb_header_pointer(skb, iph->ihl*4, sizeof(_pt), &_pt); |
237 | if (p == NULL) | 237 | if (p == NULL) |
238 | goto tx_error; | 238 | goto tx_error; |
diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c index d25ec4ae09e5..92b04823e034 100644 --- a/net/ipv4/multipath_wrandom.c +++ b/net/ipv4/multipath_wrandom.c | |||
@@ -60,8 +60,8 @@ struct multipath_dest { | |||
60 | struct list_head list; | 60 | struct list_head list; |
61 | 61 | ||
62 | const struct fib_nh *nh_info; | 62 | const struct fib_nh *nh_info; |
63 | __u32 netmask; | 63 | __be32 netmask; |
64 | __u32 network; | 64 | __be32 network; |
65 | unsigned char prefixlen; | 65 | unsigned char prefixlen; |
66 | 66 | ||
67 | struct rcu_head rcu; | 67 | struct rcu_head rcu; |
@@ -76,7 +76,7 @@ struct multipath_route { | |||
76 | struct list_head list; | 76 | struct list_head list; |
77 | 77 | ||
78 | int oif; | 78 | int oif; |
79 | __u32 gw; | 79 | __be32 gw; |
80 | struct list_head dests; | 80 | struct list_head dests; |
81 | 81 | ||
82 | struct rcu_head rcu; | 82 | struct rcu_head rcu; |
@@ -128,8 +128,8 @@ static unsigned char __multipath_lookup_weight(const struct flowi *fl, | |||
128 | 128 | ||
129 | /* find state entry for destination */ | 129 | /* find state entry for destination */ |
130 | list_for_each_entry_rcu(d, &target_route->dests, list) { | 130 | list_for_each_entry_rcu(d, &target_route->dests, list) { |
131 | __u32 targetnetwork = fl->fl4_dst & | 131 | __be32 targetnetwork = fl->fl4_dst & |
132 | (0xFFFFFFFF >> (32 - d->prefixlen)); | 132 | inet_make_mask(d->prefixlen); |
133 | 133 | ||
134 | if ((targetnetwork & d->netmask) == d->network) { | 134 | if ((targetnetwork & d->netmask) == d->network) { |
135 | weight = d->nh_info->nh_weight; | 135 | weight = d->nh_info->nh_weight; |
@@ -217,8 +217,8 @@ static void wrandom_select_route(const struct flowi *flp, | |||
217 | *rp = decision; | 217 | *rp = decision; |
218 | } | 218 | } |
219 | 219 | ||
220 | static void wrandom_set_nhinfo(__u32 network, | 220 | static void wrandom_set_nhinfo(__be32 network, |
221 | __u32 netmask, | 221 | __be32 netmask, |
222 | unsigned char prefixlen, | 222 | unsigned char prefixlen, |
223 | const struct fib_nh *nh) | 223 | const struct fib_nh *nh) |
224 | { | 224 | { |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index f88347de21a9..5ac15379a0cf 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -128,8 +128,8 @@ EXPORT_SYMBOL(ip_nat_decode_session); | |||
128 | */ | 128 | */ |
129 | 129 | ||
130 | struct ip_rt_info { | 130 | struct ip_rt_info { |
131 | u_int32_t daddr; | 131 | __be32 daddr; |
132 | u_int32_t saddr; | 132 | __be32 saddr; |
133 | u_int8_t tos; | 133 | u_int8_t tos; |
134 | }; | 134 | }; |
135 | 135 | ||
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 85f0d73ebfb4..17e1a687ab45 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -80,7 +80,7 @@ static inline int arp_packet_match(const struct arphdr *arphdr, | |||
80 | { | 80 | { |
81 | char *arpptr = (char *)(arphdr + 1); | 81 | char *arpptr = (char *)(arphdr + 1); |
82 | char *src_devaddr, *tgt_devaddr; | 82 | char *src_devaddr, *tgt_devaddr; |
83 | u32 src_ipaddr, tgt_ipaddr; | 83 | __be32 src_ipaddr, tgt_ipaddr; |
84 | int i, ret; | 84 | int i, ret; |
85 | 85 | ||
86 | #define FWINV(bool,invflg) ((bool) ^ !!(arpinfo->invflags & invflg)) | 86 | #define FWINV(bool,invflg) ((bool) ^ !!(arpinfo->invflags & invflg)) |
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; | |||
149 | static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple, | 149 | static 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, | |||
1169 | int ip_ct_port_tuple_to_nfattr(struct sk_buff *skb, | 1169 | int 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_h323.c b/net/ipv4/netfilter/ip_conntrack_helper_h323.c index 9a39e2969712..7b7441202bfd 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_h323.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_h323.c | |||
@@ -49,11 +49,11 @@ MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations " | |||
49 | int (*set_h245_addr_hook) (struct sk_buff ** pskb, | 49 | int (*set_h245_addr_hook) (struct sk_buff ** pskb, |
50 | unsigned char **data, int dataoff, | 50 | unsigned char **data, int dataoff, |
51 | H245_TransportAddress * addr, | 51 | H245_TransportAddress * addr, |
52 | u_int32_t ip, u_int16_t port); | 52 | __be32 ip, u_int16_t port); |
53 | int (*set_h225_addr_hook) (struct sk_buff ** pskb, | 53 | int (*set_h225_addr_hook) (struct sk_buff ** pskb, |
54 | unsigned char **data, int dataoff, | 54 | unsigned char **data, int dataoff, |
55 | TransportAddress * addr, | 55 | TransportAddress * addr, |
56 | u_int32_t ip, u_int16_t port); | 56 | __be32 ip, u_int16_t port); |
57 | int (*set_sig_addr_hook) (struct sk_buff ** pskb, | 57 | int (*set_sig_addr_hook) (struct sk_buff ** pskb, |
58 | struct ip_conntrack * ct, | 58 | struct ip_conntrack * ct, |
59 | enum ip_conntrack_info ctinfo, | 59 | enum ip_conntrack_info ctinfo, |
@@ -209,7 +209,7 @@ static int get_tpkt_data(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
209 | 209 | ||
210 | /****************************************************************************/ | 210 | /****************************************************************************/ |
211 | static int get_h245_addr(unsigned char *data, H245_TransportAddress * addr, | 211 | static int get_h245_addr(unsigned char *data, H245_TransportAddress * addr, |
212 | u_int32_t * ip, u_int16_t * port) | 212 | __be32 * ip, u_int16_t * port) |
213 | { | 213 | { |
214 | unsigned char *p; | 214 | unsigned char *p; |
215 | 215 | ||
@@ -232,7 +232,7 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
232 | { | 232 | { |
233 | int dir = CTINFO2DIR(ctinfo); | 233 | int dir = CTINFO2DIR(ctinfo); |
234 | int ret = 0; | 234 | int ret = 0; |
235 | u_int32_t ip; | 235 | __be32 ip; |
236 | u_int16_t port; | 236 | u_int16_t port; |
237 | u_int16_t rtp_port; | 237 | u_int16_t rtp_port; |
238 | struct ip_conntrack_expect *rtp_exp; | 238 | struct ip_conntrack_expect *rtp_exp; |
@@ -254,10 +254,10 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
254 | rtp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 254 | rtp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
255 | rtp_exp->tuple.dst.u.udp.port = htons(rtp_port); | 255 | rtp_exp->tuple.dst.u.udp.port = htons(rtp_port); |
256 | rtp_exp->tuple.dst.protonum = IPPROTO_UDP; | 256 | rtp_exp->tuple.dst.protonum = IPPROTO_UDP; |
257 | rtp_exp->mask.src.ip = 0xFFFFFFFF; | 257 | rtp_exp->mask.src.ip = htonl(0xFFFFFFFF); |
258 | rtp_exp->mask.src.u.udp.port = 0; | 258 | rtp_exp->mask.src.u.udp.port = 0; |
259 | rtp_exp->mask.dst.ip = 0xFFFFFFFF; | 259 | rtp_exp->mask.dst.ip = htonl(0xFFFFFFFF); |
260 | rtp_exp->mask.dst.u.udp.port = 0xFFFF; | 260 | rtp_exp->mask.dst.u.udp.port = htons(0xFFFF); |
261 | rtp_exp->mask.dst.protonum = 0xFF; | 261 | rtp_exp->mask.dst.protonum = 0xFF; |
262 | rtp_exp->flags = 0; | 262 | rtp_exp->flags = 0; |
263 | 263 | ||
@@ -271,10 +271,10 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
271 | rtcp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 271 | rtcp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
272 | rtcp_exp->tuple.dst.u.udp.port = htons(rtp_port + 1); | 272 | rtcp_exp->tuple.dst.u.udp.port = htons(rtp_port + 1); |
273 | rtcp_exp->tuple.dst.protonum = IPPROTO_UDP; | 273 | rtcp_exp->tuple.dst.protonum = IPPROTO_UDP; |
274 | rtcp_exp->mask.src.ip = 0xFFFFFFFF; | 274 | rtcp_exp->mask.src.ip = htonl(0xFFFFFFFF); |
275 | rtcp_exp->mask.src.u.udp.port = 0; | 275 | rtcp_exp->mask.src.u.udp.port = 0; |
276 | rtcp_exp->mask.dst.ip = 0xFFFFFFFF; | 276 | rtcp_exp->mask.dst.ip = htonl(0xFFFFFFFF); |
277 | rtcp_exp->mask.dst.u.udp.port = 0xFFFF; | 277 | rtcp_exp->mask.dst.u.udp.port = htons(0xFFFF); |
278 | rtcp_exp->mask.dst.protonum = 0xFF; | 278 | rtcp_exp->mask.dst.protonum = 0xFF; |
279 | rtcp_exp->flags = 0; | 279 | rtcp_exp->flags = 0; |
280 | 280 | ||
@@ -325,7 +325,7 @@ static int expect_t120(struct sk_buff **pskb, | |||
325 | { | 325 | { |
326 | int dir = CTINFO2DIR(ctinfo); | 326 | int dir = CTINFO2DIR(ctinfo); |
327 | int ret = 0; | 327 | int ret = 0; |
328 | u_int32_t ip; | 328 | __be32 ip; |
329 | u_int16_t port; | 329 | u_int16_t port; |
330 | struct ip_conntrack_expect *exp = NULL; | 330 | struct ip_conntrack_expect *exp = NULL; |
331 | 331 | ||
@@ -342,10 +342,10 @@ static int expect_t120(struct sk_buff **pskb, | |||
342 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 342 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
343 | exp->tuple.dst.u.tcp.port = htons(port); | 343 | exp->tuple.dst.u.tcp.port = htons(port); |
344 | exp->tuple.dst.protonum = IPPROTO_TCP; | 344 | exp->tuple.dst.protonum = IPPROTO_TCP; |
345 | exp->mask.src.ip = 0xFFFFFFFF; | 345 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
346 | exp->mask.src.u.tcp.port = 0; | 346 | exp->mask.src.u.tcp.port = 0; |
347 | exp->mask.dst.ip = 0xFFFFFFFF; | 347 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
348 | exp->mask.dst.u.tcp.port = 0xFFFF; | 348 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
349 | exp->mask.dst.protonum = 0xFF; | 349 | exp->mask.dst.protonum = 0xFF; |
350 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple channels */ | 350 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple channels */ |
351 | 351 | ||
@@ -626,7 +626,7 @@ void ip_conntrack_h245_expect(struct ip_conntrack *new, | |||
626 | 626 | ||
627 | /****************************************************************************/ | 627 | /****************************************************************************/ |
628 | int get_h225_addr(unsigned char *data, TransportAddress * addr, | 628 | int get_h225_addr(unsigned char *data, TransportAddress * addr, |
629 | u_int32_t * ip, u_int16_t * port) | 629 | __be32 * ip, u_int16_t * port) |
630 | { | 630 | { |
631 | unsigned char *p; | 631 | unsigned char *p; |
632 | 632 | ||
@@ -648,7 +648,7 @@ static int expect_h245(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
648 | { | 648 | { |
649 | int dir = CTINFO2DIR(ctinfo); | 649 | int dir = CTINFO2DIR(ctinfo); |
650 | int ret = 0; | 650 | int ret = 0; |
651 | u_int32_t ip; | 651 | __be32 ip; |
652 | u_int16_t port; | 652 | u_int16_t port; |
653 | struct ip_conntrack_expect *exp = NULL; | 653 | struct ip_conntrack_expect *exp = NULL; |
654 | 654 | ||
@@ -665,10 +665,10 @@ static int expect_h245(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
665 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 665 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
666 | exp->tuple.dst.u.tcp.port = htons(port); | 666 | exp->tuple.dst.u.tcp.port = htons(port); |
667 | exp->tuple.dst.protonum = IPPROTO_TCP; | 667 | exp->tuple.dst.protonum = IPPROTO_TCP; |
668 | exp->mask.src.ip = 0xFFFFFFFF; | 668 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
669 | exp->mask.src.u.tcp.port = 0; | 669 | exp->mask.src.u.tcp.port = 0; |
670 | exp->mask.dst.ip = 0xFFFFFFFF; | 670 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
671 | exp->mask.dst.u.tcp.port = 0xFFFF; | 671 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
672 | exp->mask.dst.protonum = 0xFF; | 672 | exp->mask.dst.protonum = 0xFF; |
673 | exp->flags = 0; | 673 | exp->flags = 0; |
674 | 674 | ||
@@ -709,7 +709,7 @@ static int expect_callforwarding(struct sk_buff **pskb, | |||
709 | { | 709 | { |
710 | int dir = CTINFO2DIR(ctinfo); | 710 | int dir = CTINFO2DIR(ctinfo); |
711 | int ret = 0; | 711 | int ret = 0; |
712 | u_int32_t ip; | 712 | __be32 ip; |
713 | u_int16_t port; | 713 | u_int16_t port; |
714 | struct ip_conntrack_expect *exp = NULL; | 714 | struct ip_conntrack_expect *exp = NULL; |
715 | 715 | ||
@@ -751,10 +751,10 @@ static int expect_callforwarding(struct sk_buff **pskb, | |||
751 | exp->tuple.dst.ip = ip; | 751 | exp->tuple.dst.ip = ip; |
752 | exp->tuple.dst.u.tcp.port = htons(port); | 752 | exp->tuple.dst.u.tcp.port = htons(port); |
753 | exp->tuple.dst.protonum = IPPROTO_TCP; | 753 | exp->tuple.dst.protonum = IPPROTO_TCP; |
754 | exp->mask.src.ip = 0xFFFFFFFF; | 754 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
755 | exp->mask.src.u.tcp.port = 0; | 755 | exp->mask.src.u.tcp.port = 0; |
756 | exp->mask.dst.ip = 0xFFFFFFFF; | 756 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
757 | exp->mask.dst.u.tcp.port = 0xFFFF; | 757 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
758 | exp->mask.dst.protonum = 0xFF; | 758 | exp->mask.dst.protonum = 0xFF; |
759 | exp->flags = 0; | 759 | exp->flags = 0; |
760 | 760 | ||
@@ -791,7 +791,7 @@ static int process_setup(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
791 | int dir = CTINFO2DIR(ctinfo); | 791 | int dir = CTINFO2DIR(ctinfo); |
792 | int ret; | 792 | int ret; |
793 | int i; | 793 | int i; |
794 | u_int32_t ip; | 794 | __be32 ip; |
795 | u_int16_t port; | 795 | u_int16_t port; |
796 | 796 | ||
797 | DEBUGP("ip_ct_q931: Setup\n"); | 797 | DEBUGP("ip_ct_q931: Setup\n"); |
@@ -1188,7 +1188,7 @@ static unsigned char *get_udp_data(struct sk_buff **pskb, int *datalen) | |||
1188 | 1188 | ||
1189 | /****************************************************************************/ | 1189 | /****************************************************************************/ |
1190 | static struct ip_conntrack_expect *find_expect(struct ip_conntrack *ct, | 1190 | static struct ip_conntrack_expect *find_expect(struct ip_conntrack *ct, |
1191 | u_int32_t ip, u_int16_t port) | 1191 | __be32 ip, u_int16_t port) |
1192 | { | 1192 | { |
1193 | struct ip_conntrack_expect *exp; | 1193 | struct ip_conntrack_expect *exp; |
1194 | struct ip_conntrack_tuple tuple; | 1194 | struct ip_conntrack_tuple tuple; |
@@ -1228,7 +1228,7 @@ static int expect_q931(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1228 | int dir = CTINFO2DIR(ctinfo); | 1228 | int dir = CTINFO2DIR(ctinfo); |
1229 | int ret = 0; | 1229 | int ret = 0; |
1230 | int i; | 1230 | int i; |
1231 | u_int32_t ip; | 1231 | __be32 ip; |
1232 | u_int16_t port; | 1232 | u_int16_t port; |
1233 | struct ip_conntrack_expect *exp; | 1233 | struct ip_conntrack_expect *exp; |
1234 | 1234 | ||
@@ -1251,10 +1251,10 @@ static int expect_q931(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1251 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 1251 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
1252 | exp->tuple.dst.u.tcp.port = htons(port); | 1252 | exp->tuple.dst.u.tcp.port = htons(port); |
1253 | exp->tuple.dst.protonum = IPPROTO_TCP; | 1253 | exp->tuple.dst.protonum = IPPROTO_TCP; |
1254 | exp->mask.src.ip = gkrouted_only ? 0xFFFFFFFF : 0; | 1254 | exp->mask.src.ip = gkrouted_only ? htonl(0xFFFFFFFF) : 0; |
1255 | exp->mask.src.u.tcp.port = 0; | 1255 | exp->mask.src.u.tcp.port = 0; |
1256 | exp->mask.dst.ip = 0xFFFFFFFF; | 1256 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1257 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1257 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1258 | exp->mask.dst.protonum = 0xFF; | 1258 | exp->mask.dst.protonum = 0xFF; |
1259 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple calls */ | 1259 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple calls */ |
1260 | 1260 | ||
@@ -1307,7 +1307,7 @@ static int process_gcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1307 | { | 1307 | { |
1308 | int dir = CTINFO2DIR(ctinfo); | 1308 | int dir = CTINFO2DIR(ctinfo); |
1309 | int ret = 0; | 1309 | int ret = 0; |
1310 | u_int32_t ip; | 1310 | __be32 ip; |
1311 | u_int16_t port; | 1311 | u_int16_t port; |
1312 | struct ip_conntrack_expect *exp; | 1312 | struct ip_conntrack_expect *exp; |
1313 | 1313 | ||
@@ -1333,10 +1333,10 @@ static int process_gcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1333 | exp->tuple.dst.ip = ip; | 1333 | exp->tuple.dst.ip = ip; |
1334 | exp->tuple.dst.u.tcp.port = htons(port); | 1334 | exp->tuple.dst.u.tcp.port = htons(port); |
1335 | exp->tuple.dst.protonum = IPPROTO_UDP; | 1335 | exp->tuple.dst.protonum = IPPROTO_UDP; |
1336 | exp->mask.src.ip = 0xFFFFFFFF; | 1336 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
1337 | exp->mask.src.u.tcp.port = 0; | 1337 | exp->mask.src.u.tcp.port = 0; |
1338 | exp->mask.dst.ip = 0xFFFFFFFF; | 1338 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1339 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1339 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1340 | exp->mask.dst.protonum = 0xFF; | 1340 | exp->mask.dst.protonum = 0xFF; |
1341 | exp->flags = 0; | 1341 | exp->flags = 0; |
1342 | exp->expectfn = ip_conntrack_ras_expect; | 1342 | exp->expectfn = ip_conntrack_ras_expect; |
@@ -1477,7 +1477,7 @@ static int process_arq(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1477 | { | 1477 | { |
1478 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; | 1478 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; |
1479 | int dir = CTINFO2DIR(ctinfo); | 1479 | int dir = CTINFO2DIR(ctinfo); |
1480 | u_int32_t ip; | 1480 | __be32 ip; |
1481 | u_int16_t port; | 1481 | u_int16_t port; |
1482 | 1482 | ||
1483 | DEBUGP("ip_ct_ras: ARQ\n"); | 1483 | DEBUGP("ip_ct_ras: ARQ\n"); |
@@ -1513,7 +1513,7 @@ static int process_acf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1513 | { | 1513 | { |
1514 | int dir = CTINFO2DIR(ctinfo); | 1514 | int dir = CTINFO2DIR(ctinfo); |
1515 | int ret = 0; | 1515 | int ret = 0; |
1516 | u_int32_t ip; | 1516 | __be32 ip; |
1517 | u_int16_t port; | 1517 | u_int16_t port; |
1518 | struct ip_conntrack_expect *exp; | 1518 | struct ip_conntrack_expect *exp; |
1519 | 1519 | ||
@@ -1538,10 +1538,10 @@ static int process_acf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1538 | exp->tuple.dst.ip = ip; | 1538 | exp->tuple.dst.ip = ip; |
1539 | exp->tuple.dst.u.tcp.port = htons(port); | 1539 | exp->tuple.dst.u.tcp.port = htons(port); |
1540 | exp->tuple.dst.protonum = IPPROTO_TCP; | 1540 | exp->tuple.dst.protonum = IPPROTO_TCP; |
1541 | exp->mask.src.ip = 0xFFFFFFFF; | 1541 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
1542 | exp->mask.src.u.tcp.port = 0; | 1542 | exp->mask.src.u.tcp.port = 0; |
1543 | exp->mask.dst.ip = 0xFFFFFFFF; | 1543 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1544 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1544 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1545 | exp->mask.dst.protonum = 0xFF; | 1545 | exp->mask.dst.protonum = 0xFF; |
1546 | exp->flags = IP_CT_EXPECT_PERMANENT; | 1546 | exp->flags = IP_CT_EXPECT_PERMANENT; |
1547 | exp->expectfn = ip_conntrack_q931_expect; | 1547 | exp->expectfn = ip_conntrack_q931_expect; |
@@ -1581,7 +1581,7 @@ static int process_lcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1581 | { | 1581 | { |
1582 | int dir = CTINFO2DIR(ctinfo); | 1582 | int dir = CTINFO2DIR(ctinfo); |
1583 | int ret = 0; | 1583 | int ret = 0; |
1584 | u_int32_t ip; | 1584 | __be32 ip; |
1585 | u_int16_t port; | 1585 | u_int16_t port; |
1586 | struct ip_conntrack_expect *exp = NULL; | 1586 | struct ip_conntrack_expect *exp = NULL; |
1587 | 1587 | ||
@@ -1598,10 +1598,10 @@ static int process_lcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1598 | exp->tuple.dst.ip = ip; | 1598 | exp->tuple.dst.ip = ip; |
1599 | exp->tuple.dst.u.tcp.port = htons(port); | 1599 | exp->tuple.dst.u.tcp.port = htons(port); |
1600 | exp->tuple.dst.protonum = IPPROTO_TCP; | 1600 | exp->tuple.dst.protonum = IPPROTO_TCP; |
1601 | exp->mask.src.ip = 0xFFFFFFFF; | 1601 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
1602 | exp->mask.src.u.tcp.port = 0; | 1602 | exp->mask.src.u.tcp.port = 0; |
1603 | exp->mask.dst.ip = 0xFFFFFFFF; | 1603 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1604 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1604 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1605 | exp->mask.dst.protonum = 0xFF; | 1605 | exp->mask.dst.protonum = 0xFF; |
1606 | exp->flags = IP_CT_EXPECT_PERMANENT; | 1606 | exp->flags = IP_CT_EXPECT_PERMANENT; |
1607 | exp->expectfn = ip_conntrack_q931_expect; | 1607 | exp->expectfn = ip_conntrack_q931_expect; |
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 3d0b438783db..a1d6a89f64aa 100644 --- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c | |||
@@ -48,7 +48,7 @@ static int help(struct sk_buff **pskb, | |||
48 | struct iphdr *iph = (*pskb)->nh.iph; | 48 | struct iphdr *iph = (*pskb)->nh.iph; |
49 | struct rtable *rt = (struct rtable *)(*pskb)->dst; | 49 | struct rtable *rt = (struct rtable *)(*pskb)->dst; |
50 | struct in_device *in_dev; | 50 | struct in_device *in_dev; |
51 | u_int32_t mask = 0; | 51 | __be32 mask = 0; |
52 | 52 | ||
53 | /* we're only interested in locally generated packets */ | 53 | /* we're only interested in locally generated packets */ |
54 | if ((*pskb)->sk == NULL) | 54 | if ((*pskb)->sk == NULL) |
@@ -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, | |||
110 | static inline int | 110 | static inline int |
111 | ctnetlink_dump_status(struct sk_buff *skb, const struct ip_conntrack *ct) | 111 | ctnetlink_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 | |||
122 | ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct) | 122 | ctnetlink_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: | |||
215 | static inline int | 215 | static inline int |
216 | ctnetlink_dump_mark(struct sk_buff *skb, const struct ip_conntrack *ct) | 216 | ctnetlink_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 | ||
223 | nfattr_failure: | 223 | nfattr_failure: |
@@ -230,8 +230,8 @@ nfattr_failure: | |||
230 | static inline int | 230 | static inline int |
231 | ctnetlink_dump_id(struct sk_buff *skb, const struct ip_conntrack *ct) | 231 | ctnetlink_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 | ||
237 | nfattr_failure: | 237 | nfattr_failure: |
@@ -241,9 +241,9 @@ nfattr_failure: | |||
241 | static inline int | 241 | static inline int |
242 | ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct) | 242 | ctnetlink_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 | ||
249 | nfattr_failure: | 249 | nfattr_failure: |
@@ -457,8 +457,8 @@ out: | |||
457 | } | 457 | } |
458 | 458 | ||
459 | static const size_t cta_min_ip[CTA_IP_MAX] = { | 459 | static 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 | ||
464 | static inline int | 464 | static 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 | ||
604 | static const size_t cta_min_nat[CTA_NAT_MAX] = { | 604 | static 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 | ||
609 | static inline int | 609 | static 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 | ||
665 | static const size_t cta_min[CTA_MAX] = { | 665 | static 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 | ||
673 | static int | 673 | static 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 | |||
808 | ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) | 808 | ctnetlink_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[]) | |||
903 | static inline int | 903 | static inline int |
904 | ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[]) | 904 | ctnetlink_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 | ||
1274 | static const size_t cta_min_exp[CTA_EXPECT_MAX] = { | 1274 | static 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 | ||
1279 | static int | 1279 | static 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, | |||
261 | static int icmp_tuple_to_nfattr(struct sk_buff *skb, | 261 | static 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, | |||
210 | for (offset = skb->nh.iph->ihl * 4 + sizeof(sctp_sctphdr_t), count = 0; \ | 210 | for (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 */ |
216 | static int do_basic_checks(struct ip_conntrack *conntrack, | 216 | static 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.. */ |
195 | static int parse_ipaddr(const char *cp, const char **endp, | 195 | static 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, | |||
227 | static int epaddr_len(const char *dptr, const char *limit, int *shift) | 227 | static 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, | |||
302 | static int set_expected_rtp(struct sk_buff **pskb, | 302 | static 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; |
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c index 71f3e09cbc84..4b6260a97408 100644 --- a/net/ipv4/netfilter/ip_nat_core.c +++ b/net/ipv4/netfilter/ip_nat_core.c | |||
@@ -82,7 +82,7 @@ static inline unsigned int | |||
82 | hash_by_src(const struct ip_conntrack_tuple *tuple) | 82 | hash_by_src(const struct ip_conntrack_tuple *tuple) |
83 | { | 83 | { |
84 | /* Original src, to ensure we map it consistently if poss. */ | 84 | /* Original src, to ensure we map it consistently if poss. */ |
85 | return jhash_3words(tuple->src.ip, tuple->src.u.all, | 85 | return jhash_3words((__force u32)tuple->src.ip, tuple->src.u.all, |
86 | tuple->dst.protonum, 0) % ip_nat_htable_size; | 86 | tuple->dst.protonum, 0) % ip_nat_htable_size; |
87 | } | 87 | } |
88 | 88 | ||
@@ -190,7 +190,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, | |||
190 | const struct ip_conntrack *conntrack, | 190 | const struct ip_conntrack *conntrack, |
191 | enum ip_nat_manip_type maniptype) | 191 | enum ip_nat_manip_type maniptype) |
192 | { | 192 | { |
193 | u_int32_t *var_ipp; | 193 | __be32 *var_ipp; |
194 | /* Host order */ | 194 | /* Host order */ |
195 | u_int32_t minip, maxip, j; | 195 | u_int32_t minip, maxip, j; |
196 | 196 | ||
@@ -217,7 +217,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, | |||
217 | * like this), even across reboots. */ | 217 | * like this), even across reboots. */ |
218 | minip = ntohl(range->min_ip); | 218 | minip = ntohl(range->min_ip); |
219 | maxip = ntohl(range->max_ip); | 219 | maxip = ntohl(range->max_ip); |
220 | j = jhash_2words(tuple->src.ip, tuple->dst.ip, 0); | 220 | j = jhash_2words((__force u32)tuple->src.ip, (__force u32)tuple->dst.ip, 0); |
221 | *var_ipp = htonl(minip + j % (maxip - minip + 1)); | 221 | *var_ipp = htonl(minip + j % (maxip - minip + 1)); |
222 | } | 222 | } |
223 | 223 | ||
@@ -534,9 +534,9 @@ int | |||
534 | ip_nat_port_range_to_nfattr(struct sk_buff *skb, | 534 | ip_nat_port_range_to_nfattr(struct sk_buff *skb, |
535 | const struct ip_nat_range *range) | 535 | const struct ip_nat_range *range) |
536 | { | 536 | { |
537 | NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(u_int16_t), | 537 | NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16), |
538 | &range->min.tcp.port); | 538 | &range->min.tcp.port); |
539 | NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(u_int16_t), | 539 | NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(__be16), |
540 | &range->max.tcp.port); | 540 | &range->max.tcp.port); |
541 | 541 | ||
542 | return 0; | 542 | return 0; |
@@ -555,7 +555,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) | |||
555 | if (tb[CTA_PROTONAT_PORT_MIN-1]) { | 555 | if (tb[CTA_PROTONAT_PORT_MIN-1]) { |
556 | ret = 1; | 556 | ret = 1; |
557 | range->min.tcp.port = | 557 | range->min.tcp.port = |
558 | *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); | 558 | *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); |
559 | } | 559 | } |
560 | 560 | ||
561 | if (!tb[CTA_PROTONAT_PORT_MAX-1]) { | 561 | if (!tb[CTA_PROTONAT_PORT_MAX-1]) { |
@@ -564,7 +564,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) | |||
564 | } else { | 564 | } else { |
565 | ret = 1; | 565 | ret = 1; |
566 | range->max.tcp.port = | 566 | range->max.tcp.port = |
567 | *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); | 567 | *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); |
568 | } | 568 | } |
569 | 569 | ||
570 | return ret; | 570 | return ret; |
diff --git a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c index 3328fc5c5f50..a71c233d8112 100644 --- a/net/ipv4/netfilter/ip_nat_ftp.c +++ b/net/ipv4/netfilter/ip_nat_ftp.c | |||
@@ -34,7 +34,7 @@ MODULE_DESCRIPTION("ftp NAT helper"); | |||
34 | 34 | ||
35 | static int | 35 | static int |
36 | mangle_rfc959_packet(struct sk_buff **pskb, | 36 | mangle_rfc959_packet(struct sk_buff **pskb, |
37 | u_int32_t newip, | 37 | __be32 newip, |
38 | u_int16_t port, | 38 | u_int16_t port, |
39 | unsigned int matchoff, | 39 | unsigned int matchoff, |
40 | unsigned int matchlen, | 40 | unsigned int matchlen, |
@@ -57,7 +57,7 @@ mangle_rfc959_packet(struct sk_buff **pskb, | |||
57 | /* |1|132.235.1.2|6275| */ | 57 | /* |1|132.235.1.2|6275| */ |
58 | static int | 58 | static int |
59 | mangle_eprt_packet(struct sk_buff **pskb, | 59 | mangle_eprt_packet(struct sk_buff **pskb, |
60 | u_int32_t newip, | 60 | __be32 newip, |
61 | u_int16_t port, | 61 | u_int16_t port, |
62 | unsigned int matchoff, | 62 | unsigned int matchoff, |
63 | unsigned int matchlen, | 63 | unsigned int matchlen, |
@@ -79,7 +79,7 @@ mangle_eprt_packet(struct sk_buff **pskb, | |||
79 | /* |1|132.235.1.2|6275| */ | 79 | /* |1|132.235.1.2|6275| */ |
80 | static int | 80 | static int |
81 | mangle_epsv_packet(struct sk_buff **pskb, | 81 | mangle_epsv_packet(struct sk_buff **pskb, |
82 | u_int32_t newip, | 82 | __be32 newip, |
83 | u_int16_t port, | 83 | u_int16_t port, |
84 | unsigned int matchoff, | 84 | unsigned int matchoff, |
85 | unsigned int matchlen, | 85 | unsigned int matchlen, |
@@ -98,7 +98,7 @@ mangle_epsv_packet(struct sk_buff **pskb, | |||
98 | matchlen, buffer, strlen(buffer)); | 98 | matchlen, buffer, strlen(buffer)); |
99 | } | 99 | } |
100 | 100 | ||
101 | static int (*mangle[])(struct sk_buff **, u_int32_t, u_int16_t, | 101 | static int (*mangle[])(struct sk_buff **, __be32, u_int16_t, |
102 | unsigned int, | 102 | unsigned int, |
103 | unsigned int, | 103 | unsigned int, |
104 | struct ip_conntrack *, | 104 | struct ip_conntrack *, |
@@ -120,7 +120,7 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb, | |||
120 | struct ip_conntrack_expect *exp, | 120 | struct ip_conntrack_expect *exp, |
121 | u32 *seq) | 121 | u32 *seq) |
122 | { | 122 | { |
123 | u_int32_t newip; | 123 | __be32 newip; |
124 | u_int16_t port; | 124 | u_int16_t port; |
125 | int dir = CTINFO2DIR(ctinfo); | 125 | int dir = CTINFO2DIR(ctinfo); |
126 | struct ip_conntrack *ct = exp->master; | 126 | struct ip_conntrack *ct = exp->master; |
diff --git a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c index 7f6a75984f6c..3bf858480558 100644 --- a/net/ipv4/netfilter/ip_nat_helper.c +++ b/net/ipv4/netfilter/ip_nat_helper.c | |||
@@ -189,7 +189,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, | |||
189 | datalen, 0)); | 189 | datalen, 0)); |
190 | } else | 190 | } else |
191 | tcph->check = nf_proto_csum_update(*pskb, | 191 | tcph->check = nf_proto_csum_update(*pskb, |
192 | htons(oldlen) ^ 0xFFFF, | 192 | htons(oldlen) ^ htons(0xFFFF), |
193 | htons(datalen), | 193 | htons(datalen), |
194 | tcph->check, 1); | 194 | tcph->check, 1); |
195 | 195 | ||
@@ -267,7 +267,7 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, | |||
267 | udph->check = -1; | 267 | udph->check = -1; |
268 | } else | 268 | } else |
269 | udph->check = nf_proto_csum_update(*pskb, | 269 | udph->check = nf_proto_csum_update(*pskb, |
270 | htons(oldlen) ^ 0xFFFF, | 270 | htons(oldlen) ^ htons(0xFFFF), |
271 | htons(datalen), | 271 | htons(datalen), |
272 | udph->check, 1); | 272 | udph->check, 1); |
273 | return 1; | 273 | return 1; |
@@ -283,27 +283,25 @@ sack_adjust(struct sk_buff *skb, | |||
283 | struct ip_nat_seq *natseq) | 283 | struct ip_nat_seq *natseq) |
284 | { | 284 | { |
285 | while (sackoff < sackend) { | 285 | while (sackoff < sackend) { |
286 | struct tcp_sack_block *sack; | 286 | struct tcp_sack_block_wire *sack; |
287 | u_int32_t new_start_seq, new_end_seq; | 287 | __be32 new_start_seq, new_end_seq; |
288 | 288 | ||
289 | sack = (void *)skb->data + sackoff; | 289 | sack = (void *)skb->data + sackoff; |
290 | if (after(ntohl(sack->start_seq) - natseq->offset_before, | 290 | if (after(ntohl(sack->start_seq) - natseq->offset_before, |
291 | natseq->correction_pos)) | 291 | natseq->correction_pos)) |
292 | new_start_seq = ntohl(sack->start_seq) | 292 | new_start_seq = htonl(ntohl(sack->start_seq) |
293 | - natseq->offset_after; | 293 | - natseq->offset_after); |
294 | else | 294 | else |
295 | new_start_seq = ntohl(sack->start_seq) | 295 | new_start_seq = htonl(ntohl(sack->start_seq) |
296 | - natseq->offset_before; | 296 | - natseq->offset_before); |
297 | new_start_seq = htonl(new_start_seq); | ||
298 | 297 | ||
299 | if (after(ntohl(sack->end_seq) - natseq->offset_before, | 298 | if (after(ntohl(sack->end_seq) - natseq->offset_before, |
300 | natseq->correction_pos)) | 299 | natseq->correction_pos)) |
301 | new_end_seq = ntohl(sack->end_seq) | 300 | new_end_seq = htonl(ntohl(sack->end_seq) |
302 | - natseq->offset_after; | 301 | - natseq->offset_after); |
303 | else | 302 | else |
304 | new_end_seq = ntohl(sack->end_seq) | 303 | new_end_seq = htonl(ntohl(sack->end_seq) |
305 | - natseq->offset_before; | 304 | - natseq->offset_before); |
306 | new_end_seq = htonl(new_end_seq); | ||
307 | 305 | ||
308 | DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", | 306 | DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", |
309 | ntohl(sack->start_seq), new_start_seq, | 307 | ntohl(sack->start_seq), new_start_seq, |
@@ -375,7 +373,8 @@ ip_nat_seq_adjust(struct sk_buff **pskb, | |||
375 | enum ip_conntrack_info ctinfo) | 373 | enum ip_conntrack_info ctinfo) |
376 | { | 374 | { |
377 | struct tcphdr *tcph; | 375 | struct tcphdr *tcph; |
378 | int dir, newseq, newack; | 376 | int dir; |
377 | __be32 newseq, newack; | ||
379 | struct ip_nat_seq *this_way, *other_way; | 378 | struct ip_nat_seq *this_way, *other_way; |
380 | 379 | ||
381 | dir = CTINFO2DIR(ctinfo); | 380 | dir = CTINFO2DIR(ctinfo); |
@@ -388,17 +387,15 @@ ip_nat_seq_adjust(struct sk_buff **pskb, | |||
388 | 387 | ||
389 | tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4; | 388 | tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4; |
390 | if (after(ntohl(tcph->seq), this_way->correction_pos)) | 389 | if (after(ntohl(tcph->seq), this_way->correction_pos)) |
391 | newseq = ntohl(tcph->seq) + this_way->offset_after; | 390 | newseq = htonl(ntohl(tcph->seq) + this_way->offset_after); |
392 | else | 391 | else |
393 | newseq = ntohl(tcph->seq) + this_way->offset_before; | 392 | newseq = htonl(ntohl(tcph->seq) + this_way->offset_before); |
394 | newseq = htonl(newseq); | ||
395 | 393 | ||
396 | if (after(ntohl(tcph->ack_seq) - other_way->offset_before, | 394 | if (after(ntohl(tcph->ack_seq) - other_way->offset_before, |
397 | other_way->correction_pos)) | 395 | other_way->correction_pos)) |
398 | newack = ntohl(tcph->ack_seq) - other_way->offset_after; | 396 | newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after); |
399 | else | 397 | else |
400 | newack = ntohl(tcph->ack_seq) - other_way->offset_before; | 398 | newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before); |
401 | newack = htonl(newack); | ||
402 | 399 | ||
403 | tcph->check = nf_proto_csum_update(*pskb, ~tcph->seq, newseq, | 400 | tcph->check = nf_proto_csum_update(*pskb, ~tcph->seq, newseq, |
404 | tcph->check, 0); | 401 | tcph->check, 0); |
diff --git a/net/ipv4/netfilter/ip_nat_helper_h323.c b/net/ipv4/netfilter/ip_nat_helper_h323.c index 419b878fb467..4a7d34466ee2 100644 --- a/net/ipv4/netfilter/ip_nat_helper_h323.c +++ b/net/ipv4/netfilter/ip_nat_helper_h323.c | |||
@@ -32,13 +32,13 @@ | |||
32 | /****************************************************************************/ | 32 | /****************************************************************************/ |
33 | static int set_addr(struct sk_buff **pskb, | 33 | static int set_addr(struct sk_buff **pskb, |
34 | unsigned char **data, int dataoff, | 34 | unsigned char **data, int dataoff, |
35 | unsigned int addroff, u_int32_t ip, u_int16_t port) | 35 | unsigned int addroff, __be32 ip, u_int16_t port) |
36 | { | 36 | { |
37 | enum ip_conntrack_info ctinfo; | 37 | enum ip_conntrack_info ctinfo; |
38 | struct ip_conntrack *ct = ip_conntrack_get(*pskb, &ctinfo); | 38 | struct ip_conntrack *ct = ip_conntrack_get(*pskb, &ctinfo); |
39 | struct { | 39 | struct { |
40 | u_int32_t ip; | 40 | __be32 ip; |
41 | u_int16_t port; | 41 | __be16 port; |
42 | } __attribute__ ((__packed__)) buf; | 42 | } __attribute__ ((__packed__)) buf; |
43 | struct tcphdr _tcph, *th; | 43 | struct tcphdr _tcph, *th; |
44 | 44 | ||
@@ -86,7 +86,7 @@ static int set_addr(struct sk_buff **pskb, | |||
86 | static int set_h225_addr(struct sk_buff **pskb, | 86 | static int set_h225_addr(struct sk_buff **pskb, |
87 | unsigned char **data, int dataoff, | 87 | unsigned char **data, int dataoff, |
88 | TransportAddress * addr, | 88 | TransportAddress * addr, |
89 | u_int32_t ip, u_int16_t port) | 89 | __be32 ip, u_int16_t port) |
90 | { | 90 | { |
91 | return set_addr(pskb, data, dataoff, addr->ipAddress.ip, ip, port); | 91 | return set_addr(pskb, data, dataoff, addr->ipAddress.ip, ip, port); |
92 | } | 92 | } |
@@ -95,7 +95,7 @@ static int set_h225_addr(struct sk_buff **pskb, | |||
95 | static int set_h245_addr(struct sk_buff **pskb, | 95 | static int set_h245_addr(struct sk_buff **pskb, |
96 | unsigned char **data, int dataoff, | 96 | unsigned char **data, int dataoff, |
97 | H245_TransportAddress * addr, | 97 | H245_TransportAddress * addr, |
98 | u_int32_t ip, u_int16_t port) | 98 | __be32 ip, u_int16_t port) |
99 | { | 99 | { |
100 | return set_addr(pskb, data, dataoff, | 100 | return set_addr(pskb, data, dataoff, |
101 | addr->unicastAddress.iPAddress.network, ip, port); | 101 | addr->unicastAddress.iPAddress.network, ip, port); |
@@ -110,7 +110,7 @@ static int set_sig_addr(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
110 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; | 110 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; |
111 | int dir = CTINFO2DIR(ctinfo); | 111 | int dir = CTINFO2DIR(ctinfo); |
112 | int i; | 112 | int i; |
113 | u_int32_t ip; | 113 | __be32 ip; |
114 | u_int16_t port; | 114 | u_int16_t port; |
115 | 115 | ||
116 | for (i = 0; i < count; i++) { | 116 | for (i = 0; i < count; i++) { |
@@ -164,7 +164,7 @@ static int set_ras_addr(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
164 | { | 164 | { |
165 | int dir = CTINFO2DIR(ctinfo); | 165 | int dir = CTINFO2DIR(ctinfo); |
166 | int i; | 166 | int i; |
167 | u_int32_t ip; | 167 | __be32 ip; |
168 | u_int16_t port; | 168 | u_int16_t port; |
169 | 169 | ||
170 | for (i = 0; i < count; i++) { | 170 | for (i = 0; i < count; i++) { |
@@ -433,7 +433,7 @@ static int nat_q931(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
433 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; | 433 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; |
434 | int dir = CTINFO2DIR(ctinfo); | 434 | int dir = CTINFO2DIR(ctinfo); |
435 | u_int16_t nated_port = port; | 435 | u_int16_t nated_port = port; |
436 | u_int32_t ip; | 436 | __be32 ip; |
437 | 437 | ||
438 | /* Set expectations for NAT */ | 438 | /* Set expectations for NAT */ |
439 | exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port; | 439 | exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port; |
diff --git a/net/ipv4/netfilter/ip_nat_helper_pptp.c b/net/ipv4/netfilter/ip_nat_helper_pptp.c index 2ff578807123..329fdcd7d702 100644 --- a/net/ipv4/netfilter/ip_nat_helper_pptp.c +++ b/net/ipv4/netfilter/ip_nat_helper_pptp.c | |||
@@ -51,7 +51,7 @@ | |||
51 | 51 | ||
52 | #define IP_NAT_PPTP_VERSION "3.0" | 52 | #define IP_NAT_PPTP_VERSION "3.0" |
53 | 53 | ||
54 | #define REQ_CID(req, off) (*(u_int16_t *)((char *)(req) + (off))) | 54 | #define REQ_CID(req, off) (*(__be16 *)((char *)(req) + (off))) |
55 | 55 | ||
56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); | 57 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); |
diff --git a/net/ipv4/netfilter/ip_nat_proto_icmp.c b/net/ipv4/netfilter/ip_nat_proto_icmp.c index ec50cc295317..3f6efc13ac74 100644 --- a/net/ipv4/netfilter/ip_nat_proto_icmp.c +++ b/net/ipv4/netfilter/ip_nat_proto_icmp.c | |||
@@ -67,7 +67,7 @@ icmp_manip_pkt(struct sk_buff **pskb, | |||
67 | 67 | ||
68 | hdr = (struct icmphdr *)((*pskb)->data + hdroff); | 68 | hdr = (struct icmphdr *)((*pskb)->data + hdroff); |
69 | hdr->checksum = nf_proto_csum_update(*pskb, | 69 | hdr->checksum = nf_proto_csum_update(*pskb, |
70 | hdr->un.echo.id ^ 0xFFFF, | 70 | hdr->un.echo.id ^ htons(0xFFFF), |
71 | tuple->src.u.icmp.id, | 71 | tuple->src.u.icmp.id, |
72 | hdr->checksum, 0); | 72 | hdr->checksum, 0); |
73 | hdr->un.echo.id = tuple->src.u.icmp.id; | 73 | hdr->un.echo.id = tuple->src.u.icmp.id; |
diff --git a/net/ipv4/netfilter/ip_nat_proto_tcp.c b/net/ipv4/netfilter/ip_nat_proto_tcp.c index 72a6307bd2db..12deb13b93b1 100644 --- a/net/ipv4/netfilter/ip_nat_proto_tcp.c +++ b/net/ipv4/netfilter/ip_nat_proto_tcp.c | |||
@@ -24,7 +24,7 @@ tcp_in_range(const struct ip_conntrack_tuple *tuple, | |||
24 | const union ip_conntrack_manip_proto *min, | 24 | const union ip_conntrack_manip_proto *min, |
25 | const union ip_conntrack_manip_proto *max) | 25 | const union ip_conntrack_manip_proto *max) |
26 | { | 26 | { |
27 | u_int16_t port; | 27 | __be16 port; |
28 | 28 | ||
29 | if (maniptype == IP_NAT_MANIP_SRC) | 29 | if (maniptype == IP_NAT_MANIP_SRC) |
30 | port = tuple->src.u.tcp.port; | 30 | port = tuple->src.u.tcp.port; |
@@ -42,7 +42,7 @@ tcp_unique_tuple(struct ip_conntrack_tuple *tuple, | |||
42 | const struct ip_conntrack *conntrack) | 42 | const struct ip_conntrack *conntrack) |
43 | { | 43 | { |
44 | static u_int16_t port; | 44 | static u_int16_t port; |
45 | u_int16_t *portptr; | 45 | __be16 *portptr; |
46 | unsigned int range_size, min, i; | 46 | unsigned int range_size, min, i; |
47 | 47 | ||
48 | if (maniptype == IP_NAT_MANIP_SRC) | 48 | if (maniptype == IP_NAT_MANIP_SRC) |
@@ -93,8 +93,8 @@ tcp_manip_pkt(struct sk_buff **pskb, | |||
93 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); | 93 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); |
94 | struct tcphdr *hdr; | 94 | struct tcphdr *hdr; |
95 | unsigned int hdroff = iphdroff + iph->ihl*4; | 95 | unsigned int hdroff = iphdroff + iph->ihl*4; |
96 | u32 oldip, newip; | 96 | __be32 oldip, newip; |
97 | u16 *portptr, newport, oldport; | 97 | __be16 *portptr, newport, oldport; |
98 | int hdrsize = 8; /* TCP connection tracking guarantees this much */ | 98 | int hdrsize = 8; /* TCP connection tracking guarantees this much */ |
99 | 99 | ||
100 | /* this could be a inner header returned in icmp packet; in such | 100 | /* this could be a inner header returned in icmp packet; in such |
@@ -130,7 +130,7 @@ tcp_manip_pkt(struct sk_buff **pskb, | |||
130 | return 1; | 130 | return 1; |
131 | 131 | ||
132 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, hdr->check, 1); | 132 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, hdr->check, 1); |
133 | hdr->check = nf_proto_csum_update(*pskb, oldport ^ 0xFFFF, newport, | 133 | hdr->check = nf_proto_csum_update(*pskb, oldport ^ htons(0xFFFF), newport, |
134 | hdr->check, 0); | 134 | hdr->check, 0); |
135 | return 1; | 135 | return 1; |
136 | } | 136 | } |
diff --git a/net/ipv4/netfilter/ip_nat_proto_udp.c b/net/ipv4/netfilter/ip_nat_proto_udp.c index 5da196ae758c..4bbec7730d18 100644 --- a/net/ipv4/netfilter/ip_nat_proto_udp.c +++ b/net/ipv4/netfilter/ip_nat_proto_udp.c | |||
@@ -24,7 +24,7 @@ udp_in_range(const struct ip_conntrack_tuple *tuple, | |||
24 | const union ip_conntrack_manip_proto *min, | 24 | const union ip_conntrack_manip_proto *min, |
25 | const union ip_conntrack_manip_proto *max) | 25 | const union ip_conntrack_manip_proto *max) |
26 | { | 26 | { |
27 | u_int16_t port; | 27 | __be16 port; |
28 | 28 | ||
29 | if (maniptype == IP_NAT_MANIP_SRC) | 29 | if (maniptype == IP_NAT_MANIP_SRC) |
30 | port = tuple->src.u.udp.port; | 30 | port = tuple->src.u.udp.port; |
@@ -42,7 +42,7 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple, | |||
42 | const struct ip_conntrack *conntrack) | 42 | const struct ip_conntrack *conntrack) |
43 | { | 43 | { |
44 | static u_int16_t port; | 44 | static u_int16_t port; |
45 | u_int16_t *portptr; | 45 | __be16 *portptr; |
46 | unsigned int range_size, min, i; | 46 | unsigned int range_size, min, i; |
47 | 47 | ||
48 | if (maniptype == IP_NAT_MANIP_SRC) | 48 | if (maniptype == IP_NAT_MANIP_SRC) |
@@ -91,8 +91,8 @@ udp_manip_pkt(struct sk_buff **pskb, | |||
91 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); | 91 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); |
92 | struct udphdr *hdr; | 92 | struct udphdr *hdr; |
93 | unsigned int hdroff = iphdroff + iph->ihl*4; | 93 | unsigned int hdroff = iphdroff + iph->ihl*4; |
94 | u32 oldip, newip; | 94 | __be32 oldip, newip; |
95 | u16 *portptr, newport; | 95 | __be16 *portptr, newport; |
96 | 96 | ||
97 | if (!skb_make_writable(pskb, hdroff + sizeof(*hdr))) | 97 | if (!skb_make_writable(pskb, hdroff + sizeof(*hdr))) |
98 | return 0; | 98 | return 0; |
@@ -118,7 +118,7 @@ udp_manip_pkt(struct sk_buff **pskb, | |||
118 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, | 118 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, |
119 | hdr->check, 1); | 119 | hdr->check, 1); |
120 | hdr->check = nf_proto_csum_update(*pskb, | 120 | hdr->check = nf_proto_csum_update(*pskb, |
121 | *portptr ^ 0xFFFF, newport, | 121 | *portptr ^ htons(0xFFFF), newport, |
122 | hdr->check, 0); | 122 | hdr->check, 0); |
123 | if (!hdr->check) | 123 | if (!hdr->check) |
124 | hdr->check = -1; | 124 | hdr->check = -1; |
diff --git a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c index 7b703839aa58..a176aa3031e0 100644 --- a/net/ipv4/netfilter/ip_nat_rule.c +++ b/net/ipv4/netfilter/ip_nat_rule.c | |||
@@ -119,7 +119,7 @@ static unsigned int ipt_snat_target(struct sk_buff **pskb, | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /* Before 2.6.11 we did implicit source NAT if required. Warn about change. */ | 121 | /* Before 2.6.11 we did implicit source NAT if required. Warn about change. */ |
122 | static void warn_if_extra_mangle(u32 dstip, u32 srcip) | 122 | static void warn_if_extra_mangle(__be32 dstip, __be32 srcip) |
123 | { | 123 | { |
124 | static int warned = 0; | 124 | static int warned = 0; |
125 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dstip } } }; | 125 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dstip } } }; |
@@ -205,7 +205,7 @@ alloc_null_binding(struct ip_conntrack *conntrack, | |||
205 | per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). | 205 | per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). |
206 | Use reply in case it's already been mangled (eg local packet). | 206 | Use reply in case it's already been mangled (eg local packet). |
207 | */ | 207 | */ |
208 | u_int32_t ip | 208 | __be32 ip |
209 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC | 209 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC |
210 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip | 210 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip |
211 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); | 211 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); |
@@ -222,7 +222,7 @@ alloc_null_binding_confirmed(struct ip_conntrack *conntrack, | |||
222 | struct ip_nat_info *info, | 222 | struct ip_nat_info *info, |
223 | unsigned int hooknum) | 223 | unsigned int hooknum) |
224 | { | 224 | { |
225 | u_int32_t ip | 225 | __be32 ip |
226 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC | 226 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC |
227 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip | 227 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip |
228 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); | 228 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); |
diff --git a/net/ipv4/netfilter/ip_nat_sip.c b/net/ipv4/netfilter/ip_nat_sip.c index 6ffba63adca2..71fc2730a007 100644 --- a/net/ipv4/netfilter/ip_nat_sip.c +++ b/net/ipv4/netfilter/ip_nat_sip.c | |||
@@ -60,8 +60,8 @@ static unsigned int ip_nat_sip(struct sk_buff **pskb, | |||
60 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); | 60 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); |
61 | char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; | 61 | char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; |
62 | unsigned int bufflen, dataoff; | 62 | unsigned int bufflen, dataoff; |
63 | u_int32_t ip; | 63 | __be32 ip; |
64 | u_int16_t port; | 64 | __be16 port; |
65 | 65 | ||
66 | dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr); | 66 | dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr); |
67 | 67 | ||
@@ -159,7 +159,7 @@ static int mangle_content_len(struct sk_buff **pskb, | |||
159 | static unsigned int mangle_sdp(struct sk_buff **pskb, | 159 | static unsigned int mangle_sdp(struct sk_buff **pskb, |
160 | enum ip_conntrack_info ctinfo, | 160 | enum ip_conntrack_info ctinfo, |
161 | struct ip_conntrack *ct, | 161 | struct ip_conntrack *ct, |
162 | u_int32_t newip, u_int16_t port, | 162 | __be32 newip, u_int16_t port, |
163 | const char *dptr) | 163 | const char *dptr) |
164 | { | 164 | { |
165 | char buffer[sizeof("nnn.nnn.nnn.nnn")]; | 165 | char buffer[sizeof("nnn.nnn.nnn.nnn")]; |
@@ -195,7 +195,7 @@ static unsigned int ip_nat_sdp(struct sk_buff **pskb, | |||
195 | { | 195 | { |
196 | struct ip_conntrack *ct = exp->master; | 196 | struct ip_conntrack *ct = exp->master; |
197 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); | 197 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); |
198 | u_int32_t newip; | 198 | __be32 newip; |
199 | u_int16_t port; | 199 | u_int16_t port; |
200 | 200 | ||
201 | DEBUGP("ip_nat_sdp():\n"); | 201 | DEBUGP("ip_nat_sdp():\n"); |
diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index 18b7fbdccb61..168f45fa1898 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c | |||
@@ -1211,7 +1211,7 @@ static int snmp_translate(struct ip_conntrack *ct, | |||
1211 | struct sk_buff **pskb) | 1211 | struct sk_buff **pskb) |
1212 | { | 1212 | { |
1213 | struct iphdr *iph = (*pskb)->nh.iph; | 1213 | struct iphdr *iph = (*pskb)->nh.iph; |
1214 | struct udphdr *udph = (struct udphdr *)((u_int32_t *)iph + iph->ihl); | 1214 | struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl); |
1215 | u_int16_t udplen = ntohs(udph->len); | 1215 | u_int16_t udplen = ntohs(udph->len); |
1216 | u_int16_t paylen = udplen - sizeof(struct udphdr); | 1216 | u_int16_t paylen = udplen - sizeof(struct udphdr); |
1217 | int dir = CTINFO2DIR(ctinfo); | 1217 | int dir = CTINFO2DIR(ctinfo); |
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c index 9c577db62047..021395b67463 100644 --- a/net/ipv4/netfilter/ip_nat_standalone.c +++ b/net/ipv4/netfilter/ip_nat_standalone.c | |||
@@ -191,7 +191,7 @@ ip_nat_in(unsigned int hooknum, | |||
191 | int (*okfn)(struct sk_buff *)) | 191 | int (*okfn)(struct sk_buff *)) |
192 | { | 192 | { |
193 | unsigned int ret; | 193 | unsigned int ret; |
194 | u_int32_t daddr = (*pskb)->nh.iph->daddr; | 194 | __be32 daddr = (*pskb)->nh.iph->daddr; |
195 | 195 | ||
196 | ret = ip_nat_fn(hooknum, pskb, in, out, okfn); | 196 | ret = ip_nat_fn(hooknum, pskb, in, out, okfn); |
197 | if (ret != NF_DROP && ret != NF_STOLEN | 197 | if (ret != NF_DROP && ret != NF_STOLEN |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 41589665fc5d..7a29d6e7baa7 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -52,7 +52,7 @@ struct clusterip_config { | |||
52 | atomic_t entries; /* number of entries/rules | 52 | atomic_t entries; /* number of entries/rules |
53 | * referencing us */ | 53 | * referencing us */ |
54 | 54 | ||
55 | u_int32_t clusterip; /* the IP address */ | 55 | __be32 clusterip; /* the IP address */ |
56 | u_int8_t clustermac[ETH_ALEN]; /* the MAC address */ | 56 | u_int8_t clustermac[ETH_ALEN]; /* the MAC address */ |
57 | struct net_device *dev; /* device */ | 57 | struct net_device *dev; /* device */ |
58 | u_int16_t num_total_nodes; /* total number of nodes */ | 58 | u_int16_t num_total_nodes; /* total number of nodes */ |
@@ -119,7 +119,7 @@ clusterip_config_entry_put(struct clusterip_config *c) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | static struct clusterip_config * | 121 | static struct clusterip_config * |
122 | __clusterip_config_find(u_int32_t clusterip) | 122 | __clusterip_config_find(__be32 clusterip) |
123 | { | 123 | { |
124 | struct list_head *pos; | 124 | struct list_head *pos; |
125 | 125 | ||
@@ -136,7 +136,7 @@ __clusterip_config_find(u_int32_t clusterip) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | static inline struct clusterip_config * | 138 | static inline struct clusterip_config * |
139 | clusterip_config_find_get(u_int32_t clusterip, int entry) | 139 | clusterip_config_find_get(__be32 clusterip, int entry) |
140 | { | 140 | { |
141 | struct clusterip_config *c; | 141 | struct clusterip_config *c; |
142 | 142 | ||
@@ -166,7 +166,7 @@ clusterip_config_init_nodelist(struct clusterip_config *c, | |||
166 | } | 166 | } |
167 | 167 | ||
168 | static struct clusterip_config * | 168 | static struct clusterip_config * |
169 | clusterip_config_init(struct ipt_clusterip_tgt_info *i, u_int32_t ip, | 169 | clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip, |
170 | struct net_device *dev) | 170 | struct net_device *dev) |
171 | { | 171 | { |
172 | struct clusterip_config *c; | 172 | struct clusterip_config *c; |
@@ -387,7 +387,7 @@ checkentry(const char *tablename, | |||
387 | return 0; | 387 | return 0; |
388 | 388 | ||
389 | } | 389 | } |
390 | if (e->ip.dmsk.s_addr != 0xffffffff | 390 | if (e->ip.dmsk.s_addr != htonl(0xffffffff) |
391 | || e->ip.dst.s_addr == 0) { | 391 | || e->ip.dst.s_addr == 0) { |
392 | printk(KERN_ERR "CLUSTERIP: Please specify destination IP\n"); | 392 | printk(KERN_ERR "CLUSTERIP: Please specify destination IP\n"); |
393 | return 0; | 393 | return 0; |
@@ -476,9 +476,9 @@ static struct ipt_target clusterip_tgt = { | |||
476 | /* hardcoded for 48bit ethernet and 32bit ipv4 addresses */ | 476 | /* hardcoded for 48bit ethernet and 32bit ipv4 addresses */ |
477 | struct arp_payload { | 477 | struct arp_payload { |
478 | u_int8_t src_hw[ETH_ALEN]; | 478 | u_int8_t src_hw[ETH_ALEN]; |
479 | u_int32_t src_ip; | 479 | __be32 src_ip; |
480 | u_int8_t dst_hw[ETH_ALEN]; | 480 | u_int8_t dst_hw[ETH_ALEN]; |
481 | u_int32_t dst_ip; | 481 | __be32 dst_ip; |
482 | } __attribute__ ((packed)); | 482 | } __attribute__ ((packed)); |
483 | 483 | ||
484 | #ifdef CLUSTERIP_DEBUG | 484 | #ifdef CLUSTERIP_DEBUG |
diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c index 23f9c7ebe7eb..12a818a2462f 100644 --- a/net/ipv4/netfilter/ipt_ECN.c +++ b/net/ipv4/netfilter/ipt_ECN.c | |||
@@ -28,7 +28,7 @@ static inline int | |||
28 | set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | 28 | set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) |
29 | { | 29 | { |
30 | struct iphdr *iph = (*pskb)->nh.iph; | 30 | struct iphdr *iph = (*pskb)->nh.iph; |
31 | u_int16_t oldtos; | 31 | __be16 oldtos; |
32 | 32 | ||
33 | if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { | 33 | if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { |
34 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) | 34 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) |
@@ -37,7 +37,7 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | |||
37 | oldtos = iph->tos; | 37 | oldtos = iph->tos; |
38 | iph->tos &= ~IPT_ECN_IP_MASK; | 38 | iph->tos &= ~IPT_ECN_IP_MASK; |
39 | iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); | 39 | iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); |
40 | iph->check = nf_csum_update(oldtos ^ 0xFFFF, iph->tos, | 40 | iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, |
41 | iph->check); | 41 | iph->check); |
42 | } | 42 | } |
43 | return 1; | 43 | return 1; |
@@ -48,7 +48,7 @@ static inline int | |||
48 | set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | 48 | set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) |
49 | { | 49 | { |
50 | struct tcphdr _tcph, *tcph; | 50 | struct tcphdr _tcph, *tcph; |
51 | u_int16_t oldval; | 51 | __be16 oldval; |
52 | 52 | ||
53 | /* Not enought header? */ | 53 | /* Not enought header? */ |
54 | tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4, | 54 | tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4, |
@@ -66,15 +66,15 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | |||
66 | return 0; | 66 | return 0; |
67 | tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4; | 67 | tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4; |
68 | 68 | ||
69 | oldval = ((u_int16_t *)tcph)[6]; | 69 | oldval = ((__be16 *)tcph)[6]; |
70 | if (einfo->operation & IPT_ECN_OP_SET_ECE) | 70 | if (einfo->operation & IPT_ECN_OP_SET_ECE) |
71 | tcph->ece = einfo->proto.tcp.ece; | 71 | tcph->ece = einfo->proto.tcp.ece; |
72 | if (einfo->operation & IPT_ECN_OP_SET_CWR) | 72 | if (einfo->operation & IPT_ECN_OP_SET_CWR) |
73 | tcph->cwr = einfo->proto.tcp.cwr; | 73 | tcph->cwr = einfo->proto.tcp.cwr; |
74 | 74 | ||
75 | tcph->check = nf_proto_csum_update((*pskb), | 75 | tcph->check = nf_proto_csum_update((*pskb), |
76 | oldval ^ 0xFFFF, | 76 | oldval ^ htons(0xFFFF), |
77 | ((u_int16_t *)tcph)[6], | 77 | ((__be16 *)tcph)[6], |
78 | tcph->check, 0); | 78 | tcph->check, 0); |
79 | return 1; | 79 | return 1; |
80 | } | 80 | } |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index bc65168a3437..3dbfcfac8a84 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -70,7 +70,7 @@ masquerade_target(struct sk_buff **pskb, | |||
70 | const struct ip_nat_multi_range_compat *mr; | 70 | const struct ip_nat_multi_range_compat *mr; |
71 | struct ip_nat_range newrange; | 71 | struct ip_nat_range newrange; |
72 | struct rtable *rt; | 72 | struct rtable *rt; |
73 | u_int32_t newsrc; | 73 | __be32 newsrc; |
74 | 74 | ||
75 | IP_NF_ASSERT(hooknum == NF_IP_POST_ROUTING); | 75 | IP_NF_ASSERT(hooknum == NF_IP_POST_ROUTING); |
76 | 76 | ||
diff --git a/net/ipv4/netfilter/ipt_NETMAP.c b/net/ipv4/netfilter/ipt_NETMAP.c index beb2914225ff..58a88f227108 100644 --- a/net/ipv4/netfilter/ipt_NETMAP.c +++ b/net/ipv4/netfilter/ipt_NETMAP.c | |||
@@ -58,7 +58,7 @@ target(struct sk_buff **pskb, | |||
58 | { | 58 | { |
59 | struct ip_conntrack *ct; | 59 | struct ip_conntrack *ct; |
60 | enum ip_conntrack_info ctinfo; | 60 | enum ip_conntrack_info ctinfo; |
61 | u_int32_t new_ip, netmask; | 61 | __be32 new_ip, netmask; |
62 | const struct ip_nat_multi_range_compat *mr = targinfo; | 62 | const struct ip_nat_multi_range_compat *mr = targinfo; |
63 | struct ip_nat_range newrange; | 63 | struct ip_nat_range newrange; |
64 | 64 | ||
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index f03d43671c6d..c0dcfe9d610c 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -61,7 +61,7 @@ redirect_target(struct sk_buff **pskb, | |||
61 | { | 61 | { |
62 | struct ip_conntrack *ct; | 62 | struct ip_conntrack *ct; |
63 | enum ip_conntrack_info ctinfo; | 63 | enum ip_conntrack_info ctinfo; |
64 | u_int32_t newdst; | 64 | __be32 newdst; |
65 | const struct ip_nat_multi_range_compat *mr = targinfo; | 65 | const struct ip_nat_multi_range_compat *mr = targinfo; |
66 | struct ip_nat_range newrange; | 66 | struct ip_nat_range newrange; |
67 | 67 | ||
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index b81821edd893..fd0c05efed8a 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -104,8 +104,8 @@ static void send_reset(struct sk_buff *oldskb, int hook) | |||
104 | struct iphdr *iph = oldskb->nh.iph; | 104 | struct iphdr *iph = oldskb->nh.iph; |
105 | struct tcphdr _otcph, *oth, *tcph; | 105 | struct tcphdr _otcph, *oth, *tcph; |
106 | struct rtable *rt; | 106 | struct rtable *rt; |
107 | u_int16_t tmp_port; | 107 | __be16 tmp_port; |
108 | u_int32_t tmp_addr; | 108 | __be32 tmp_addr; |
109 | int needs_ack; | 109 | int needs_ack; |
110 | int hh_len; | 110 | int hh_len; |
111 | 111 | ||
diff --git a/net/ipv4/netfilter/ipt_SAME.c b/net/ipv4/netfilter/ipt_SAME.c index efbcb1198832..b38b13328d73 100644 --- a/net/ipv4/netfilter/ipt_SAME.c +++ b/net/ipv4/netfilter/ipt_SAME.c | |||
@@ -135,7 +135,8 @@ same_target(struct sk_buff **pskb, | |||
135 | { | 135 | { |
136 | struct ip_conntrack *ct; | 136 | struct ip_conntrack *ct; |
137 | enum ip_conntrack_info ctinfo; | 137 | enum ip_conntrack_info ctinfo; |
138 | u_int32_t tmpip, aindex, new_ip; | 138 | u_int32_t tmpip, aindex; |
139 | __be32 new_ip; | ||
139 | const struct ipt_same_info *same = targinfo; | 140 | const struct ipt_same_info *same = targinfo; |
140 | struct ip_nat_range newrange; | 141 | struct ip_nat_range newrange; |
141 | const struct ip_conntrack_tuple *t; | 142 | const struct ip_conntrack_tuple *t; |
diff --git a/net/ipv4/netfilter/ipt_TCPMSS.c b/net/ipv4/netfilter/ipt_TCPMSS.c index 4246c4321e5b..108b6b76311f 100644 --- a/net/ipv4/netfilter/ipt_TCPMSS.c +++ b/net/ipv4/netfilter/ipt_TCPMSS.c | |||
@@ -42,7 +42,8 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
42 | const struct ipt_tcpmss_info *tcpmssinfo = targinfo; | 42 | const struct ipt_tcpmss_info *tcpmssinfo = targinfo; |
43 | struct tcphdr *tcph; | 43 | struct tcphdr *tcph; |
44 | struct iphdr *iph; | 44 | struct iphdr *iph; |
45 | u_int16_t tcplen, newtotlen, oldval, newmss; | 45 | u_int16_t tcplen, newmss; |
46 | __be16 newtotlen, oldval; | ||
46 | unsigned int i; | 47 | unsigned int i; |
47 | u_int8_t *opt; | 48 | u_int8_t *opt; |
48 | 49 | ||
@@ -97,7 +98,7 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
97 | opt[i+3] = (newmss & 0x00ff); | 98 | opt[i+3] = (newmss & 0x00ff); |
98 | 99 | ||
99 | tcph->check = nf_proto_csum_update(*pskb, | 100 | tcph->check = nf_proto_csum_update(*pskb, |
100 | htons(oldmss)^0xFFFF, | 101 | htons(oldmss)^htons(0xFFFF), |
101 | htons(newmss), | 102 | htons(newmss), |
102 | tcph->check, 0); | 103 | tcph->check, 0); |
103 | return IPT_CONTINUE; | 104 | return IPT_CONTINUE; |
@@ -126,7 +127,7 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
126 | memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); | 127 | memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); |
127 | 128 | ||
128 | tcph->check = nf_proto_csum_update(*pskb, | 129 | tcph->check = nf_proto_csum_update(*pskb, |
129 | htons(tcplen) ^ 0xFFFF, | 130 | htons(tcplen) ^ htons(0xFFFF), |
130 | htons(tcplen + TCPOLEN_MSS), | 131 | htons(tcplen + TCPOLEN_MSS), |
131 | tcph->check, 1); | 132 | tcph->check, 1); |
132 | opt[0] = TCPOPT_MSS; | 133 | opt[0] = TCPOPT_MSS; |
@@ -134,18 +135,18 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
134 | opt[2] = (newmss & 0xff00) >> 8; | 135 | opt[2] = (newmss & 0xff00) >> 8; |
135 | opt[3] = (newmss & 0x00ff); | 136 | opt[3] = (newmss & 0x00ff); |
136 | 137 | ||
137 | tcph->check = nf_proto_csum_update(*pskb, ~0, *((u_int32_t *)opt), | 138 | tcph->check = nf_proto_csum_update(*pskb, htonl(~0), *((__be32 *)opt), |
138 | tcph->check, 0); | 139 | tcph->check, 0); |
139 | 140 | ||
140 | oldval = ((u_int16_t *)tcph)[6]; | 141 | oldval = ((__be16 *)tcph)[6]; |
141 | tcph->doff += TCPOLEN_MSS/4; | 142 | tcph->doff += TCPOLEN_MSS/4; |
142 | tcph->check = nf_proto_csum_update(*pskb, | 143 | tcph->check = nf_proto_csum_update(*pskb, |
143 | oldval ^ 0xFFFF, | 144 | oldval ^ htons(0xFFFF), |
144 | ((u_int16_t *)tcph)[6], | 145 | ((__be16 *)tcph)[6], |
145 | tcph->check, 0); | 146 | tcph->check, 0); |
146 | 147 | ||
147 | newtotlen = htons(ntohs(iph->tot_len) + TCPOLEN_MSS); | 148 | newtotlen = htons(ntohs(iph->tot_len) + TCPOLEN_MSS); |
148 | iph->check = nf_csum_update(iph->tot_len ^ 0xFFFF, | 149 | iph->check = nf_csum_update(iph->tot_len ^ htons(0xFFFF), |
149 | newtotlen, iph->check); | 150 | newtotlen, iph->check); |
150 | iph->tot_len = newtotlen; | 151 | iph->tot_len = newtotlen; |
151 | return IPT_CONTINUE; | 152 | return IPT_CONTINUE; |
diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c index 471a4c438b0a..6b8b14ccc3d3 100644 --- a/net/ipv4/netfilter/ipt_TOS.c +++ b/net/ipv4/netfilter/ipt_TOS.c | |||
@@ -30,7 +30,7 @@ target(struct sk_buff **pskb, | |||
30 | { | 30 | { |
31 | const struct ipt_tos_target_info *tosinfo = targinfo; | 31 | const struct ipt_tos_target_info *tosinfo = targinfo; |
32 | struct iphdr *iph = (*pskb)->nh.iph; | 32 | struct iphdr *iph = (*pskb)->nh.iph; |
33 | u_int16_t oldtos; | 33 | __be16 oldtos; |
34 | 34 | ||
35 | if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) { | 35 | if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) { |
36 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) | 36 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) |
@@ -38,7 +38,7 @@ target(struct sk_buff **pskb, | |||
38 | iph = (*pskb)->nh.iph; | 38 | iph = (*pskb)->nh.iph; |
39 | oldtos = iph->tos; | 39 | oldtos = iph->tos; |
40 | iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos; | 40 | iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos; |
41 | iph->check = nf_csum_update(oldtos ^ 0xFFFF, iph->tos, | 41 | iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, |
42 | iph->check); | 42 | iph->check); |
43 | } | 43 | } |
44 | return IPT_CONTINUE; | 44 | return IPT_CONTINUE; |
diff --git a/net/ipv4/netfilter/ipt_TTL.c b/net/ipv4/netfilter/ipt_TTL.c index 96e79cc6d0f2..ac9517d62af0 100644 --- a/net/ipv4/netfilter/ipt_TTL.c +++ b/net/ipv4/netfilter/ipt_TTL.c | |||
@@ -54,8 +54,8 @@ ipt_ttl_target(struct sk_buff **pskb, | |||
54 | } | 54 | } |
55 | 55 | ||
56 | if (new_ttl != iph->ttl) { | 56 | if (new_ttl != iph->ttl) { |
57 | iph->check = nf_csum_update(ntohs((iph->ttl << 8)) ^ 0xFFFF, | 57 | iph->check = nf_csum_update(htons((iph->ttl << 8)) ^ htons(0xFFFF), |
58 | ntohs(new_ttl << 8), | 58 | htons(new_ttl << 8), |
59 | iph->check); | 59 | iph->check); |
60 | iph->ttl = new_ttl; | 60 | iph->ttl = new_ttl; |
61 | } | 61 | } |
diff --git a/net/ipv4/netfilter/ipt_addrtype.c b/net/ipv4/netfilter/ipt_addrtype.c index 893dae210b04..7b60eb74788b 100644 --- a/net/ipv4/netfilter/ipt_addrtype.c +++ b/net/ipv4/netfilter/ipt_addrtype.c | |||
@@ -22,7 +22,7 @@ MODULE_LICENSE("GPL"); | |||
22 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); | 22 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); |
23 | MODULE_DESCRIPTION("iptables addrtype match"); | 23 | MODULE_DESCRIPTION("iptables addrtype match"); |
24 | 24 | ||
25 | static inline int match_type(u_int32_t addr, u_int16_t mask) | 25 | static inline int match_type(__be32 addr, u_int16_t mask) |
26 | { | 26 | { |
27 | return !!(mask & (1 << inet_addr_type(addr))); | 27 | return !!(mask & (1 << inet_addr_type(addr))); |
28 | } | 28 | } |
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index 4f73a61aa3dd..33ccdbf8e794 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -50,11 +50,11 @@ static struct file_operations dl_file_ops; | |||
50 | /* hash table crap */ | 50 | /* hash table crap */ |
51 | 51 | ||
52 | struct dsthash_dst { | 52 | struct dsthash_dst { |
53 | u_int32_t src_ip; | 53 | __be32 src_ip; |
54 | u_int32_t dst_ip; | 54 | __be32 dst_ip; |
55 | /* ports have to be consecutive !!! */ | 55 | /* ports have to be consecutive !!! */ |
56 | u_int16_t src_port; | 56 | __be16 src_port; |
57 | u_int16_t dst_port; | 57 | __be16 dst_port; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct dsthash_ent { | 60 | struct dsthash_ent { |
@@ -106,8 +106,10 @@ static inline int dst_cmp(const struct dsthash_ent *ent, struct dsthash_dst *b) | |||
106 | static inline u_int32_t | 106 | static inline u_int32_t |
107 | hash_dst(const struct ipt_hashlimit_htable *ht, const struct dsthash_dst *dst) | 107 | hash_dst(const struct ipt_hashlimit_htable *ht, const struct dsthash_dst *dst) |
108 | { | 108 | { |
109 | return (jhash_3words(dst->dst_ip, (dst->dst_port<<16 | dst->src_port), | 109 | return (jhash_3words((__force u32)dst->dst_ip, |
110 | dst->src_ip, ht->rnd) % ht->cfg.size); | 110 | ((__force u32)dst->dst_port<<16 | |
111 | (__force u32)dst->src_port), | ||
112 | (__force u32)dst->src_ip, ht->rnd) % ht->cfg.size); | ||
111 | } | 113 | } |
112 | 114 | ||
113 | static inline struct dsthash_ent * | 115 | static inline struct dsthash_ent * |
@@ -406,7 +408,7 @@ hashlimit_match(const struct sk_buff *skb, | |||
406 | dst.src_ip = skb->nh.iph->saddr; | 408 | dst.src_ip = skb->nh.iph->saddr; |
407 | if (hinfo->cfg.mode & IPT_HASHLIMIT_HASH_DPT | 409 | if (hinfo->cfg.mode & IPT_HASHLIMIT_HASH_DPT |
408 | ||hinfo->cfg.mode & IPT_HASHLIMIT_HASH_SPT) { | 410 | ||hinfo->cfg.mode & IPT_HASHLIMIT_HASH_SPT) { |
409 | u_int16_t _ports[2], *ports; | 411 | __be16 _ports[2], *ports; |
410 | 412 | ||
411 | switch (skb->nh.iph->protocol) { | 413 | switch (skb->nh.iph->protocol) { |
412 | case IPPROTO_TCP: | 414 | case IPPROTO_TCP: |
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 32ae8d7ac506..126db44e71a8 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -50,11 +50,10 @@ MODULE_PARM_DESC(ip_list_perms, "permissions on /proc/net/ipt_recent/* files"); | |||
50 | MODULE_PARM_DESC(ip_list_uid,"owner of /proc/net/ipt_recent/* files"); | 50 | MODULE_PARM_DESC(ip_list_uid,"owner of /proc/net/ipt_recent/* files"); |
51 | MODULE_PARM_DESC(ip_list_gid,"owning group of /proc/net/ipt_recent/* files"); | 51 | MODULE_PARM_DESC(ip_list_gid,"owning group of /proc/net/ipt_recent/* files"); |
52 | 52 | ||
53 | |||
54 | struct recent_entry { | 53 | struct recent_entry { |
55 | struct list_head list; | 54 | struct list_head list; |
56 | struct list_head lru_list; | 55 | struct list_head lru_list; |
57 | u_int32_t addr; | 56 | __be32 addr; |
58 | u_int8_t ttl; | 57 | u_int8_t ttl; |
59 | u_int8_t index; | 58 | u_int8_t index; |
60 | u_int16_t nstamps; | 59 | u_int16_t nstamps; |
@@ -85,17 +84,17 @@ static struct file_operations recent_fops; | |||
85 | static u_int32_t hash_rnd; | 84 | static u_int32_t hash_rnd; |
86 | static int hash_rnd_initted; | 85 | static int hash_rnd_initted; |
87 | 86 | ||
88 | static unsigned int recent_entry_hash(u_int32_t addr) | 87 | static unsigned int recent_entry_hash(__be32 addr) |
89 | { | 88 | { |
90 | if (!hash_rnd_initted) { | 89 | if (!hash_rnd_initted) { |
91 | get_random_bytes(&hash_rnd, 4); | 90 | get_random_bytes(&hash_rnd, 4); |
92 | hash_rnd_initted = 1; | 91 | hash_rnd_initted = 1; |
93 | } | 92 | } |
94 | return jhash_1word(addr, hash_rnd) & (ip_list_hash_size - 1); | 93 | return jhash_1word((__force u32)addr, hash_rnd) & (ip_list_hash_size - 1); |
95 | } | 94 | } |
96 | 95 | ||
97 | static struct recent_entry * | 96 | static struct recent_entry * |
98 | recent_entry_lookup(const struct recent_table *table, u_int32_t addr, u_int8_t ttl) | 97 | recent_entry_lookup(const struct recent_table *table, __be32 addr, u_int8_t ttl) |
99 | { | 98 | { |
100 | struct recent_entry *e; | 99 | struct recent_entry *e; |
101 | unsigned int h; | 100 | unsigned int h; |
@@ -116,7 +115,7 @@ static void recent_entry_remove(struct recent_table *t, struct recent_entry *e) | |||
116 | } | 115 | } |
117 | 116 | ||
118 | static struct recent_entry * | 117 | static struct recent_entry * |
119 | recent_entry_init(struct recent_table *t, u_int32_t addr, u_int8_t ttl) | 118 | recent_entry_init(struct recent_table *t, __be32 addr, u_int8_t ttl) |
120 | { | 119 | { |
121 | struct recent_entry *e; | 120 | struct recent_entry *e; |
122 | 121 | ||
@@ -178,7 +177,7 @@ ipt_recent_match(const struct sk_buff *skb, | |||
178 | const struct ipt_recent_info *info = matchinfo; | 177 | const struct ipt_recent_info *info = matchinfo; |
179 | struct recent_table *t; | 178 | struct recent_table *t; |
180 | struct recent_entry *e; | 179 | struct recent_entry *e; |
181 | u_int32_t addr; | 180 | __be32 addr; |
182 | u_int8_t ttl; | 181 | u_int8_t ttl; |
183 | int ret = info->invert; | 182 | int ret = info->invert; |
184 | 183 | ||
@@ -406,7 +405,7 @@ static ssize_t recent_proc_write(struct file *file, const char __user *input, | |||
406 | struct recent_table *t = pde->data; | 405 | struct recent_table *t = pde->data; |
407 | struct recent_entry *e; | 406 | struct recent_entry *e; |
408 | char buf[sizeof("+255.255.255.255")], *c = buf; | 407 | char buf[sizeof("+255.255.255.255")], *c = buf; |
409 | u_int32_t addr; | 408 | __be32 addr; |
410 | int add; | 409 | int add; |
411 | 410 | ||
412 | if (size > sizeof(buf)) | 411 | if (size > sizeof(buf)) |
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c index 79336cb42527..e62ea2bb9c0a 100644 --- a/net/ipv4/netfilter/iptable_mangle.c +++ b/net/ipv4/netfilter/iptable_mangle.c | |||
@@ -131,7 +131,7 @@ ipt_local_hook(unsigned int hook, | |||
131 | { | 131 | { |
132 | unsigned int ret; | 132 | unsigned int ret; |
133 | u_int8_t tos; | 133 | u_int8_t tos; |
134 | u_int32_t saddr, daddr; | 134 | __be32 saddr, daddr; |
135 | unsigned long nfmark; | 135 | unsigned long nfmark; |
136 | 136 | ||
137 | /* root is playing with raw sockets. */ | 137 | /* root is playing with raw sockets. */ |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 0e935b4c8741..b430cf2a4f66 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -381,8 +381,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
381 | struct ipcm_cookie ipc; | 381 | struct ipcm_cookie ipc; |
382 | struct rtable *rt = NULL; | 382 | struct rtable *rt = NULL; |
383 | int free = 0; | 383 | int free = 0; |
384 | u32 daddr; | 384 | __be32 daddr; |
385 | u32 saddr; | 385 | __be32 saddr; |
386 | u8 tos; | 386 | u8 tos; |
387 | int err; | 387 | int err; |
388 | 388 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 20ffe8e88c0f..c41ddba02e9d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -261,6 +261,10 @@ static unsigned int rt_hash_code(u32 daddr, u32 saddr) | |||
261 | & rt_hash_mask); | 261 | & rt_hash_mask); |
262 | } | 262 | } |
263 | 263 | ||
264 | #define rt_hash(daddr, saddr, idx) \ | ||
265 | rt_hash_code((__force u32)(__be32)(daddr),\ | ||
266 | (__force u32)(__be32)(saddr) ^ ((idx) << 5)) | ||
267 | |||
264 | #ifdef CONFIG_PROC_FS | 268 | #ifdef CONFIG_PROC_FS |
265 | struct rt_cache_iter_state { | 269 | struct rt_cache_iter_state { |
266 | int bucket; | 270 | int bucket; |
@@ -1074,7 +1078,7 @@ static void ip_select_fb_ident(struct iphdr *iph) | |||
1074 | u32 salt; | 1078 | u32 salt; |
1075 | 1079 | ||
1076 | spin_lock_bh(&ip_fb_id_lock); | 1080 | spin_lock_bh(&ip_fb_id_lock); |
1077 | salt = secure_ip_id(ip_fallback_id ^ iph->daddr); | 1081 | salt = secure_ip_id((__force __be32)ip_fallback_id ^ iph->daddr); |
1078 | iph->id = htons(salt & 0xFFFF); | 1082 | iph->id = htons(salt & 0xFFFF); |
1079 | ip_fallback_id = salt; | 1083 | ip_fallback_id = salt; |
1080 | spin_unlock_bh(&ip_fb_id_lock); | 1084 | spin_unlock_bh(&ip_fb_id_lock); |
@@ -1118,13 +1122,13 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
1118 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1122 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1119 | } | 1123 | } |
1120 | 1124 | ||
1121 | void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, | 1125 | void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, |
1122 | u32 saddr, struct net_device *dev) | 1126 | __be32 saddr, struct net_device *dev) |
1123 | { | 1127 | { |
1124 | int i, k; | 1128 | int i, k; |
1125 | struct in_device *in_dev = in_dev_get(dev); | 1129 | struct in_device *in_dev = in_dev_get(dev); |
1126 | struct rtable *rth, **rthp; | 1130 | struct rtable *rth, **rthp; |
1127 | u32 skeys[2] = { saddr, 0 }; | 1131 | __be32 skeys[2] = { saddr, 0 }; |
1128 | int ikeys[2] = { dev->ifindex, 0 }; | 1132 | int ikeys[2] = { dev->ifindex, 0 }; |
1129 | struct netevent_redirect netevent; | 1133 | struct netevent_redirect netevent; |
1130 | 1134 | ||
@@ -1147,8 +1151,7 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, | |||
1147 | 1151 | ||
1148 | for (i = 0; i < 2; i++) { | 1152 | for (i = 0; i < 2; i++) { |
1149 | for (k = 0; k < 2; k++) { | 1153 | for (k = 0; k < 2; k++) { |
1150 | unsigned hash = rt_hash_code(daddr, | 1154 | unsigned hash = rt_hash(daddr, skeys[i], ikeys[k]); |
1151 | skeys[i] ^ (ikeys[k] << 5)); | ||
1152 | 1155 | ||
1153 | rthp=&rt_hash_table[hash].chain; | 1156 | rthp=&rt_hash_table[hash].chain; |
1154 | 1157 | ||
@@ -1260,9 +1263,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) | |||
1260 | ret = NULL; | 1263 | ret = NULL; |
1261 | } else if ((rt->rt_flags & RTCF_REDIRECTED) || | 1264 | } else if ((rt->rt_flags & RTCF_REDIRECTED) || |
1262 | rt->u.dst.expires) { | 1265 | rt->u.dst.expires) { |
1263 | unsigned hash = rt_hash_code(rt->fl.fl4_dst, | 1266 | unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, |
1264 | rt->fl.fl4_src ^ | 1267 | rt->fl.oif); |
1265 | (rt->fl.oif << 5)); | ||
1266 | #if RT_CACHE_DEBUG >= 1 | 1268 | #if RT_CACHE_DEBUG >= 1 |
1267 | printk(KERN_DEBUG "ip_rt_advice: redirect to " | 1269 | printk(KERN_DEBUG "ip_rt_advice: redirect to " |
1268 | "%u.%u.%u.%u/%02x dropped\n", | 1270 | "%u.%u.%u.%u/%02x dropped\n", |
@@ -1397,15 +1399,15 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) | |||
1397 | int i; | 1399 | int i; |
1398 | unsigned short old_mtu = ntohs(iph->tot_len); | 1400 | unsigned short old_mtu = ntohs(iph->tot_len); |
1399 | struct rtable *rth; | 1401 | struct rtable *rth; |
1400 | u32 skeys[2] = { iph->saddr, 0, }; | 1402 | __be32 skeys[2] = { iph->saddr, 0, }; |
1401 | u32 daddr = iph->daddr; | 1403 | __be32 daddr = iph->daddr; |
1402 | unsigned short est_mtu = 0; | 1404 | unsigned short est_mtu = 0; |
1403 | 1405 | ||
1404 | if (ipv4_config.no_pmtu_disc) | 1406 | if (ipv4_config.no_pmtu_disc) |
1405 | return 0; | 1407 | return 0; |
1406 | 1408 | ||
1407 | for (i = 0; i < 2; i++) { | 1409 | for (i = 0; i < 2; i++) { |
1408 | unsigned hash = rt_hash_code(daddr, skeys[i]); | 1410 | unsigned hash = rt_hash(daddr, skeys[i], 0); |
1409 | 1411 | ||
1410 | rcu_read_lock(); | 1412 | rcu_read_lock(); |
1411 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 1413 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
@@ -1530,7 +1532,7 @@ static int ip_rt_bug(struct sk_buff *skb) | |||
1530 | 1532 | ||
1531 | void ip_rt_get_source(u8 *addr, struct rtable *rt) | 1533 | void ip_rt_get_source(u8 *addr, struct rtable *rt) |
1532 | { | 1534 | { |
1533 | u32 src; | 1535 | __be32 src; |
1534 | struct fib_result res; | 1536 | struct fib_result res; |
1535 | 1537 | ||
1536 | if (rt->fl.iif == 0) | 1538 | if (rt->fl.iif == 0) |
@@ -1596,12 +1598,12 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1596 | rt->rt_type = res->type; | 1598 | rt->rt_type = res->type; |
1597 | } | 1599 | } |
1598 | 1600 | ||
1599 | static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr, | 1601 | static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
1600 | u8 tos, struct net_device *dev, int our) | 1602 | u8 tos, struct net_device *dev, int our) |
1601 | { | 1603 | { |
1602 | unsigned hash; | 1604 | unsigned hash; |
1603 | struct rtable *rth; | 1605 | struct rtable *rth; |
1604 | u32 spec_dst; | 1606 | __be32 spec_dst; |
1605 | struct in_device *in_dev = in_dev_get(dev); | 1607 | struct in_device *in_dev = in_dev_get(dev); |
1606 | u32 itag = 0; | 1608 | u32 itag = 0; |
1607 | 1609 | ||
@@ -1665,7 +1667,7 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1665 | RT_CACHE_STAT_INC(in_slow_mc); | 1667 | RT_CACHE_STAT_INC(in_slow_mc); |
1666 | 1668 | ||
1667 | in_dev_put(in_dev); | 1669 | in_dev_put(in_dev); |
1668 | hash = rt_hash_code(daddr, saddr ^ (dev->ifindex << 5)); | 1670 | hash = rt_hash(daddr, saddr, dev->ifindex); |
1669 | return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst); | 1671 | return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst); |
1670 | 1672 | ||
1671 | e_nobufs: | 1673 | e_nobufs: |
@@ -1681,8 +1683,8 @@ e_inval: | |||
1681 | static void ip_handle_martian_source(struct net_device *dev, | 1683 | static void ip_handle_martian_source(struct net_device *dev, |
1682 | struct in_device *in_dev, | 1684 | struct in_device *in_dev, |
1683 | struct sk_buff *skb, | 1685 | struct sk_buff *skb, |
1684 | u32 daddr, | 1686 | __be32 daddr, |
1685 | u32 saddr) | 1687 | __be32 saddr) |
1686 | { | 1688 | { |
1687 | RT_CACHE_STAT_INC(in_martian_src); | 1689 | RT_CACHE_STAT_INC(in_martian_src); |
1688 | #ifdef CONFIG_IP_ROUTE_VERBOSE | 1690 | #ifdef CONFIG_IP_ROUTE_VERBOSE |
@@ -1712,7 +1714,7 @@ static void ip_handle_martian_source(struct net_device *dev, | |||
1712 | static inline int __mkroute_input(struct sk_buff *skb, | 1714 | static inline int __mkroute_input(struct sk_buff *skb, |
1713 | struct fib_result* res, | 1715 | struct fib_result* res, |
1714 | struct in_device *in_dev, | 1716 | struct in_device *in_dev, |
1715 | u32 daddr, u32 saddr, u32 tos, | 1717 | __be32 daddr, __be32 saddr, u32 tos, |
1716 | struct rtable **result) | 1718 | struct rtable **result) |
1717 | { | 1719 | { |
1718 | 1720 | ||
@@ -1720,7 +1722,8 @@ static inline int __mkroute_input(struct sk_buff *skb, | |||
1720 | int err; | 1722 | int err; |
1721 | struct in_device *out_dev; | 1723 | struct in_device *out_dev; |
1722 | unsigned flags = 0; | 1724 | unsigned flags = 0; |
1723 | u32 spec_dst, itag; | 1725 | __be32 spec_dst; |
1726 | u32 itag; | ||
1724 | 1727 | ||
1725 | /* get a working reference to the output device */ | 1728 | /* get a working reference to the output device */ |
1726 | out_dev = in_dev_get(FIB_RES_DEV(*res)); | 1729 | out_dev = in_dev_get(FIB_RES_DEV(*res)); |
@@ -1813,7 +1816,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb, | |||
1813 | struct fib_result* res, | 1816 | struct fib_result* res, |
1814 | const struct flowi *fl, | 1817 | const struct flowi *fl, |
1815 | struct in_device *in_dev, | 1818 | struct in_device *in_dev, |
1816 | u32 daddr, u32 saddr, u32 tos) | 1819 | __be32 daddr, __be32 saddr, u32 tos) |
1817 | { | 1820 | { |
1818 | struct rtable* rth = NULL; | 1821 | struct rtable* rth = NULL; |
1819 | int err; | 1822 | int err; |
@@ -1830,7 +1833,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb, | |||
1830 | return err; | 1833 | return err; |
1831 | 1834 | ||
1832 | /* put it into the cache */ | 1835 | /* put it into the cache */ |
1833 | hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5)); | 1836 | hash = rt_hash(daddr, saddr, fl->iif); |
1834 | return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); | 1837 | return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); |
1835 | } | 1838 | } |
1836 | 1839 | ||
@@ -1838,7 +1841,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, | |||
1838 | struct fib_result* res, | 1841 | struct fib_result* res, |
1839 | const struct flowi *fl, | 1842 | const struct flowi *fl, |
1840 | struct in_device *in_dev, | 1843 | struct in_device *in_dev, |
1841 | u32 daddr, u32 saddr, u32 tos) | 1844 | __be32 daddr, __be32 saddr, u32 tos) |
1842 | { | 1845 | { |
1843 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED | 1846 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED |
1844 | struct rtable* rth = NULL, *rtres; | 1847 | struct rtable* rth = NULL, *rtres; |
@@ -1871,7 +1874,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, | |||
1871 | return err; | 1874 | return err; |
1872 | 1875 | ||
1873 | /* put it into the cache */ | 1876 | /* put it into the cache */ |
1874 | hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5)); | 1877 | hash = rt_hash(daddr, saddr, fl->iif); |
1875 | err = rt_intern_hash(hash, rth, &rtres); | 1878 | err = rt_intern_hash(hash, rth, &rtres); |
1876 | if (err) | 1879 | if (err) |
1877 | return err; | 1880 | return err; |
@@ -1901,7 +1904,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, | |||
1901 | * 2. IP spoofing attempts are filtered with 100% of guarantee. | 1904 | * 2. IP spoofing attempts are filtered with 100% of guarantee. |
1902 | */ | 1905 | */ |
1903 | 1906 | ||
1904 | static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | 1907 | static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
1905 | u8 tos, struct net_device *dev) | 1908 | u8 tos, struct net_device *dev) |
1906 | { | 1909 | { |
1907 | struct fib_result res; | 1910 | struct fib_result res; |
@@ -1920,7 +1923,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1920 | u32 itag = 0; | 1923 | u32 itag = 0; |
1921 | struct rtable * rth; | 1924 | struct rtable * rth; |
1922 | unsigned hash; | 1925 | unsigned hash; |
1923 | u32 spec_dst; | 1926 | __be32 spec_dst; |
1924 | int err = -EINVAL; | 1927 | int err = -EINVAL; |
1925 | int free_res = 0; | 1928 | int free_res = 0; |
1926 | 1929 | ||
@@ -1936,7 +1939,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1936 | if (MULTICAST(saddr) || BADCLASS(saddr) || LOOPBACK(saddr)) | 1939 | if (MULTICAST(saddr) || BADCLASS(saddr) || LOOPBACK(saddr)) |
1937 | goto martian_source; | 1940 | goto martian_source; |
1938 | 1941 | ||
1939 | if (daddr == 0xFFFFFFFF || (saddr == 0 && daddr == 0)) | 1942 | if (daddr == htonl(0xFFFFFFFF) || (saddr == 0 && daddr == 0)) |
1940 | goto brd_input; | 1943 | goto brd_input; |
1941 | 1944 | ||
1942 | /* Accept zero addresses only to limited broadcast; | 1945 | /* Accept zero addresses only to limited broadcast; |
@@ -2048,7 +2051,7 @@ local_input: | |||
2048 | rth->rt_flags &= ~RTCF_LOCAL; | 2051 | rth->rt_flags &= ~RTCF_LOCAL; |
2049 | } | 2052 | } |
2050 | rth->rt_type = res.type; | 2053 | rth->rt_type = res.type; |
2051 | hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5)); | 2054 | hash = rt_hash(daddr, saddr, fl.iif); |
2052 | err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); | 2055 | err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); |
2053 | goto done; | 2056 | goto done; |
2054 | 2057 | ||
@@ -2087,7 +2090,7 @@ martian_source: | |||
2087 | goto e_inval; | 2090 | goto e_inval; |
2088 | } | 2091 | } |
2089 | 2092 | ||
2090 | int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr, | 2093 | int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
2091 | u8 tos, struct net_device *dev) | 2094 | u8 tos, struct net_device *dev) |
2092 | { | 2095 | { |
2093 | struct rtable * rth; | 2096 | struct rtable * rth; |
@@ -2095,7 +2098,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
2095 | int iif = dev->ifindex; | 2098 | int iif = dev->ifindex; |
2096 | 2099 | ||
2097 | tos &= IPTOS_RT_MASK; | 2100 | tos &= IPTOS_RT_MASK; |
2098 | hash = rt_hash_code(daddr, saddr ^ (iif << 5)); | 2101 | hash = rt_hash(daddr, saddr, iif); |
2099 | 2102 | ||
2100 | rcu_read_lock(); | 2103 | rcu_read_lock(); |
2101 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2104 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
@@ -2169,7 +2172,7 @@ static inline int __mkroute_output(struct rtable **result, | |||
2169 | if (LOOPBACK(fl->fl4_src) && !(dev_out->flags&IFF_LOOPBACK)) | 2172 | if (LOOPBACK(fl->fl4_src) && !(dev_out->flags&IFF_LOOPBACK)) |
2170 | return -EINVAL; | 2173 | return -EINVAL; |
2171 | 2174 | ||
2172 | if (fl->fl4_dst == 0xFFFFFFFF) | 2175 | if (fl->fl4_dst == htonl(0xFFFFFFFF)) |
2173 | res->type = RTN_BROADCAST; | 2176 | res->type = RTN_BROADCAST; |
2174 | else if (MULTICAST(fl->fl4_dst)) | 2177 | else if (MULTICAST(fl->fl4_dst)) |
2175 | res->type = RTN_MULTICAST; | 2178 | res->type = RTN_MULTICAST; |
@@ -2293,8 +2296,7 @@ static inline int ip_mkroute_output_def(struct rtable **rp, | |||
2293 | int err = __mkroute_output(&rth, res, fl, oldflp, dev_out, flags); | 2296 | int err = __mkroute_output(&rth, res, fl, oldflp, dev_out, flags); |
2294 | unsigned hash; | 2297 | unsigned hash; |
2295 | if (err == 0) { | 2298 | if (err == 0) { |
2296 | hash = rt_hash_code(oldflp->fl4_dst, | 2299 | hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif); |
2297 | oldflp->fl4_src ^ (oldflp->oif << 5)); | ||
2298 | err = rt_intern_hash(hash, rth, rp); | 2300 | err = rt_intern_hash(hash, rth, rp); |
2299 | } | 2301 | } |
2300 | 2302 | ||
@@ -2336,9 +2338,8 @@ static inline int ip_mkroute_output(struct rtable** rp, | |||
2336 | if (err != 0) | 2338 | if (err != 0) |
2337 | goto cleanup; | 2339 | goto cleanup; |
2338 | 2340 | ||
2339 | hash = rt_hash_code(oldflp->fl4_dst, | 2341 | hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, |
2340 | oldflp->fl4_src ^ | 2342 | oldflp->oif); |
2341 | (oldflp->oif << 5)); | ||
2342 | err = rt_intern_hash(hash, rth, rp); | 2343 | err = rt_intern_hash(hash, rth, rp); |
2343 | 2344 | ||
2344 | /* forward hop information to multipath impl. */ | 2345 | /* forward hop information to multipath impl. */ |
@@ -2417,7 +2418,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) | |||
2417 | */ | 2418 | */ |
2418 | 2419 | ||
2419 | if (oldflp->oif == 0 | 2420 | if (oldflp->oif == 0 |
2420 | && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == 0xFFFFFFFF)) { | 2421 | && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) { |
2421 | /* Special hack: user can direct multicasts | 2422 | /* Special hack: user can direct multicasts |
2422 | and limited broadcast via necessary interface | 2423 | and limited broadcast via necessary interface |
2423 | without fiddling with IP_MULTICAST_IF or IP_PKTINFO. | 2424 | without fiddling with IP_MULTICAST_IF or IP_PKTINFO. |
@@ -2454,7 +2455,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) | |||
2454 | goto out; /* Wrong error code */ | 2455 | goto out; /* Wrong error code */ |
2455 | } | 2456 | } |
2456 | 2457 | ||
2457 | if (LOCAL_MCAST(oldflp->fl4_dst) || oldflp->fl4_dst == 0xFFFFFFFF) { | 2458 | if (LOCAL_MCAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF)) { |
2458 | if (!fl.fl4_src) | 2459 | if (!fl.fl4_src) |
2459 | fl.fl4_src = inet_select_addr(dev_out, 0, | 2460 | fl.fl4_src = inet_select_addr(dev_out, 0, |
2460 | RT_SCOPE_LINK); | 2461 | RT_SCOPE_LINK); |
@@ -2567,7 +2568,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp) | |||
2567 | unsigned hash; | 2568 | unsigned hash; |
2568 | struct rtable *rth; | 2569 | struct rtable *rth; |
2569 | 2570 | ||
2570 | hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5)); | 2571 | hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif); |
2571 | 2572 | ||
2572 | rcu_read_lock_bh(); | 2573 | rcu_read_lock_bh(); |
2573 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2574 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
@@ -2660,11 +2661,11 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2660 | if (rt->rt_flags & RTCF_NOTIFY) | 2661 | if (rt->rt_flags & RTCF_NOTIFY) |
2661 | r->rtm_flags |= RTM_F_NOTIFY; | 2662 | r->rtm_flags |= RTM_F_NOTIFY; |
2662 | 2663 | ||
2663 | NLA_PUT_U32(skb, RTA_DST, rt->rt_dst); | 2664 | NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst); |
2664 | 2665 | ||
2665 | if (rt->fl.fl4_src) { | 2666 | if (rt->fl.fl4_src) { |
2666 | r->rtm_src_len = 32; | 2667 | r->rtm_src_len = 32; |
2667 | NLA_PUT_U32(skb, RTA_SRC, rt->fl.fl4_src); | 2668 | NLA_PUT_BE32(skb, RTA_SRC, rt->fl.fl4_src); |
2668 | } | 2669 | } |
2669 | if (rt->u.dst.dev) | 2670 | if (rt->u.dst.dev) |
2670 | NLA_PUT_U32(skb, RTA_OIF, rt->u.dst.dev->ifindex); | 2671 | NLA_PUT_U32(skb, RTA_OIF, rt->u.dst.dev->ifindex); |
@@ -2677,12 +2678,12 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2677 | NLA_PUT_U32(skb, RTA_MP_ALGO, rt->rt_multipath_alg); | 2678 | NLA_PUT_U32(skb, RTA_MP_ALGO, rt->rt_multipath_alg); |
2678 | #endif | 2679 | #endif |
2679 | if (rt->fl.iif) | 2680 | if (rt->fl.iif) |
2680 | NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_spec_dst); | 2681 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst); |
2681 | else if (rt->rt_src != rt->fl.fl4_src) | 2682 | else if (rt->rt_src != rt->fl.fl4_src) |
2682 | NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_src); | 2683 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src); |
2683 | 2684 | ||
2684 | if (rt->rt_dst != rt->rt_gateway) | 2685 | if (rt->rt_dst != rt->rt_gateway) |
2685 | NLA_PUT_U32(skb, RTA_GATEWAY, rt->rt_gateway); | 2686 | NLA_PUT_BE32(skb, RTA_GATEWAY, rt->rt_gateway); |
2686 | 2687 | ||
2687 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) | 2688 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) |
2688 | goto nla_put_failure; | 2689 | goto nla_put_failure; |
@@ -2706,7 +2707,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2706 | 2707 | ||
2707 | if (rt->fl.iif) { | 2708 | if (rt->fl.iif) { |
2708 | #ifdef CONFIG_IP_MROUTE | 2709 | #ifdef CONFIG_IP_MROUTE |
2709 | u32 dst = rt->rt_dst; | 2710 | __be32 dst = rt->rt_dst; |
2710 | 2711 | ||
2711 | if (MULTICAST(dst) && !LOCAL_MCAST(dst) && | 2712 | if (MULTICAST(dst) && !LOCAL_MCAST(dst) && |
2712 | ipv4_devconf.mc_forwarding) { | 2713 | ipv4_devconf.mc_forwarding) { |
@@ -2740,7 +2741,9 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
2740 | struct rtmsg *rtm; | 2741 | struct rtmsg *rtm; |
2741 | struct nlattr *tb[RTA_MAX+1]; | 2742 | struct nlattr *tb[RTA_MAX+1]; |
2742 | struct rtable *rt = NULL; | 2743 | struct rtable *rt = NULL; |
2743 | u32 dst, src, iif; | 2744 | __be32 dst = 0; |
2745 | __be32 src = 0; | ||
2746 | u32 iif; | ||
2744 | int err; | 2747 | int err; |
2745 | struct sk_buff *skb; | 2748 | struct sk_buff *skb; |
2746 | 2749 | ||
@@ -2765,8 +2768,8 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
2765 | skb->nh.iph->protocol = IPPROTO_ICMP; | 2768 | skb->nh.iph->protocol = IPPROTO_ICMP; |
2766 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); | 2769 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); |
2767 | 2770 | ||
2768 | src = tb[RTA_SRC] ? nla_get_u32(tb[RTA_SRC]) : 0; | 2771 | src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0; |
2769 | dst = tb[RTA_DST] ? nla_get_u32(tb[RTA_DST]) : 0; | 2772 | dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0; |
2770 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; | 2773 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; |
2771 | 2774 | ||
2772 | if (iif) { | 2775 | if (iif) { |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index b3def0df14fb..3f884cea14ff 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -935,7 +935,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
935 | const struct inet_connection_sock *icsk = inet_csk(sk); | 935 | const struct inet_connection_sock *icsk = inet_csk(sk); |
936 | struct tcp_sock *tp = tcp_sk(sk); | 936 | struct tcp_sock *tp = tcp_sk(sk); |
937 | unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked; | 937 | unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked; |
938 | struct tcp_sack_block *sp = (struct tcp_sack_block *)(ptr+2); | 938 | struct tcp_sack_block_wire *sp = (struct tcp_sack_block_wire *)(ptr+2); |
939 | int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; | 939 | int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; |
940 | int reord = tp->packets_out; | 940 | int reord = tp->packets_out; |
941 | int prior_fackets; | 941 | int prior_fackets; |
@@ -2239,13 +2239,12 @@ static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, | |||
2239 | return acked; | 2239 | return acked; |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | static u32 tcp_usrtt(const struct sk_buff *skb) | 2242 | static u32 tcp_usrtt(struct timeval *tv) |
2243 | { | 2243 | { |
2244 | struct timeval tv, now; | 2244 | struct timeval now; |
2245 | 2245 | ||
2246 | do_gettimeofday(&now); | 2246 | do_gettimeofday(&now); |
2247 | skb_get_timestamp(skb, &tv); | 2247 | return (now.tv_sec - tv->tv_sec) * 1000000 + (now.tv_usec - tv->tv_usec); |
2248 | return (now.tv_sec - tv.tv_sec) * 1000000 + (now.tv_usec - tv.tv_usec); | ||
2249 | } | 2248 | } |
2250 | 2249 | ||
2251 | /* Remove acknowledged frames from the retransmission queue. */ | 2250 | /* Remove acknowledged frames from the retransmission queue. */ |
@@ -2260,6 +2259,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2260 | u32 pkts_acked = 0; | 2259 | u32 pkts_acked = 0; |
2261 | void (*rtt_sample)(struct sock *sk, u32 usrtt) | 2260 | void (*rtt_sample)(struct sock *sk, u32 usrtt) |
2262 | = icsk->icsk_ca_ops->rtt_sample; | 2261 | = icsk->icsk_ca_ops->rtt_sample; |
2262 | struct timeval tv; | ||
2263 | 2263 | ||
2264 | while ((skb = skb_peek(&sk->sk_write_queue)) && | 2264 | while ((skb = skb_peek(&sk->sk_write_queue)) && |
2265 | skb != sk->sk_send_head) { | 2265 | skb != sk->sk_send_head) { |
@@ -2308,8 +2308,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2308 | seq_rtt = -1; | 2308 | seq_rtt = -1; |
2309 | } else if (seq_rtt < 0) { | 2309 | } else if (seq_rtt < 0) { |
2310 | seq_rtt = now - scb->when; | 2310 | seq_rtt = now - scb->when; |
2311 | if (rtt_sample) | 2311 | skb_get_timestamp(skb, &tv); |
2312 | (*rtt_sample)(sk, tcp_usrtt(skb)); | ||
2313 | } | 2312 | } |
2314 | if (sacked & TCPCB_SACKED_ACKED) | 2313 | if (sacked & TCPCB_SACKED_ACKED) |
2315 | tp->sacked_out -= tcp_skb_pcount(skb); | 2314 | tp->sacked_out -= tcp_skb_pcount(skb); |
@@ -2322,8 +2321,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2322 | } | 2321 | } |
2323 | } else if (seq_rtt < 0) { | 2322 | } else if (seq_rtt < 0) { |
2324 | seq_rtt = now - scb->when; | 2323 | seq_rtt = now - scb->when; |
2325 | if (rtt_sample) | 2324 | skb_get_timestamp(skb, &tv); |
2326 | (*rtt_sample)(sk, tcp_usrtt(skb)); | ||
2327 | } | 2325 | } |
2328 | tcp_dec_pcount_approx(&tp->fackets_out, skb); | 2326 | tcp_dec_pcount_approx(&tp->fackets_out, skb); |
2329 | tcp_packets_out_dec(tp, skb); | 2327 | tcp_packets_out_dec(tp, skb); |
@@ -2335,6 +2333,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2335 | if (acked&FLAG_ACKED) { | 2333 | if (acked&FLAG_ACKED) { |
2336 | tcp_ack_update_rtt(sk, acked, seq_rtt); | 2334 | tcp_ack_update_rtt(sk, acked, seq_rtt); |
2337 | tcp_ack_packets_out(sk, tp); | 2335 | tcp_ack_packets_out(sk, tp); |
2336 | if (rtt_sample && !(acked & FLAG_RETRANS_DATA_ACKED)) | ||
2337 | (*rtt_sample)(sk, tcp_usrtt(&tv)); | ||
2338 | 2338 | ||
2339 | if (icsk->icsk_ca_ops->pkts_acked) | 2339 | if (icsk->icsk_ca_ops->pkts_acked) |
2340 | icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked); | 2340 | icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked); |
@@ -2629,7 +2629,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
2629 | switch(opcode) { | 2629 | switch(opcode) { |
2630 | case TCPOPT_MSS: | 2630 | case TCPOPT_MSS: |
2631 | if(opsize==TCPOLEN_MSS && th->syn && !estab) { | 2631 | if(opsize==TCPOLEN_MSS && th->syn && !estab) { |
2632 | u16 in_mss = ntohs(get_unaligned((__u16 *)ptr)); | 2632 | u16 in_mss = ntohs(get_unaligned((__be16 *)ptr)); |
2633 | if (in_mss) { | 2633 | if (in_mss) { |
2634 | if (opt_rx->user_mss && opt_rx->user_mss < in_mss) | 2634 | if (opt_rx->user_mss && opt_rx->user_mss < in_mss) |
2635 | in_mss = opt_rx->user_mss; | 2635 | in_mss = opt_rx->user_mss; |
@@ -2657,8 +2657,8 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
2657 | if ((estab && opt_rx->tstamp_ok) || | 2657 | if ((estab && opt_rx->tstamp_ok) || |
2658 | (!estab && sysctl_tcp_timestamps)) { | 2658 | (!estab && sysctl_tcp_timestamps)) { |
2659 | opt_rx->saw_tstamp = 1; | 2659 | opt_rx->saw_tstamp = 1; |
2660 | opt_rx->rcv_tsval = ntohl(get_unaligned((__u32 *)ptr)); | 2660 | opt_rx->rcv_tsval = ntohl(get_unaligned((__be32 *)ptr)); |
2661 | opt_rx->rcv_tsecr = ntohl(get_unaligned((__u32 *)(ptr+4))); | 2661 | opt_rx->rcv_tsecr = ntohl(get_unaligned((__be32 *)(ptr+4))); |
2662 | } | 2662 | } |
2663 | } | 2663 | } |
2664 | break; | 2664 | break; |
@@ -2695,8 +2695,8 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, | |||
2695 | return 0; | 2695 | return 0; |
2696 | } else if (tp->rx_opt.tstamp_ok && | 2696 | } else if (tp->rx_opt.tstamp_ok && |
2697 | th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) { | 2697 | th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) { |
2698 | __u32 *ptr = (__u32 *)(th + 1); | 2698 | __be32 *ptr = (__be32 *)(th + 1); |
2699 | if (*ptr == ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 2699 | if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
2700 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { | 2700 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { |
2701 | tp->rx_opt.saw_tstamp = 1; | 2701 | tp->rx_opt.saw_tstamp = 1; |
2702 | ++ptr; | 2702 | ++ptr; |
@@ -3911,10 +3911,10 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
3911 | 3911 | ||
3912 | /* Check timestamp */ | 3912 | /* Check timestamp */ |
3913 | if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) { | 3913 | if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) { |
3914 | __u32 *ptr = (__u32 *)(th + 1); | 3914 | __be32 *ptr = (__be32 *)(th + 1); |
3915 | 3915 | ||
3916 | /* No? Slow path! */ | 3916 | /* No? Slow path! */ |
3917 | if (*ptr != ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 3917 | if (*ptr != htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
3918 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) | 3918 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) |
3919 | goto slow_path; | 3919 | goto slow_path; |
3920 | 3920 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 39b179856082..c83938b8fcb1 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -159,7 +159,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
159 | struct tcp_sock *tp = tcp_sk(sk); | 159 | struct tcp_sock *tp = tcp_sk(sk); |
160 | struct sockaddr_in *usin = (struct sockaddr_in *)uaddr; | 160 | struct sockaddr_in *usin = (struct sockaddr_in *)uaddr; |
161 | struct rtable *rt; | 161 | struct rtable *rt; |
162 | u32 daddr, nexthop; | 162 | __be32 daddr, nexthop; |
163 | int tmp; | 163 | int tmp; |
164 | int err; | 164 | int err; |
165 | 165 | ||
@@ -734,8 +734,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
734 | struct inet_request_sock *ireq; | 734 | struct inet_request_sock *ireq; |
735 | struct tcp_options_received tmp_opt; | 735 | struct tcp_options_received tmp_opt; |
736 | struct request_sock *req; | 736 | struct request_sock *req; |
737 | __u32 saddr = skb->nh.iph->saddr; | 737 | __be32 saddr = skb->nh.iph->saddr; |
738 | __u32 daddr = skb->nh.iph->daddr; | 738 | __be32 daddr = skb->nh.iph->daddr; |
739 | __u32 isn = TCP_SKB_CB(skb)->when; | 739 | __u32 isn = TCP_SKB_CB(skb)->when; |
740 | struct dst_entry *dst = NULL; | 740 | struct dst_entry *dst = NULL; |
741 | #ifdef CONFIG_SYN_COOKIES | 741 | #ifdef CONFIG_SYN_COOKIES |
@@ -1763,7 +1763,7 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i) | |||
1763 | 1763 | ||
1764 | static void get_timewait4_sock(struct inet_timewait_sock *tw, char *tmpbuf, int i) | 1764 | static void get_timewait4_sock(struct inet_timewait_sock *tw, char *tmpbuf, int i) |
1765 | { | 1765 | { |
1766 | unsigned int dest, src; | 1766 | __be32 dest, src; |
1767 | __u16 destp, srcp; | 1767 | __u16 destp, srcp; |
1768 | int ttd = tw->tw_ttd - jiffies; | 1768 | int ttd = tw->tw_ttd - jiffies; |
1769 | 1769 | ||
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c index 308fb7e071c5..f0ebaf0e21cb 100644 --- a/net/ipv4/tcp_lp.c +++ b/net/ipv4/tcp_lp.c | |||
@@ -31,8 +31,6 @@ | |||
31 | * Hung Hing Lun, Mike <hlhung3i@gmail.com> | 31 | * Hung Hing Lun, Mike <hlhung3i@gmail.com> |
32 | * SourceForge project page: | 32 | * SourceForge project page: |
33 | * http://tcp-lp-mod.sourceforge.net/ | 33 | * http://tcp-lp-mod.sourceforge.net/ |
34 | * | ||
35 | * Version: $Id: tcp_lp.c,v 1.24 2006/09/05 20:22:53 hswong3i Exp $ | ||
36 | */ | 34 | */ |
37 | 35 | ||
38 | #include <linux/module.h> | 36 | #include <linux/module.h> |
@@ -164,7 +162,7 @@ static u32 tcp_lp_remote_hz_estimator(struct sock *sk) | |||
164 | 162 | ||
165 | out: | 163 | out: |
166 | /* record time for successful remote HZ calc */ | 164 | /* record time for successful remote HZ calc */ |
167 | if (rhz > 0) | 165 | if ((rhz >> 6) > 0) |
168 | lp->flag |= LP_VALID_RHZ; | 166 | lp->flag |= LP_VALID_RHZ; |
169 | else | 167 | else |
170 | lp->flag &= ~LP_VALID_RHZ; | 168 | lp->flag &= ~LP_VALID_RHZ; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 061edfae0c29..9a253faefc81 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -269,7 +269,7 @@ static u16 tcp_select_window(struct sock *sk) | |||
269 | return new_win; | 269 | return new_win; |
270 | } | 270 | } |
271 | 271 | ||
272 | static void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, | 272 | static void tcp_build_and_update_options(__be32 *ptr, struct tcp_sock *tp, |
273 | __u32 tstamp) | 273 | __u32 tstamp) |
274 | { | 274 | { |
275 | if (tp->rx_opt.tstamp_ok) { | 275 | if (tp->rx_opt.tstamp_ok) { |
@@ -305,7 +305,7 @@ static void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, | |||
305 | * MAX_SYN_SIZE to match the new maximum number of options that you | 305 | * MAX_SYN_SIZE to match the new maximum number of options that you |
306 | * can generate. | 306 | * can generate. |
307 | */ | 307 | */ |
308 | static void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack, | 308 | static void tcp_syn_build_options(__be32 *ptr, int mss, int ts, int sack, |
309 | int offer_wscale, int wscale, __u32 tstamp, | 309 | int offer_wscale, int wscale, __u32 tstamp, |
310 | __u32 ts_recent) | 310 | __u32 ts_recent) |
311 | { | 311 | { |
@@ -424,7 +424,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
424 | th->dest = inet->dport; | 424 | th->dest = inet->dport; |
425 | th->seq = htonl(tcb->seq); | 425 | th->seq = htonl(tcb->seq); |
426 | th->ack_seq = htonl(tp->rcv_nxt); | 426 | th->ack_seq = htonl(tp->rcv_nxt); |
427 | *(((__u16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | | 427 | *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | |
428 | tcb->flags); | 428 | tcb->flags); |
429 | 429 | ||
430 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { | 430 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { |
@@ -445,7 +445,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
445 | } | 445 | } |
446 | 446 | ||
447 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { | 447 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { |
448 | tcp_syn_build_options((__u32 *)(th + 1), | 448 | tcp_syn_build_options((__be32 *)(th + 1), |
449 | tcp_advertise_mss(sk), | 449 | tcp_advertise_mss(sk), |
450 | (sysctl_flags & SYSCTL_FLAG_TSTAMPS), | 450 | (sysctl_flags & SYSCTL_FLAG_TSTAMPS), |
451 | (sysctl_flags & SYSCTL_FLAG_SACK), | 451 | (sysctl_flags & SYSCTL_FLAG_SACK), |
@@ -454,7 +454,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
454 | tcb->when, | 454 | tcb->when, |
455 | tp->rx_opt.ts_recent); | 455 | tp->rx_opt.ts_recent); |
456 | } else { | 456 | } else { |
457 | tcp_build_and_update_options((__u32 *)(th + 1), | 457 | tcp_build_and_update_options((__be32 *)(th + 1), |
458 | tp, tcb->when); | 458 | tp, tcb->when); |
459 | TCP_ECN_send(sk, tp, skb, tcp_header_size); | 459 | TCP_ECN_send(sk, tp, skb, tcp_header_size); |
460 | } | 460 | } |
@@ -2070,7 +2070,7 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2070 | th->window = htons(req->rcv_wnd); | 2070 | th->window = htons(req->rcv_wnd); |
2071 | 2071 | ||
2072 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 2072 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
2073 | tcp_syn_build_options((__u32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok, | 2073 | tcp_syn_build_options((__be32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok, |
2074 | ireq->sack_ok, ireq->wscale_ok, ireq->rcv_wscale, | 2074 | ireq->sack_ok, ireq->wscale_ok, ireq->rcv_wscale, |
2075 | TCP_SKB_CB(skb)->when, | 2075 | TCP_SKB_CB(skb)->when, |
2076 | req->ts_recent); | 2076 | req->ts_recent); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 77e265d7bb8f..6d6142f9c478 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -243,8 +243,8 @@ static void udp_v4_unhash(struct sock *sk) | |||
243 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try | 243 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try |
244 | * harder than this. -DaveM | 244 | * harder than this. -DaveM |
245 | */ | 245 | */ |
246 | static struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport, | 246 | static struct sock *udp_v4_lookup_longway(__be32 saddr, __be16 sport, |
247 | u32 daddr, u16 dport, int dif) | 247 | __be32 daddr, __be16 dport, int dif) |
248 | { | 248 | { |
249 | struct sock *sk, *result = NULL; | 249 | struct sock *sk, *result = NULL; |
250 | struct hlist_node *node; | 250 | struct hlist_node *node; |
@@ -288,8 +288,8 @@ static struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport, | |||
288 | return result; | 288 | return result; |
289 | } | 289 | } |
290 | 290 | ||
291 | static __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, | 291 | static __inline__ struct sock *udp_v4_lookup(__be32 saddr, __be16 sport, |
292 | u32 daddr, u16 dport, int dif) | 292 | __be32 daddr, __be16 dport, int dif) |
293 | { | 293 | { |
294 | struct sock *sk; | 294 | struct sock *sk; |
295 | 295 | ||
@@ -302,8 +302,8 @@ static __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, | |||
302 | } | 302 | } |
303 | 303 | ||
304 | static inline struct sock *udp_v4_mcast_next(struct sock *sk, | 304 | static inline struct sock *udp_v4_mcast_next(struct sock *sk, |
305 | u16 loc_port, u32 loc_addr, | 305 | __be16 loc_port, __be32 loc_addr, |
306 | u16 rmt_port, u32 rmt_addr, | 306 | __be16 rmt_port, __be32 rmt_addr, |
307 | int dif) | 307 | int dif) |
308 | { | 308 | { |
309 | struct hlist_node *node; | 309 | struct hlist_node *node; |
@@ -498,7 +498,7 @@ out: | |||
498 | } | 498 | } |
499 | 499 | ||
500 | 500 | ||
501 | static unsigned short udp_check(struct udphdr *uh, int len, unsigned long saddr, unsigned long daddr, unsigned long base) | 501 | static unsigned short udp_check(struct udphdr *uh, int len, __be32 saddr, __be32 daddr, unsigned long base) |
502 | { | 502 | { |
503 | return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base)); | 503 | return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base)); |
504 | } | 504 | } |
@@ -513,8 +513,8 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
513 | struct rtable *rt = NULL; | 513 | struct rtable *rt = NULL; |
514 | int free = 0; | 514 | int free = 0; |
515 | int connected = 0; | 515 | int connected = 0; |
516 | u32 daddr, faddr, saddr; | 516 | __be32 daddr, faddr, saddr; |
517 | u16 dport; | 517 | __be16 dport; |
518 | u8 tos; | 518 | u8 tos; |
519 | int err; | 519 | int err; |
520 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; | 520 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; |
@@ -931,7 +931,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) | |||
931 | int iphlen, len; | 931 | int iphlen, len; |
932 | 932 | ||
933 | __u8 *udpdata = (__u8 *)uh + sizeof(struct udphdr); | 933 | __u8 *udpdata = (__u8 *)uh + sizeof(struct udphdr); |
934 | __u32 *udpdata32 = (__u32 *)udpdata; | 934 | __be32 *udpdata32 = (__be32 *)udpdata; |
935 | __u16 encap_type = up->encap_type; | 935 | __u16 encap_type = up->encap_type; |
936 | 936 | ||
937 | /* if we're overly short, let UDP handle it */ | 937 | /* if we're overly short, let UDP handle it */ |
@@ -1080,7 +1080,7 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
1080 | * so we don't need to lock the hashes. | 1080 | * so we don't need to lock the hashes. |
1081 | */ | 1081 | */ |
1082 | static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh, | 1082 | static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh, |
1083 | u32 saddr, u32 daddr) | 1083 | __be32 saddr, __be32 daddr) |
1084 | { | 1084 | { |
1085 | struct sock *sk; | 1085 | struct sock *sk; |
1086 | int dif; | 1086 | int dif; |
@@ -1121,7 +1121,7 @@ static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh, | |||
1121 | * including udp header and folding it to skb->csum. | 1121 | * including udp header and folding it to skb->csum. |
1122 | */ | 1122 | */ |
1123 | static void udp_checksum_init(struct sk_buff *skb, struct udphdr *uh, | 1123 | static void udp_checksum_init(struct sk_buff *skb, struct udphdr *uh, |
1124 | unsigned short ulen, u32 saddr, u32 daddr) | 1124 | unsigned short ulen, __be32 saddr, __be32 daddr) |
1125 | { | 1125 | { |
1126 | if (uh->check == 0) { | 1126 | if (uh->check == 0) { |
1127 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1127 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1146,8 +1146,8 @@ int udp_rcv(struct sk_buff *skb) | |||
1146 | struct udphdr *uh; | 1146 | struct udphdr *uh; |
1147 | unsigned short ulen; | 1147 | unsigned short ulen; |
1148 | struct rtable *rt = (struct rtable*)skb->dst; | 1148 | struct rtable *rt = (struct rtable*)skb->dst; |
1149 | u32 saddr = skb->nh.iph->saddr; | 1149 | __be32 saddr = skb->nh.iph->saddr; |
1150 | u32 daddr = skb->nh.iph->daddr; | 1150 | __be32 daddr = skb->nh.iph->daddr; |
1151 | int len = skb->len; | 1151 | int len = skb->len; |
1152 | 1152 | ||
1153 | /* | 1153 | /* |
@@ -1563,8 +1563,8 @@ void udp_proc_unregister(struct udp_seq_afinfo *afinfo) | |||
1563 | static void udp4_format_sock(struct sock *sp, char *tmpbuf, int bucket) | 1563 | static void udp4_format_sock(struct sock *sp, char *tmpbuf, int bucket) |
1564 | { | 1564 | { |
1565 | struct inet_sock *inet = inet_sk(sp); | 1565 | struct inet_sock *inet = inet_sk(sp); |
1566 | unsigned int dest = inet->daddr; | 1566 | __be32 dest = inet->daddr; |
1567 | unsigned int src = inet->rcv_saddr; | 1567 | __be32 src = inet->rcv_saddr; |
1568 | __u16 destp = ntohs(inet->dport); | 1568 | __u16 destp = ntohs(inet->dport); |
1569 | __u16 srcp = ntohs(inet->sport); | 1569 | __u16 srcp = ntohs(inet->sport); |
1570 | 1570 | ||
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 040e8475f295..8655d038364c 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -23,7 +23,7 @@ int xfrm4_rcv(struct sk_buff *skb) | |||
23 | 23 | ||
24 | EXPORT_SYMBOL(xfrm4_rcv); | 24 | EXPORT_SYMBOL(xfrm4_rcv); |
25 | 25 | ||
26 | static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq) | 26 | static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq) |
27 | { | 27 | { |
28 | switch (nexthdr) { | 28 | switch (nexthdr) { |
29 | case IPPROTO_IPIP: | 29 | case IPPROTO_IPIP: |
@@ -55,7 +55,7 @@ drop: | |||
55 | int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | 55 | int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) |
56 | { | 56 | { |
57 | int err; | 57 | int err; |
58 | u32 spi, seq; | 58 | __be32 spi, seq; |
59 | struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; | 59 | struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; |
60 | struct xfrm_state *x; | 60 | struct xfrm_state *x; |
61 | int xfrm_nr = 0; | 61 | int xfrm_nr = 0; |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index eabcd27b1767..7a7a00147e55 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -221,7 +221,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
221 | 221 | ||
222 | case IPPROTO_ESP: | 222 | case IPPROTO_ESP: |
223 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 223 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { |
224 | u32 *ehdr = (u32 *)xprth; | 224 | __be32 *ehdr = (__be32 *)xprth; |
225 | 225 | ||
226 | fl->fl_ipsec_spi = ehdr[0]; | 226 | fl->fl_ipsec_spi = ehdr[0]; |
227 | } | 227 | } |
@@ -229,7 +229,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
229 | 229 | ||
230 | case IPPROTO_AH: | 230 | case IPPROTO_AH: |
231 | if (pskb_may_pull(skb, xprth + 8 - skb->data)) { | 231 | if (pskb_may_pull(skb, xprth + 8 - skb->data)) { |
232 | u32 *ah_hdr = (u32*)xprth; | 232 | __be32 *ah_hdr = (__be32*)xprth; |
233 | 233 | ||
234 | fl->fl_ipsec_spi = ah_hdr[1]; | 234 | fl->fl_ipsec_spi = ah_hdr[1]; |
235 | } | 235 | } |
@@ -237,7 +237,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
237 | 237 | ||
238 | case IPPROTO_COMP: | 238 | case IPPROTO_COMP: |
239 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 239 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { |
240 | u16 *ipcomp_hdr = (u16 *)xprth; | 240 | __be16 *ipcomp_hdr = (__be16 *)xprth; |
241 | 241 | ||
242 | fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); | 242 | fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); |
243 | } | 243 | } |
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c index fe2034494d08..3cc3df0c6ece 100644 --- a/net/ipv4/xfrm4_state.c +++ b/net/ipv4/xfrm4_state.c | |||
@@ -29,9 +29,9 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl, | |||
29 | x->sel.daddr.a4 = fl->fl4_dst; | 29 | x->sel.daddr.a4 = fl->fl4_dst; |
30 | x->sel.saddr.a4 = fl->fl4_src; | 30 | x->sel.saddr.a4 = fl->fl4_src; |
31 | x->sel.dport = xfrm_flowi_dport(fl); | 31 | x->sel.dport = xfrm_flowi_dport(fl); |
32 | x->sel.dport_mask = ~0; | 32 | x->sel.dport_mask = htons(0xffff); |
33 | x->sel.sport = xfrm_flowi_sport(fl); | 33 | x->sel.sport = xfrm_flowi_sport(fl); |
34 | x->sel.sport_mask = ~0; | 34 | x->sel.sport_mask = htons(0xffff); |
35 | x->sel.prefixlen_d = 32; | 35 | x->sel.prefixlen_d = 32; |
36 | x->sel.prefixlen_s = 32; | 36 | x->sel.prefixlen_s = 32; |
37 | x->sel.proto = fl->proto; | 37 | x->sel.proto = fl->proto; |