diff options
author | Eric Dumazet <edumazet@google.com> | 2013-10-10 03:04:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-10 14:37:35 -0400 |
commit | b44084c2c822f99dd3f2334b288b7e463d222662 (patch) | |
tree | 5fbcaffd319347ee5d22800c231eef2b4c44b007 | |
parent | ba537427d77cf274592f31ce94f4b4cadfad88b4 (diff) |
inet: rename ir_loc_port to ir_num
In commit 634fb979e8f ("inet: includes a sock_common in request_sock")
I forgot that the two ports in sock_common do not have same byte order :
skc_dport is __be16 (network order), but skc_num is __u16 (host order)
So sparse complains because ir_loc_port (mapped into skc_num) is
considered as __u16 while it should be __be16
Let rename ir_loc_port to ireq->ir_num (analogy with inet->inet_num),
and perform appropriate htons/ntohs conversions.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/inet_sock.h | 2 | ||||
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 4 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 8 | ||||
-rw-r--r-- | net/dccp/output.c | 2 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 4 | ||||
-rw-r--r-- | net/ipv4/syncookies.c | 8 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 2 | ||||
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 2 | ||||
-rw-r--r-- | net/ipv6/syncookies.c | 2 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 2 |
11 files changed, 19 insertions, 19 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index f91204442efa..06da91efbc83 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -72,7 +72,7 @@ struct inet_request_sock { | |||
72 | struct request_sock req; | 72 | struct request_sock req; |
73 | #define ir_loc_addr req.__req_common.skc_rcv_saddr | 73 | #define ir_loc_addr req.__req_common.skc_rcv_saddr |
74 | #define ir_rmt_addr req.__req_common.skc_daddr | 74 | #define ir_rmt_addr req.__req_common.skc_daddr |
75 | #define ir_loc_port req.__req_common.skc_num | 75 | #define ir_num req.__req_common.skc_num |
76 | #define ir_rmt_port req.__req_common.skc_dport | 76 | #define ir_rmt_port req.__req_common.skc_dport |
77 | #define ir_v6_rmt_addr req.__req_common.skc_v6_daddr | 77 | #define ir_v6_rmt_addr req.__req_common.skc_v6_daddr |
78 | #define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr | 78 | #define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 24a06161d174..1db3a016bff6 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1110,7 +1110,7 @@ static inline void tcp_openreq_init(struct request_sock *req, | |||
1110 | ireq->acked = 0; | 1110 | ireq->acked = 0; |
1111 | ireq->ecn_ok = 0; | 1111 | ireq->ecn_ok = 0; |
1112 | ireq->ir_rmt_port = tcp_hdr(skb)->source; | 1112 | ireq->ir_rmt_port = tcp_hdr(skb)->source; |
1113 | ireq->ir_loc_port = tcp_hdr(skb)->dest; | 1113 | ireq->ir_num = ntohs(tcp_hdr(skb)->dest); |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | void tcp_enter_memory_pressure(struct sock *sk); | 1116 | void tcp_enter_memory_pressure(struct sock *sk); |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 5cc5b24a956e..4ac71ff7c2e4 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -231,7 +231,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req) | |||
231 | fl6.flowlabel = 0; | 231 | fl6.flowlabel = 0; |
232 | fl6.flowi6_oif = ireq->ir_iif; | 232 | fl6.flowi6_oif = ireq->ir_iif; |
233 | fl6.fl6_dport = ireq->ir_rmt_port; | 233 | fl6.fl6_dport = ireq->ir_rmt_port; |
234 | fl6.fl6_sport = ireq->ir_loc_port; | 234 | fl6.fl6_sport = htons(ireq->ir_num); |
235 | security_req_classify_flow(req, flowi6_to_flowi(&fl6)); | 235 | security_req_classify_flow(req, flowi6_to_flowi(&fl6)); |
236 | 236 | ||
237 | 237 | ||
@@ -509,7 +509,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
509 | fl6.saddr = ireq->ir_v6_loc_addr; | 509 | fl6.saddr = ireq->ir_v6_loc_addr; |
510 | fl6.flowi6_oif = sk->sk_bound_dev_if; | 510 | fl6.flowi6_oif = sk->sk_bound_dev_if; |
511 | fl6.fl6_dport = ireq->ir_rmt_port; | 511 | fl6.fl6_dport = ireq->ir_rmt_port; |
512 | fl6.fl6_sport = ireq->ir_loc_port; | 512 | fl6.fl6_sport = htons(ireq->ir_num); |
513 | security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); | 513 | security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); |
514 | 514 | ||
515 | dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); | 515 | dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 66afbcec2941..9e2f78bc1553 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -266,10 +266,10 @@ int dccp_reqsk_init(struct request_sock *req, | |||
266 | { | 266 | { |
267 | struct dccp_request_sock *dreq = dccp_rsk(req); | 267 | struct dccp_request_sock *dreq = dccp_rsk(req); |
268 | 268 | ||
269 | inet_rsk(req)->ir_rmt_port = dccp_hdr(skb)->dccph_sport; | 269 | inet_rsk(req)->ir_rmt_port = dccp_hdr(skb)->dccph_sport; |
270 | inet_rsk(req)->ir_loc_port = dccp_hdr(skb)->dccph_dport; | 270 | inet_rsk(req)->ir_num = ntohs(dccp_hdr(skb)->dccph_dport); |
271 | inet_rsk(req)->acked = 0; | 271 | inet_rsk(req)->acked = 0; |
272 | dreq->dreq_timestamp_echo = 0; | 272 | dreq->dreq_timestamp_echo = 0; |
273 | 273 | ||
274 | /* inherit feature negotiation options from listening socket */ | 274 | /* inherit feature negotiation options from listening socket */ |
275 | return dccp_feat_clone_list(&dp->dccps_featneg, &dreq->dreq_featneg); | 275 | return dccp_feat_clone_list(&dp->dccps_featneg, &dreq->dreq_featneg); |
diff --git a/net/dccp/output.c b/net/dccp/output.c index 9bf195d1b87a..8876078859da 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -424,7 +424,7 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, | |||
424 | /* Build and checksum header */ | 424 | /* Build and checksum header */ |
425 | dh = dccp_zeroed_hdr(skb, dccp_header_size); | 425 | dh = dccp_zeroed_hdr(skb, dccp_header_size); |
426 | 426 | ||
427 | dh->dccph_sport = inet_rsk(req)->ir_loc_port; | 427 | dh->dccph_sport = htons(inet_rsk(req)->ir_num); |
428 | dh->dccph_dport = inet_rsk(req)->ir_rmt_port; | 428 | dh->dccph_dport = inet_rsk(req)->ir_rmt_port; |
429 | dh->dccph_doff = (dccp_header_size + | 429 | dh->dccph_doff = (dccp_header_size + |
430 | DCCP_SKB_CB(skb)->dccpd_opt_len) / 4; | 430 | DCCP_SKB_CB(skb)->dccpd_opt_len) / 4; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 2ffd931d652f..fc0e649cc002 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -676,8 +676,8 @@ struct sock *inet_csk_clone_lock(const struct sock *sk, | |||
676 | newicsk->icsk_bind_hash = NULL; | 676 | newicsk->icsk_bind_hash = NULL; |
677 | 677 | ||
678 | inet_sk(newsk)->inet_dport = inet_rsk(req)->ir_rmt_port; | 678 | inet_sk(newsk)->inet_dport = inet_rsk(req)->ir_rmt_port; |
679 | inet_sk(newsk)->inet_num = ntohs(inet_rsk(req)->ir_loc_port); | 679 | inet_sk(newsk)->inet_num = inet_rsk(req)->ir_num; |
680 | inet_sk(newsk)->inet_sport = inet_rsk(req)->ir_loc_port; | 680 | inet_sk(newsk)->inet_sport = htons(inet_rsk(req)->ir_num); |
681 | newsk->sk_write_space = sk_stream_write_space; | 681 | newsk->sk_write_space = sk_stream_write_space; |
682 | 682 | ||
683 | newicsk->icsk_retransmits = 0; | 683 | newicsk->icsk_retransmits = 0; |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 984e21cf3c50..3b64c59b4109 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -304,10 +304,10 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
304 | treq->rcv_isn = ntohl(th->seq) - 1; | 304 | treq->rcv_isn = ntohl(th->seq) - 1; |
305 | treq->snt_isn = cookie; | 305 | treq->snt_isn = cookie; |
306 | req->mss = mss; | 306 | req->mss = mss; |
307 | ireq->ir_loc_port = th->dest; | 307 | ireq->ir_num = ntohs(th->dest); |
308 | ireq->ir_rmt_port = th->source; | 308 | ireq->ir_rmt_port = th->source; |
309 | ireq->ir_loc_addr = ip_hdr(skb)->daddr; | 309 | ireq->ir_loc_addr = ip_hdr(skb)->daddr; |
310 | ireq->ir_rmt_addr = ip_hdr(skb)->saddr; | 310 | ireq->ir_rmt_addr = ip_hdr(skb)->saddr; |
311 | ireq->ecn_ok = ecn_ok; | 311 | ireq->ecn_ok = ecn_ok; |
312 | ireq->snd_wscale = tcp_opt.snd_wscale; | 312 | ireq->snd_wscale = tcp_opt.snd_wscale; |
313 | ireq->sack_ok = tcp_opt.sack_ok; | 313 | ireq->sack_ok = tcp_opt.sack_ok; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index faec81353522..2822ad021a48 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2734,7 +2734,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2734 | th->syn = 1; | 2734 | th->syn = 1; |
2735 | th->ack = 1; | 2735 | th->ack = 1; |
2736 | TCP_ECN_make_synack(req, th); | 2736 | TCP_ECN_make_synack(req, th); |
2737 | th->source = ireq->ir_loc_port; | 2737 | th->source = htons(ireq->ir_num); |
2738 | th->dest = ireq->ir_rmt_port; | 2738 | th->dest = ireq->ir_rmt_port; |
2739 | /* Setting of flags are superfluous here for callers (and ECE is | 2739 | /* Setting of flags are superfluous here for callers (and ECE is |
2740 | * not even correctly set) | 2740 | * not even correctly set) |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 1317c569b58f..77bb8afb141d 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -83,7 +83,7 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk, | |||
83 | fl6->flowi6_oif = ireq->ir_iif; | 83 | fl6->flowi6_oif = ireq->ir_iif; |
84 | fl6->flowi6_mark = sk->sk_mark; | 84 | fl6->flowi6_mark = sk->sk_mark; |
85 | fl6->fl6_dport = ireq->ir_rmt_port; | 85 | fl6->fl6_dport = ireq->ir_rmt_port; |
86 | fl6->fl6_sport = ireq->ir_loc_port; | 86 | fl6->fl6_sport = htons(ireq->ir_num); |
87 | security_req_classify_flow(req, flowi6_to_flowi(fl6)); | 87 | security_req_classify_flow(req, flowi6_to_flowi(fl6)); |
88 | 88 | ||
89 | dst = ip6_dst_lookup_flow(sk, fl6, final_p, false); | 89 | dst = ip6_dst_lookup_flow(sk, fl6, final_p, false); |
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index bc5698f9e4cd..d04d3f1dd9b7 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -194,7 +194,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | |||
194 | 194 | ||
195 | req->mss = mss; | 195 | req->mss = mss; |
196 | ireq->ir_rmt_port = th->source; | 196 | ireq->ir_rmt_port = th->source; |
197 | ireq->ir_loc_port = th->dest; | 197 | ireq->ir_num = ntohs(th->dest); |
198 | ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; | 198 | ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; |
199 | ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; | 199 | ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; |
200 | if (ipv6_opt_accepted(sk, skb) || | 200 | if (ipv6_opt_accepted(sk, skb) || |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index db234d609b33..b996ee2005a9 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1735,7 +1735,7 @@ static void get_openreq6(struct seq_file *seq, | |||
1735 | i, | 1735 | i, |
1736 | src->s6_addr32[0], src->s6_addr32[1], | 1736 | src->s6_addr32[0], src->s6_addr32[1], |
1737 | src->s6_addr32[2], src->s6_addr32[3], | 1737 | src->s6_addr32[2], src->s6_addr32[3], |
1738 | ntohs(inet_rsk(req)->ir_loc_port), | 1738 | inet_rsk(req)->ir_num, |
1739 | dest->s6_addr32[0], dest->s6_addr32[1], | 1739 | dest->s6_addr32[0], dest->s6_addr32[1], |
1740 | dest->s6_addr32[2], dest->s6_addr32[3], | 1740 | dest->s6_addr32[2], dest->s6_addr32[3], |
1741 | ntohs(inet_rsk(req)->ir_rmt_port), | 1741 | ntohs(inet_rsk(req)->ir_rmt_port), |