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 /net/dccp | |
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>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ipv6.c | 4 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 8 | ||||
-rw-r--r-- | net/dccp/output.c | 2 |
3 files changed, 7 insertions, 7 deletions
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; |