aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-09-28 17:29:52 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-28 21:03:04 -0400
commit014d730d56b559eacb11e91969a1f41c3feb36f9 (patch)
treed8c3a08108f435879b4d436c7b3c4a726d31c6af /net
parentd4263cde88d3fee2af0aac8836bb785cdb6b06c0 (diff)
[IPVS]: ipvs annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c24
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c14
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c26
-rw-r--r--net/ipv4/ipvs/ip_vs_dh.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_ftp.c12
-rw-r--r--net/ipv4/ipvs/ip_vs_lblc.c8
-rw-r--r--net/ipv4/ipvs/ip_vs_lblcr.c8
-rw-r--r--net/ipv4/ipvs/ip_vs_proto.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_tcp.c10
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_udp.c14
-rw-r--r--net/ipv4/ipvs/ip_vs_sh.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_sync.c16
-rw-r--r--net/ipv4/ipvs/ip_vs_xmit.c2
13 files changed, 72 insertions, 72 deletions
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 */
118static unsigned int ip_vs_conn_hashkey(unsigned proto, __u32 addr, __u16 port) 118static 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 */
190static inline struct ip_vs_conn *__ip_vs_conn_in_get 190static 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
217struct ip_vs_conn *ip_vs_conn_in_get 217struct 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 */
236struct ip_vs_conn *ip_vs_ct_in_get 236struct 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 */
276struct ip_vs_conn *ip_vs_conn_out_get 276struct 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 */
327void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport) 327void 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 */
598struct ip_vs_conn * 598struct ip_vs_conn *
599ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport, 599ip_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)
209static struct ip_vs_conn * 209static struct ip_vs_conn *
210ip_vs_sched_persist(struct ip_vs_service *svc, 210ip_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)
446int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 446int 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 */
285static __inline__ unsigned 285static __inline__ unsigned
286ip_vs_svc_hashkey(unsigned proto, __u32 addr, __u16 port) 286ip_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 */
367static __inline__ struct ip_vs_service * 367static __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
412struct ip_vs_service * 412struct ip_vs_service *
413ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport) 413ip_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 */
483static __inline__ unsigned ip_vs_rs_hashkey(__u32 addr, __u16 port) 483static __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 */
533struct ip_vs_dest * 533struct ip_vs_dest *
534ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport) 534ip_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 */
564static struct ip_vs_dest * 564static struct ip_vs_dest *
565ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) 565ip_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 */
593static struct ip_vs_dest * 593static struct ip_vs_dest *
594ip_vs_trash_get_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) 594ip_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
773ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) 773ip_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
879ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) 879ip_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
991ip_vs_del_dest(struct ip_vs_service *svc,struct ip_vs_dest_user *udest) 991ip_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 */
69static inline unsigned ip_vs_dh_hashkey(__u32 addr) 69static 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 */
78static inline struct ip_vs_dest * 78static inline struct ip_vs_dest *
79ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __u32 addr) 79ip_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 62505d8f9ff6..b3bbb4a07ae0 100644
--- a/net/ipv4/ipvs/ip_vs_ftp.c
+++ b/net/ipv4/ipvs/ip_vs_ftp.c
@@ -74,7 +74,7 @@ ip_vs_ftp_done_conn(struct ip_vs_app *app, struct ip_vs_conn *cp)
74 */ 74 */
75static int ip_vs_ftp_get_addrport(char *data, char *data_limit, 75static int ip_vs_ftp_get_addrport(char *data, char *data_limit,
76 const char *pattern, size_t plen, char term, 76 const char *pattern, size_t plen, char term,
77 __u32 *addr, __u16 *port, 77 __be32 *addr, __be16 *port,
78 char **start, char **end) 78 char **start, char **end)
79{ 79{
80 unsigned char p[6]; 80 unsigned char p[6];
@@ -140,8 +140,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
140 struct tcphdr *th; 140 struct tcphdr *th;
141 char *data, *data_limit; 141 char *data, *data_limit;
142 char *start, *end; 142 char *start, *end;
143 __u32 from; 143 __be32 from;
144 __u16 port; 144 __be16 port;
145 struct ip_vs_conn *n_cp; 145 struct ip_vs_conn *n_cp;
146 char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */ 146 char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */
147 unsigned buf_len; 147 unsigned buf_len;
@@ -199,7 +199,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
199 from = n_cp->vaddr; 199 from = n_cp->vaddr;
200 port = n_cp->vport; 200 port = n_cp->vport;
201 sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from), 201 sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from),
202 port&255, (port>>8)&255); 202 ntohs(port)&255, (ntohs(port)>>8)&255);
203 buf_len = strlen(buf); 203 buf_len = strlen(buf);
204 204
205 /* 205 /*
@@ -243,8 +243,8 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
243 struct tcphdr *th; 243 struct tcphdr *th;
244 char *data, *data_start, *data_limit; 244 char *data, *data_start, *data_limit;
245 char *start, *end; 245 char *start, *end;
246 __u32 to; 246 __be32 to;
247 __u16 port; 247 __be16 port;
248 struct ip_vs_conn *n_cp; 248 struct ip_vs_conn *n_cp;
249 249
250 /* no diff required for incoming packets */ 250 /* no diff required for incoming packets */
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 */
88struct ip_vs_lblc_entry { 88struct 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 */
162static inline struct ip_vs_lblc_entry * 162static inline struct ip_vs_lblc_entry *
163ip_vs_lblc_new(__u32 daddr, struct ip_vs_dest *dest) 163ip_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 */
198static inline unsigned ip_vs_lblc_hashkey(__u32 addr) 198static 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 */
236static inline struct ip_vs_lblc_entry * 236static inline struct ip_vs_lblc_entry *
237ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __u32 addr) 237ip_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 */
277struct ip_vs_lblcr_entry { 277struct 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 */
351static inline struct ip_vs_lblcr_entry *ip_vs_lblcr_new(__u32 daddr) 351static 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 */
384static inline unsigned ip_vs_lblcr_hashkey(__u32 addr) 384static 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 */
422static inline struct ip_vs_lblcr_entry * 422static inline struct ip_vs_lblcr_entry *
423ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __u32 addr) 423ip_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 *
29tcp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, 29tcp_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 *
50tcp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, 50tcp_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
114static inline void 114static inline void
115tcp_fast_csum_update(struct tcphdr *tcph, u32 oldip, u32 newip, 115tcp_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
119static inline void 119static inline void
120udp_fast_csum_update(struct udphdr *uhdr, u32 oldip, u32 newip, 120udp_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
131static int 131static 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 */
66static inline unsigned ip_vs_sh_hashkey(__u32 addr) 66static 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 */
75static inline struct ip_vs_dest * 75static inline struct ip_vs_dest *
76ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __u32 addr) 76ip_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 0c8d20da6139..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};
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;