aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-14 23:51:49 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:22:50 -0500
commit714e85be3557222bc25f69c252326207c900a7db (patch)
treecb59a6d0a94245dc8575507386af1be31dd7fad9 /net/ipv4
parent252e33467a3b016f20dd8df12269cef3b167f21e (diff)
[IPV6]: Assorted trivial endianness annotations.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/af_inet.c6
-rw-r--r--net/ipv4/arp.c2
-rw-r--r--net/ipv4/cipso_ipv4.c8
-rw-r--r--net/ipv4/devinet.c10
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/syncookies.c18
-rw-r--r--net/ipv4/tcp_ipv4.c10
-rw-r--r--net/ipv4/tcp_minisocks.c2
-rw-r--r--net/ipv4/tcp_timer.c2
12 files changed, 35 insertions, 35 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 8db39f7e3bf0..1144900d37f6 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -644,7 +644,7 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
644 sin->sin_port = inet->dport; 644 sin->sin_port = inet->dport;
645 sin->sin_addr.s_addr = inet->daddr; 645 sin->sin_addr.s_addr = inet->daddr;
646 } else { 646 } else {
647 __u32 addr = inet->rcv_saddr; 647 __be32 addr = inet->rcv_saddr;
648 if (!addr) 648 if (!addr)
649 addr = inet->saddr; 649 addr = inet->saddr;
650 sin->sin_port = inet->sport; 650 sin->sin_port = inet->sport;
@@ -995,8 +995,8 @@ static int inet_sk_reselect_saddr(struct sock *sk)
995 struct inet_sock *inet = inet_sk(sk); 995 struct inet_sock *inet = inet_sk(sk);
996 int err; 996 int err;
997 struct rtable *rt; 997 struct rtable *rt;
998 __u32 old_saddr = inet->saddr; 998 __be32 old_saddr = inet->saddr;
999 __u32 new_saddr; 999 __be32 new_saddr;
1000 __be32 daddr = inet->daddr; 1000 __be32 daddr = inet->daddr;
1001 1001
1002 if (inet->opt && inet->opt->srr) 1002 if (inet->opt && inet->opt->srr)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index cfb5d3de9c84..3981e8be9ab8 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -203,7 +203,7 @@ struct neigh_table arp_tbl = {
203 .gc_thresh3 = 1024, 203 .gc_thresh3 = 1024,
204}; 204};
205 205
206int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir) 206int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir)
207{ 207{
208 switch (dev->type) { 208 switch (dev->type) {
209 case ARPHRD_ETHER: 209 case ARPHRD_ETHER:
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 6460233407c7..c3a61ebbadef 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -966,7 +966,7 @@ static int cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def,
966 966
967 buf[0] = IPOPT_CIPSO; 967 buf[0] = IPOPT_CIPSO;
968 buf[1] = CIPSO_V4_HDR_LEN + len; 968 buf[1] = CIPSO_V4_HDR_LEN + len;
969 *(u32 *)&buf[2] = htonl(doi_def->doi); 969 *(__be32 *)&buf[2] = htonl(doi_def->doi);
970 970
971 return 0; 971 return 0;
972} 972}
@@ -1140,7 +1140,7 @@ int cipso_v4_validate(unsigned char **option)
1140 } 1140 }
1141 1141
1142 rcu_read_lock(); 1142 rcu_read_lock();
1143 doi_def = cipso_v4_doi_getdef(ntohl(*((u32 *)&opt[2]))); 1143 doi_def = cipso_v4_doi_getdef(ntohl(*((__be32 *)&opt[2])));
1144 if (doi_def == NULL) { 1144 if (doi_def == NULL) {
1145 err_offset = 2; 1145 err_offset = 2;
1146 goto validate_return_locked; 1146 goto validate_return_locked;
@@ -1370,7 +1370,7 @@ int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
1370 if (ret_val == 0) 1370 if (ret_val == 0)
1371 return ret_val; 1371 return ret_val;
1372 1372
1373 doi = ntohl(*(u32 *)&cipso_ptr[2]); 1373 doi = ntohl(*(__be32 *)&cipso_ptr[2]);
1374 rcu_read_lock(); 1374 rcu_read_lock();
1375 doi_def = cipso_v4_doi_getdef(doi); 1375 doi_def = cipso_v4_doi_getdef(doi);
1376 if (doi_def == NULL) { 1376 if (doi_def == NULL) {
@@ -1436,7 +1436,7 @@ int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
1436 if (cipso_v4_cache_check(cipso_ptr, cipso_ptr[1], secattr) == 0) 1436 if (cipso_v4_cache_check(cipso_ptr, cipso_ptr[1], secattr) == 0)
1437 return 0; 1437 return 0;
1438 1438
1439 doi = ntohl(*(u32 *)&cipso_ptr[2]); 1439 doi = ntohl(*(__be32 *)&cipso_ptr[2]);
1440 rcu_read_lock(); 1440 rcu_read_lock();
1441 doi_def = cipso_v4_doi_getdef(doi); 1441 doi_def = cipso_v4_doi_getdef(doi);
1442 if (doi_def == NULL) 1442 if (doi_def == NULL)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index f38cbbae0ae3..a1b356c8aa59 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -577,20 +577,20 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg
577 * Determine a default network mask, based on the IP address. 577 * Determine a default network mask, based on the IP address.
578 */ 578 */
579 579
580static __inline__ int inet_abc_len(u32 addr) 580static __inline__ int inet_abc_len(__be32 addr)
581{ 581{
582 int rc = -1; /* Something else, probably a multicast. */ 582 int rc = -1; /* Something else, probably a multicast. */
583 583
584 if (ZERONET(addr)) 584 if (ZERONET(addr))
585 rc = 0; 585 rc = 0;
586 else { 586 else {
587 addr = ntohl(addr); 587 __u32 haddr = ntohl(addr);
588 588
589 if (IN_CLASSA(addr)) 589 if (IN_CLASSA(haddr))
590 rc = 8; 590 rc = 8;
591 else if (IN_CLASSB(addr)) 591 else if (IN_CLASSB(haddr))
592 rc = 16; 592 rc = 16;
593 else if (IN_CLASSC(addr)) 593 else if (IN_CLASSC(haddr))
594 rc = 24; 594 rc = 24;
595 } 595 }
596 596
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index def32d8d3b06..90942a384a45 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -341,7 +341,7 @@ packet_routed:
341 341
342 /* OK, we know where to send it, allocate and build IP header. */ 342 /* OK, we know where to send it, allocate and build IP header. */
343 iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0)); 343 iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0));
344 *((__u16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff)); 344 *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff));
345 iph->tot_len = htons(skb->len); 345 iph->tot_len = htons(skb->len);
346 if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok) 346 if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok)
347 iph->frag_off = htons(IP_DF); 347 iph->frag_off = htons(IP_DF);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 4b132953bcc2..57d4bae6f080 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -355,7 +355,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len)
355 sin = (struct sockaddr_in *)msg->msg_name; 355 sin = (struct sockaddr_in *)msg->msg_name;
356 if (sin) { 356 if (sin) {
357 sin->sin_family = AF_INET; 357 sin->sin_family = AF_INET;
358 sin->sin_addr.s_addr = *(u32*)(skb->nh.raw + serr->addr_offset); 358 sin->sin_addr.s_addr = *(__be32*)(skb->nh.raw + serr->addr_offset);
359 sin->sin_port = serr->port; 359 sin->sin_port = serr->port;
360 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); 360 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
361 } 361 }
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 5c31dead2bdc..a6c63bbd9ddb 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -854,8 +854,8 @@ static void raw_seq_stop(struct seq_file *seq, void *v)
854static __inline__ char *get_raw_sock(struct sock *sp, char *tmpbuf, int i) 854static __inline__ char *get_raw_sock(struct sock *sp, char *tmpbuf, int i)
855{ 855{
856 struct inet_sock *inet = inet_sk(sp); 856 struct inet_sock *inet = inet_sk(sp);
857 unsigned int dest = inet->daddr, 857 __be32 dest = inet->daddr,
858 src = inet->rcv_saddr; 858 src = inet->rcv_saddr;
859 __u16 destp = 0, 859 __u16 destp = 0,
860 srcp = inet->num; 860 srcp = inet->num;
861 861
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d7152b2b2c64..ee00b6506ab4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -566,8 +566,8 @@ static inline u32 rt_score(struct rtable *rt)
566 566
567static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) 567static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
568{ 568{
569 return ((fl1->nl_u.ip4_u.daddr ^ fl2->nl_u.ip4_u.daddr) | 569 return ((__force u32)((fl1->nl_u.ip4_u.daddr ^ fl2->nl_u.ip4_u.daddr) |
570 (fl1->nl_u.ip4_u.saddr ^ fl2->nl_u.ip4_u.saddr) | 570 (fl1->nl_u.ip4_u.saddr ^ fl2->nl_u.ip4_u.saddr)) |
571 (fl1->mark ^ fl2->mark) | 571 (fl1->mark ^ fl2->mark) |
572 (*(u16 *)&fl1->nl_u.ip4_u.tos ^ 572 (*(u16 *)&fl1->nl_u.ip4_u.tos ^
573 *(u16 *)&fl2->nl_u.ip4_u.tos) | 573 *(u16 *)&fl2->nl_u.ip4_u.tos) |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 661e0a4bca72..6b19530905af 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -35,23 +35,23 @@ module_init(init_syncookies);
35#define COOKIEBITS 24 /* Upper bits store count */ 35#define COOKIEBITS 24 /* Upper bits store count */
36#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1) 36#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
37 37
38static u32 cookie_hash(u32 saddr, u32 daddr, u32 sport, u32 dport, 38static u32 cookie_hash(__be32 saddr, __be32 daddr, __be16 sport, __be16 dport,
39 u32 count, int c) 39 u32 count, int c)
40{ 40{
41 __u32 tmp[16 + 5 + SHA_WORKSPACE_WORDS]; 41 __u32 tmp[16 + 5 + SHA_WORKSPACE_WORDS];
42 42
43 memcpy(tmp + 3, syncookie_secret[c], sizeof(syncookie_secret[c])); 43 memcpy(tmp + 3, syncookie_secret[c], sizeof(syncookie_secret[c]));
44 tmp[0] = saddr; 44 tmp[0] = (__force u32)saddr;
45 tmp[1] = daddr; 45 tmp[1] = (__force u32)daddr;
46 tmp[2] = (sport << 16) + dport; 46 tmp[2] = ((__force u32)sport << 16) + (__force u32)dport;
47 tmp[3] = count; 47 tmp[3] = count;
48 sha_transform(tmp + 16, (__u8 *)tmp, tmp + 16 + 5); 48 sha_transform(tmp + 16, (__u8 *)tmp, tmp + 16 + 5);
49 49
50 return tmp[17]; 50 return tmp[17];
51} 51}
52 52
53static __u32 secure_tcp_syn_cookie(__u32 saddr, __u32 daddr, __u16 sport, 53static __u32 secure_tcp_syn_cookie(__be32 saddr, __be32 daddr, __be16 sport,
54 __u16 dport, __u32 sseq, __u32 count, 54 __be16 dport, __u32 sseq, __u32 count,
55 __u32 data) 55 __u32 data)
56{ 56{
57 /* 57 /*
@@ -80,8 +80,8 @@ static __u32 secure_tcp_syn_cookie(__u32 saddr, __u32 daddr, __u16 sport,
80 * "maxdiff" if the current (passed-in) "count". The return value 80 * "maxdiff" if the current (passed-in) "count". The return value
81 * is (__u32)-1 if this test fails. 81 * is (__u32)-1 if this test fails.
82 */ 82 */
83static __u32 check_tcp_syn_cookie(__u32 cookie, __u32 saddr, __u32 daddr, 83static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr,
84 __u16 sport, __u16 dport, __u32 sseq, 84 __be16 sport, __be16 dport, __u32 sseq,
85 __u32 count, __u32 maxdiff) 85 __u32 count, __u32 maxdiff)
86{ 86{
87 __u32 diff; 87 __u32 diff;
@@ -220,7 +220,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
220 } 220 }
221 ireq = inet_rsk(req); 221 ireq = inet_rsk(req);
222 treq = tcp_rsk(req); 222 treq = tcp_rsk(req);
223 treq->rcv_isn = htonl(skb->h.th->seq) - 1; 223 treq->rcv_isn = ntohl(skb->h.th->seq) - 1;
224 treq->snt_isn = cookie; 224 treq->snt_isn = cookie;
225 req->mss = mss; 225 req->mss = mss;
226 ireq->rmt_port = skb->h.th->source; 226 ireq->rmt_port = skb->h.th->source;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 8c8e8112f98d..0ca8dead03b0 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -542,7 +542,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
542 struct { 542 struct {
543 struct tcphdr th; 543 struct tcphdr th;
544#ifdef CONFIG_TCP_MD5SIG 544#ifdef CONFIG_TCP_MD5SIG
545 u32 opt[(TCPOLEN_MD5SIG_ALIGNED >> 2)]; 545 __be32 opt[(TCPOLEN_MD5SIG_ALIGNED >> 2)];
546#endif 546#endif
547 } rep; 547 } rep;
548 struct ip_reply_arg arg; 548 struct ip_reply_arg arg;
@@ -618,9 +618,9 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
618 struct tcphdr *th = skb->h.th; 618 struct tcphdr *th = skb->h.th;
619 struct { 619 struct {
620 struct tcphdr th; 620 struct tcphdr th;
621 u32 opt[(TCPOLEN_TSTAMP_ALIGNED >> 2) 621 __be32 opt[(TCPOLEN_TSTAMP_ALIGNED >> 2)
622#ifdef CONFIG_TCP_MD5SIG 622#ifdef CONFIG_TCP_MD5SIG
623 + (TCPOLEN_MD5SIG_ALIGNED >> 2) 623 + (TCPOLEN_MD5SIG_ALIGNED >> 2)
624#endif 624#endif
625 ]; 625 ];
626 } rep; 626 } rep;
@@ -2333,8 +2333,8 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i)
2333 struct tcp_sock *tp = tcp_sk(sp); 2333 struct tcp_sock *tp = tcp_sk(sp);
2334 const struct inet_connection_sock *icsk = inet_csk(sp); 2334 const struct inet_connection_sock *icsk = inet_csk(sp);
2335 struct inet_sock *inet = inet_sk(sp); 2335 struct inet_sock *inet = inet_sk(sp);
2336 unsigned int dest = inet->daddr; 2336 __be32 dest = inet->daddr;
2337 unsigned int src = inet->rcv_saddr; 2337 __be32 src = inet->rcv_saddr;
2338 __u16 destp = ntohs(inet->dport); 2338 __u16 destp = ntohs(inet->dport);
2339 __u16 srcp = ntohs(inet->sport); 2339 __u16 srcp = ntohs(inet->sport);
2340 2340
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 4a0ee901a888..383cb38461c5 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -493,7 +493,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
493 struct request_sock **prev) 493 struct request_sock **prev)
494{ 494{
495 struct tcphdr *th = skb->h.th; 495 struct tcphdr *th = skb->h.th;
496 u32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); 496 __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK);
497 int paws_reject = 0; 497 int paws_reject = 0;
498 struct tcp_options_received tmp_opt; 498 struct tcp_options_received tmp_opt;
499 struct sock *child; 499 struct sock *child;
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index fb09ade5897b..3355c276b611 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -297,7 +297,7 @@ static void tcp_retransmit_timer(struct sock *sk)
297 if (net_ratelimit()) { 297 if (net_ratelimit()) {
298 struct inet_sock *inet = inet_sk(sk); 298 struct inet_sock *inet = inet_sk(sk);
299 printk(KERN_DEBUG "TCP: Treason uncloaked! Peer %u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n", 299 printk(KERN_DEBUG "TCP: Treason uncloaked! Peer %u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n",
300 NIPQUAD(inet->daddr), htons(inet->dport), 300 NIPQUAD(inet->daddr), ntohs(inet->dport),
301 inet->num, tp->snd_una, tp->snd_nxt); 301 inet->num, tp->snd_una, tp->snd_nxt);
302 } 302 }
303#endif 303#endif