aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-10-09 18:21:29 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-10 00:08:07 -0400
commit634fb979e8f3a70f04c1f2f519d0cd1142eb5c1a (patch)
treeffd7f7ef4a313c94859180d1bc20f2713a11f987
parent8a29111c7ca68d928dfab58636f3f6acf0ac04f7 (diff)
inet: includes a sock_common in request_sock
TCP listener refactoring, part 5 : We want to be able to insert request sockets (SYN_RECV) into main ehash table instead of the per listener hash table to allow RCU lookups and remove listener lock contention. This patch includes the needed struct sock_common in front of struct request_sock This means there is no more inet6_request_sock IPv6 specific structure. Following inet_request_sock fields were renamed as they became macros to reference fields from struct sock_common. Prefix ir_ was chosen to avoid name collisions. loc_port -> ir_loc_port loc_addr -> ir_loc_addr rmt_addr -> ir_rmt_addr rmt_port -> ir_rmt_port iif -> ir_iif Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/ipv6.h26
-rw-r--r--include/net/inet_sock.h16
-rw-r--r--include/net/request_sock.h1
-rw-r--r--include/net/tcp.h4
-rw-r--r--net/dccp/ipv4.c18
-rw-r--r--net/dccp/ipv6.c63
-rw-r--r--net/dccp/ipv6.h1
-rw-r--r--net/dccp/minisocks.c4
-rw-r--r--net/dccp/output.c4
-rw-r--r--net/ipv4/inet_connection_sock.c23
-rw-r--r--net/ipv4/inet_diag.c22
-rw-r--r--net/ipv4/syncookies.c12
-rw-r--r--net/ipv4/tcp_ipv4.c38
-rw-r--r--net/ipv4/tcp_metrics.c8
-rw-r--r--net/ipv4/tcp_output.c4
-rw-r--r--net/ipv6/inet6_connection_sock.c26
-rw-r--r--net/ipv6/syncookies.c24
-rw-r--r--net/ipv6/tcp_ipv6.c61
-rw-r--r--net/netlabel/netlabel_kapi.c2
19 files changed, 169 insertions, 188 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 35f6c1b562c4..a80a63cfb70c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -115,16 +115,8 @@ static inline int inet6_iif(const struct sk_buff *skb)
115 return IP6CB(skb)->iif; 115 return IP6CB(skb)->iif;
116} 116}
117 117
118struct inet6_request_sock {
119 struct in6_addr loc_addr;
120 struct in6_addr rmt_addr;
121 struct sk_buff *pktopts;
122 int iif;
123};
124
125struct tcp6_request_sock { 118struct tcp6_request_sock {
126 struct tcp_request_sock tcp6rsk_tcp; 119 struct tcp_request_sock tcp6rsk_tcp;
127 struct inet6_request_sock tcp6rsk_inet6;
128}; 120};
129 121
130struct ipv6_mc_socklist; 122struct ipv6_mc_socklist;
@@ -264,26 +256,12 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
264 return inet_sk(__sk)->pinet6; 256 return inet_sk(__sk)->pinet6;
265} 257}
266 258
267static inline struct inet6_request_sock *
268 inet6_rsk(const struct request_sock *rsk)
269{
270 return (struct inet6_request_sock *)(((u8 *)rsk) +
271 inet_rsk(rsk)->inet6_rsk_offset);
272}
273
274static inline u32 inet6_rsk_offset(struct request_sock *rsk)
275{
276 return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock);
277}
278
279static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops) 259static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
280{ 260{
281 struct request_sock *req = reqsk_alloc(ops); 261 struct request_sock *req = reqsk_alloc(ops);
282 262
283 if (req != NULL) { 263 if (req)
284 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); 264 inet_rsk(req)->pktopts = NULL;
285 inet6_rsk(req)->pktopts = NULL;
286 }
287 265
288 return req; 266 return req;
289} 267}
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 6d9a7e6eb5a4..f91204442efa 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -70,13 +70,14 @@ struct ip_options_data {
70 70
71struct inet_request_sock { 71struct inet_request_sock {
72 struct request_sock req; 72 struct request_sock req;
73#if IS_ENABLED(CONFIG_IPV6) 73#define ir_loc_addr req.__req_common.skc_rcv_saddr
74 u16 inet6_rsk_offset; 74#define ir_rmt_addr req.__req_common.skc_daddr
75#endif 75#define ir_loc_port req.__req_common.skc_num
76 __be16 loc_port; 76#define ir_rmt_port req.__req_common.skc_dport
77 __be32 loc_addr; 77#define ir_v6_rmt_addr req.__req_common.skc_v6_daddr
78 __be32 rmt_addr; 78#define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr
79 __be16 rmt_port; 79#define ir_iif req.__req_common.skc_bound_dev_if
80
80 kmemcheck_bitfield_begin(flags); 81 kmemcheck_bitfield_begin(flags);
81 u16 snd_wscale : 4, 82 u16 snd_wscale : 4,
82 rcv_wscale : 4, 83 rcv_wscale : 4,
@@ -88,6 +89,7 @@ struct inet_request_sock {
88 no_srccheck: 1; 89 no_srccheck: 1;
89 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
90 struct ip_options_rcu *opt; 91 struct ip_options_rcu *opt;
92 struct sk_buff *pktopts;
91}; 93};
92 94
93static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 95static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 65c3e5164a5c..7f830ff67f08 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -48,6 +48,7 @@ int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
48/* struct request_sock - mini sock to represent a connection request 48/* struct request_sock - mini sock to represent a connection request
49 */ 49 */
50struct request_sock { 50struct request_sock {
51 struct sock_common __req_common;
51 struct request_sock *dl_next; 52 struct request_sock *dl_next;
52 u16 mss; 53 u16 mss;
53 u8 num_retrans; /* number of retransmits */ 54 u8 num_retrans; /* number of retransmits */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 39bbfa1602b2..24a06161d174 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1109,8 +1109,8 @@ static inline void tcp_openreq_init(struct request_sock *req,
1109 ireq->wscale_ok = rx_opt->wscale_ok; 1109 ireq->wscale_ok = rx_opt->wscale_ok;
1110 ireq->acked = 0; 1110 ireq->acked = 0;
1111 ireq->ecn_ok = 0; 1111 ireq->ecn_ok = 0;
1112 ireq->rmt_port = tcp_hdr(skb)->source; 1112 ireq->ir_rmt_port = tcp_hdr(skb)->source;
1113 ireq->loc_port = tcp_hdr(skb)->dest; 1113 ireq->ir_loc_port = tcp_hdr(skb)->dest;
1114} 1114}
1115 1115
1116void tcp_enter_memory_pressure(struct sock *sk); 1116void tcp_enter_memory_pressure(struct sock *sk);
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index ebc54fef85a5..720c36225ed9 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -409,9 +409,9 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
409 409
410 newinet = inet_sk(newsk); 410 newinet = inet_sk(newsk);
411 ireq = inet_rsk(req); 411 ireq = inet_rsk(req);
412 newinet->inet_daddr = ireq->rmt_addr; 412 newinet->inet_daddr = ireq->ir_rmt_addr;
413 newinet->inet_rcv_saddr = ireq->loc_addr; 413 newinet->inet_rcv_saddr = ireq->ir_loc_addr;
414 newinet->inet_saddr = ireq->loc_addr; 414 newinet->inet_saddr = ireq->ir_loc_addr;
415 newinet->inet_opt = ireq->opt; 415 newinet->inet_opt = ireq->opt;
416 ireq->opt = NULL; 416 ireq->opt = NULL;
417 newinet->mc_index = inet_iif(skb); 417 newinet->mc_index = inet_iif(skb);
@@ -516,10 +516,10 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req)
516 const struct inet_request_sock *ireq = inet_rsk(req); 516 const struct inet_request_sock *ireq = inet_rsk(req);
517 struct dccp_hdr *dh = dccp_hdr(skb); 517 struct dccp_hdr *dh = dccp_hdr(skb);
518 518
519 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr, 519 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr,
520 ireq->rmt_addr); 520 ireq->ir_rmt_addr);
521 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr, 521 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr,
522 ireq->rmt_addr, 522 ireq->ir_rmt_addr,
523 ireq->opt); 523 ireq->opt);
524 err = net_xmit_eval(err); 524 err = net_xmit_eval(err);
525 } 525 }
@@ -641,8 +641,8 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
641 goto drop_and_free; 641 goto drop_and_free;
642 642
643 ireq = inet_rsk(req); 643 ireq = inet_rsk(req);
644 ireq->loc_addr = ip_hdr(skb)->daddr; 644 ireq->ir_loc_addr = ip_hdr(skb)->daddr;
645 ireq->rmt_addr = ip_hdr(skb)->saddr; 645 ireq->ir_rmt_addr = ip_hdr(skb)->saddr;
646 646
647 /* 647 /*
648 * Step 3: Process LISTEN state 648 * Step 3: Process LISTEN state
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 7f075b83128a..5cc5b24a956e 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -216,7 +216,7 @@ out:
216 216
217static int dccp_v6_send_response(struct sock *sk, struct request_sock *req) 217static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
218{ 218{
219 struct inet6_request_sock *ireq6 = inet6_rsk(req); 219 struct inet_request_sock *ireq = inet_rsk(req);
220 struct ipv6_pinfo *np = inet6_sk(sk); 220 struct ipv6_pinfo *np = inet6_sk(sk);
221 struct sk_buff *skb; 221 struct sk_buff *skb;
222 struct in6_addr *final_p, final; 222 struct in6_addr *final_p, final;
@@ -226,12 +226,12 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
226 226
227 memset(&fl6, 0, sizeof(fl6)); 227 memset(&fl6, 0, sizeof(fl6));
228 fl6.flowi6_proto = IPPROTO_DCCP; 228 fl6.flowi6_proto = IPPROTO_DCCP;
229 fl6.daddr = ireq6->rmt_addr; 229 fl6.daddr = ireq->ir_v6_rmt_addr;
230 fl6.saddr = ireq6->loc_addr; 230 fl6.saddr = ireq->ir_v6_loc_addr;
231 fl6.flowlabel = 0; 231 fl6.flowlabel = 0;
232 fl6.flowi6_oif = ireq6->iif; 232 fl6.flowi6_oif = ireq->ir_iif;
233 fl6.fl6_dport = inet_rsk(req)->rmt_port; 233 fl6.fl6_dport = ireq->ir_rmt_port;
234 fl6.fl6_sport = inet_rsk(req)->loc_port; 234 fl6.fl6_sport = ireq->ir_loc_port;
235 security_req_classify_flow(req, flowi6_to_flowi(&fl6)); 235 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
236 236
237 237
@@ -249,9 +249,9 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
249 struct dccp_hdr *dh = dccp_hdr(skb); 249 struct dccp_hdr *dh = dccp_hdr(skb);
250 250
251 dh->dccph_checksum = dccp_v6_csum_finish(skb, 251 dh->dccph_checksum = dccp_v6_csum_finish(skb,
252 &ireq6->loc_addr, 252 &ireq->ir_v6_loc_addr,
253 &ireq6->rmt_addr); 253 &ireq->ir_v6_rmt_addr);
254 fl6.daddr = ireq6->rmt_addr; 254 fl6.daddr = ireq->ir_v6_rmt_addr;
255 err = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass); 255 err = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass);
256 err = net_xmit_eval(err); 256 err = net_xmit_eval(err);
257 } 257 }
@@ -264,8 +264,7 @@ done:
264static void dccp_v6_reqsk_destructor(struct request_sock *req) 264static void dccp_v6_reqsk_destructor(struct request_sock *req)
265{ 265{
266 dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); 266 dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg);
267 if (inet6_rsk(req)->pktopts != NULL) 267 kfree_skb(inet_rsk(req)->pktopts);
268 kfree_skb(inet6_rsk(req)->pktopts);
269} 268}
270 269
271static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) 270static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
@@ -359,7 +358,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
359{ 358{
360 struct request_sock *req; 359 struct request_sock *req;
361 struct dccp_request_sock *dreq; 360 struct dccp_request_sock *dreq;
362 struct inet6_request_sock *ireq6; 361 struct inet_request_sock *ireq;
363 struct ipv6_pinfo *np = inet6_sk(sk); 362 struct ipv6_pinfo *np = inet6_sk(sk);
364 const __be32 service = dccp_hdr_request(skb)->dccph_req_service; 363 const __be32 service = dccp_hdr_request(skb)->dccph_req_service;
365 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); 364 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
@@ -398,22 +397,22 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
398 if (security_inet_conn_request(sk, skb, req)) 397 if (security_inet_conn_request(sk, skb, req))
399 goto drop_and_free; 398 goto drop_and_free;
400 399
401 ireq6 = inet6_rsk(req); 400 ireq = inet_rsk(req);
402 ireq6->rmt_addr = ipv6_hdr(skb)->saddr; 401 ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
403 ireq6->loc_addr = ipv6_hdr(skb)->daddr; 402 ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
404 403
405 if (ipv6_opt_accepted(sk, skb) || 404 if (ipv6_opt_accepted(sk, skb) ||
406 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || 405 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
407 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { 406 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {
408 atomic_inc(&skb->users); 407 atomic_inc(&skb->users);
409 ireq6->pktopts = skb; 408 ireq->pktopts = skb;
410 } 409 }
411 ireq6->iif = sk->sk_bound_dev_if; 410 ireq->ir_iif = sk->sk_bound_dev_if;
412 411
413 /* So that link locals have meaning */ 412 /* So that link locals have meaning */
414 if (!sk->sk_bound_dev_if && 413 if (!sk->sk_bound_dev_if &&
415 ipv6_addr_type(&ireq6->rmt_addr) & IPV6_ADDR_LINKLOCAL) 414 ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL)
416 ireq6->iif = inet6_iif(skb); 415 ireq->ir_iif = inet6_iif(skb);
417 416
418 /* 417 /*
419 * Step 3: Process LISTEN state 418 * Step 3: Process LISTEN state
@@ -446,7 +445,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
446 struct request_sock *req, 445 struct request_sock *req,
447 struct dst_entry *dst) 446 struct dst_entry *dst)
448{ 447{
449 struct inet6_request_sock *ireq6 = inet6_rsk(req); 448 struct inet_request_sock *ireq = inet_rsk(req);
450 struct ipv6_pinfo *newnp, *np = inet6_sk(sk); 449 struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
451 struct inet_sock *newinet; 450 struct inet_sock *newinet;
452 struct dccp6_sock *newdp6; 451 struct dccp6_sock *newdp6;
@@ -505,12 +504,12 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
505 504
506 memset(&fl6, 0, sizeof(fl6)); 505 memset(&fl6, 0, sizeof(fl6));
507 fl6.flowi6_proto = IPPROTO_DCCP; 506 fl6.flowi6_proto = IPPROTO_DCCP;
508 fl6.daddr = ireq6->rmt_addr; 507 fl6.daddr = ireq->ir_v6_rmt_addr;
509 final_p = fl6_update_dst(&fl6, np->opt, &final); 508 final_p = fl6_update_dst(&fl6, np->opt, &final);
510 fl6.saddr = ireq6->loc_addr; 509 fl6.saddr = ireq->ir_v6_loc_addr;
511 fl6.flowi6_oif = sk->sk_bound_dev_if; 510 fl6.flowi6_oif = sk->sk_bound_dev_if;
512 fl6.fl6_dport = inet_rsk(req)->rmt_port; 511 fl6.fl6_dport = ireq->ir_rmt_port;
513 fl6.fl6_sport = inet_rsk(req)->loc_port; 512 fl6.fl6_sport = ireq->ir_loc_port;
514 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); 513 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
515 514
516 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); 515 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
@@ -538,10 +537,10 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
538 537
539 memcpy(newnp, np, sizeof(struct ipv6_pinfo)); 538 memcpy(newnp, np, sizeof(struct ipv6_pinfo));
540 539
541 newsk->sk_v6_daddr = ireq6->rmt_addr; 540 newsk->sk_v6_daddr = ireq->ir_v6_rmt_addr;
542 newnp->saddr = ireq6->loc_addr; 541 newnp->saddr = ireq->ir_v6_loc_addr;
543 newsk->sk_v6_rcv_saddr = ireq6->loc_addr; 542 newsk->sk_v6_rcv_saddr = ireq->ir_v6_loc_addr;
544 newsk->sk_bound_dev_if = ireq6->iif; 543 newsk->sk_bound_dev_if = ireq->ir_iif;
545 544
546 /* Now IPv6 options... 545 /* Now IPv6 options...
547 546
@@ -554,10 +553,10 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
554 553
555 /* Clone pktoptions received with SYN */ 554 /* Clone pktoptions received with SYN */
556 newnp->pktoptions = NULL; 555 newnp->pktoptions = NULL;
557 if (ireq6->pktopts != NULL) { 556 if (ireq->pktopts != NULL) {
558 newnp->pktoptions = skb_clone(ireq6->pktopts, GFP_ATOMIC); 557 newnp->pktoptions = skb_clone(ireq->pktopts, GFP_ATOMIC);
559 consume_skb(ireq6->pktopts); 558 consume_skb(ireq->pktopts);
560 ireq6->pktopts = NULL; 559 ireq->pktopts = NULL;
561 if (newnp->pktoptions) 560 if (newnp->pktoptions)
562 skb_set_owner_r(newnp->pktoptions, newsk); 561 skb_set_owner_r(newnp->pktoptions, newsk);
563 } 562 }
diff --git a/net/dccp/ipv6.h b/net/dccp/ipv6.h
index 6604fc3fe953..af259e15e7f0 100644
--- a/net/dccp/ipv6.h
+++ b/net/dccp/ipv6.h
@@ -25,7 +25,6 @@ struct dccp6_sock {
25 25
26struct dccp6_request_sock { 26struct dccp6_request_sock {
27 struct dccp_request_sock dccp; 27 struct dccp_request_sock dccp;
28 struct inet6_request_sock inet6;
29}; 28};
30 29
31struct dccp6_timewait_sock { 30struct dccp6_timewait_sock {
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 32e80d96d4c0..66afbcec2941 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -266,8 +266,8 @@ 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)->rmt_port = dccp_hdr(skb)->dccph_sport; 269 inet_rsk(req)->ir_rmt_port = dccp_hdr(skb)->dccph_sport;
270 inet_rsk(req)->loc_port = dccp_hdr(skb)->dccph_dport; 270 inet_rsk(req)->ir_loc_port = 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
diff --git a/net/dccp/output.c b/net/dccp/output.c
index d17fc90a74b6..9bf195d1b87a 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -424,8 +424,8 @@ 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)->loc_port; 427 dh->dccph_sport = inet_rsk(req)->ir_loc_port;
428 dh->dccph_dport = inet_rsk(req)->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;
431 dh->dccph_type = DCCP_PKT_RESPONSE; 431 dh->dccph_type = DCCP_PKT_RESPONSE;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 56e82a4027b4..2ffd931d652f 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -412,8 +412,8 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
412 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, 412 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
413 sk->sk_protocol, 413 sk->sk_protocol,
414 flags, 414 flags,
415 (opt && opt->opt.srr) ? opt->opt.faddr : ireq->rmt_addr, 415 (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr,
416 ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport); 416 ireq->ir_loc_addr, ireq->ir_rmt_port, inet_sk(sk)->inet_sport);
417 security_req_classify_flow(req, flowi4_to_flowi(fl4)); 417 security_req_classify_flow(req, flowi4_to_flowi(fl4));
418 rt = ip_route_output_flow(net, fl4, sk); 418 rt = ip_route_output_flow(net, fl4, sk);
419 if (IS_ERR(rt)) 419 if (IS_ERR(rt))
@@ -448,8 +448,8 @@ struct dst_entry *inet_csk_route_child_sock(struct sock *sk,
448 flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark, 448 flowi4_init_output(fl4, sk->sk_bound_dev_if, sk->sk_mark,
449 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, 449 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
450 sk->sk_protocol, inet_sk_flowi_flags(sk), 450 sk->sk_protocol, inet_sk_flowi_flags(sk),
451 (opt && opt->opt.srr) ? opt->opt.faddr : ireq->rmt_addr, 451 (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr,
452 ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport); 452 ireq->ir_loc_addr, ireq->ir_rmt_port, inet_sk(sk)->inet_sport);
453 security_req_classify_flow(req, flowi4_to_flowi(fl4)); 453 security_req_classify_flow(req, flowi4_to_flowi(fl4));
454 rt = ip_route_output_flow(net, fl4, sk); 454 rt = ip_route_output_flow(net, fl4, sk);
455 if (IS_ERR(rt)) 455 if (IS_ERR(rt))
@@ -495,9 +495,9 @@ struct request_sock *inet_csk_search_req(const struct sock *sk,
495 prev = &req->dl_next) { 495 prev = &req->dl_next) {
496 const struct inet_request_sock *ireq = inet_rsk(req); 496 const struct inet_request_sock *ireq = inet_rsk(req);
497 497
498 if (ireq->rmt_port == rport && 498 if (ireq->ir_rmt_port == rport &&
499 ireq->rmt_addr == raddr && 499 ireq->ir_rmt_addr == raddr &&
500 ireq->loc_addr == laddr && 500 ireq->ir_loc_addr == laddr &&
501 AF_INET_FAMILY(req->rsk_ops->family)) { 501 AF_INET_FAMILY(req->rsk_ops->family)) {
502 WARN_ON(req->sk); 502 WARN_ON(req->sk);
503 *prevp = prev; 503 *prevp = prev;
@@ -514,7 +514,8 @@ void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
514{ 514{
515 struct inet_connection_sock *icsk = inet_csk(sk); 515 struct inet_connection_sock *icsk = inet_csk(sk);
516 struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; 516 struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt;
517 const u32 h = inet_synq_hash(inet_rsk(req)->rmt_addr, inet_rsk(req)->rmt_port, 517 const u32 h = inet_synq_hash(inet_rsk(req)->ir_rmt_addr,
518 inet_rsk(req)->ir_rmt_port,
518 lopt->hash_rnd, lopt->nr_table_entries); 519 lopt->hash_rnd, lopt->nr_table_entries);
519 520
520 reqsk_queue_hash_req(&icsk->icsk_accept_queue, h, req, timeout); 521 reqsk_queue_hash_req(&icsk->icsk_accept_queue, h, req, timeout);
@@ -674,9 +675,9 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,
674 newsk->sk_state = TCP_SYN_RECV; 675 newsk->sk_state = TCP_SYN_RECV;
675 newicsk->icsk_bind_hash = NULL; 676 newicsk->icsk_bind_hash = NULL;
676 677
677 inet_sk(newsk)->inet_dport = inet_rsk(req)->rmt_port; 678 inet_sk(newsk)->inet_dport = inet_rsk(req)->ir_rmt_port;
678 inet_sk(newsk)->inet_num = ntohs(inet_rsk(req)->loc_port); 679 inet_sk(newsk)->inet_num = ntohs(inet_rsk(req)->ir_loc_port);
679 inet_sk(newsk)->inet_sport = inet_rsk(req)->loc_port; 680 inet_sk(newsk)->inet_sport = inet_rsk(req)->ir_loc_port;
680 newsk->sk_write_space = sk_stream_write_space; 681 newsk->sk_write_space = sk_stream_write_space;
681 682
682 newicsk->icsk_retransmits = 0; 683 newicsk->icsk_retransmits = 0;
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index ecc179d676e4..41e1c3ea8b51 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -679,12 +679,12 @@ static inline void inet_diag_req_addrs(const struct sock *sk,
679#if IS_ENABLED(CONFIG_IPV6) 679#if IS_ENABLED(CONFIG_IPV6)
680 if (sk->sk_family == AF_INET6) { 680 if (sk->sk_family == AF_INET6) {
681 if (req->rsk_ops->family == AF_INET6) { 681 if (req->rsk_ops->family == AF_INET6) {
682 entry->saddr = inet6_rsk(req)->loc_addr.s6_addr32; 682 entry->saddr = ireq->ir_v6_loc_addr.s6_addr32;
683 entry->daddr = inet6_rsk(req)->rmt_addr.s6_addr32; 683 entry->daddr = ireq->ir_v6_rmt_addr.s6_addr32;
684 } else if (req->rsk_ops->family == AF_INET) { 684 } else if (req->rsk_ops->family == AF_INET) {
685 ipv6_addr_set_v4mapped(ireq->loc_addr, 685 ipv6_addr_set_v4mapped(ireq->ir_loc_addr,
686 &entry->saddr_storage); 686 &entry->saddr_storage);
687 ipv6_addr_set_v4mapped(ireq->rmt_addr, 687 ipv6_addr_set_v4mapped(ireq->ir_rmt_addr,
688 &entry->daddr_storage); 688 &entry->daddr_storage);
689 entry->saddr = entry->saddr_storage.s6_addr32; 689 entry->saddr = entry->saddr_storage.s6_addr32;
690 entry->daddr = entry->daddr_storage.s6_addr32; 690 entry->daddr = entry->daddr_storage.s6_addr32;
@@ -692,8 +692,8 @@ static inline void inet_diag_req_addrs(const struct sock *sk,
692 } else 692 } else
693#endif 693#endif
694 { 694 {
695 entry->saddr = &ireq->loc_addr; 695 entry->saddr = &ireq->ir_loc_addr;
696 entry->daddr = &ireq->rmt_addr; 696 entry->daddr = &ireq->ir_rmt_addr;
697 } 697 }
698} 698}
699 699
@@ -728,9 +728,9 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
728 tmo = 0; 728 tmo = 0;
729 729
730 r->id.idiag_sport = inet->inet_sport; 730 r->id.idiag_sport = inet->inet_sport;
731 r->id.idiag_dport = ireq->rmt_port; 731 r->id.idiag_dport = ireq->ir_rmt_port;
732 r->id.idiag_src[0] = ireq->loc_addr; 732 r->id.idiag_src[0] = ireq->ir_loc_addr;
733 r->id.idiag_dst[0] = ireq->rmt_addr; 733 r->id.idiag_dst[0] = ireq->ir_rmt_addr;
734 r->idiag_expires = jiffies_to_msecs(tmo); 734 r->idiag_expires = jiffies_to_msecs(tmo);
735 r->idiag_rqueue = 0; 735 r->idiag_rqueue = 0;
736 r->idiag_wqueue = 0; 736 r->idiag_wqueue = 0;
@@ -789,13 +789,13 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
789 789
790 if (reqnum < s_reqnum) 790 if (reqnum < s_reqnum)
791 continue; 791 continue;
792 if (r->id.idiag_dport != ireq->rmt_port && 792 if (r->id.idiag_dport != ireq->ir_rmt_port &&
793 r->id.idiag_dport) 793 r->id.idiag_dport)
794 continue; 794 continue;
795 795
796 if (bc) { 796 if (bc) {
797 inet_diag_req_addrs(sk, req, &entry); 797 inet_diag_req_addrs(sk, req, &entry);
798 entry.dport = ntohs(ireq->rmt_port); 798 entry.dport = ntohs(ireq->ir_rmt_port);
799 799
800 if (!inet_diag_bc_run(bc, &entry)) 800 if (!inet_diag_bc_run(bc, &entry))
801 continue; 801 continue;
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 15e024105f91..984e21cf3c50 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->loc_port = th->dest; 307 ireq->ir_loc_port = th->dest;
308 ireq->rmt_port = th->source; 308 ireq->ir_rmt_port = th->source;
309 ireq->loc_addr = ip_hdr(skb)->daddr; 309 ireq->ir_loc_addr = ip_hdr(skb)->daddr;
310 ireq->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;
@@ -347,8 +347,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
347 flowi4_init_output(&fl4, sk->sk_bound_dev_if, sk->sk_mark, 347 flowi4_init_output(&fl4, sk->sk_bound_dev_if, sk->sk_mark,
348 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, IPPROTO_TCP, 348 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, IPPROTO_TCP,
349 inet_sk_flowi_flags(sk), 349 inet_sk_flowi_flags(sk),
350 (opt && opt->srr) ? opt->faddr : ireq->rmt_addr, 350 (opt && opt->srr) ? opt->faddr : ireq->ir_rmt_addr,
351 ireq->loc_addr, th->source, th->dest); 351 ireq->ir_loc_addr, th->source, th->dest);
352 security_req_classify_flow(req, flowi4_to_flowi(&fl4)); 352 security_req_classify_flow(req, flowi4_to_flowi(&fl4));
353 rt = ip_route_output_key(sock_net(sk), &fl4); 353 rt = ip_route_output_key(sock_net(sk), &fl4);
354 if (IS_ERR(rt)) { 354 if (IS_ERR(rt)) {
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index e4695dde1af6..114d1b748cbb 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -835,11 +835,11 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
835 skb = tcp_make_synack(sk, dst, req, NULL); 835 skb = tcp_make_synack(sk, dst, req, NULL);
836 836
837 if (skb) { 837 if (skb) {
838 __tcp_v4_send_check(skb, ireq->loc_addr, ireq->rmt_addr); 838 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr);
839 839
840 skb_set_queue_mapping(skb, queue_mapping); 840 skb_set_queue_mapping(skb, queue_mapping);
841 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr, 841 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr,
842 ireq->rmt_addr, 842 ireq->ir_rmt_addr,
843 ireq->opt); 843 ireq->opt);
844 err = net_xmit_eval(err); 844 err = net_xmit_eval(err);
845 if (!tcp_rsk(req)->snt_synack && !err) 845 if (!tcp_rsk(req)->snt_synack && !err)
@@ -972,7 +972,7 @@ static struct tcp_md5sig_key *tcp_v4_reqsk_md5_lookup(struct sock *sk,
972{ 972{
973 union tcp_md5_addr *addr; 973 union tcp_md5_addr *addr;
974 974
975 addr = (union tcp_md5_addr *)&inet_rsk(req)->rmt_addr; 975 addr = (union tcp_md5_addr *)&inet_rsk(req)->ir_rmt_addr;
976 return tcp_md5_do_lookup(sk, addr, AF_INET); 976 return tcp_md5_do_lookup(sk, addr, AF_INET);
977} 977}
978 978
@@ -1149,8 +1149,8 @@ int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1149 saddr = inet_sk(sk)->inet_saddr; 1149 saddr = inet_sk(sk)->inet_saddr;
1150 daddr = inet_sk(sk)->inet_daddr; 1150 daddr = inet_sk(sk)->inet_daddr;
1151 } else if (req) { 1151 } else if (req) {
1152 saddr = inet_rsk(req)->loc_addr; 1152 saddr = inet_rsk(req)->ir_loc_addr;
1153 daddr = inet_rsk(req)->rmt_addr; 1153 daddr = inet_rsk(req)->ir_rmt_addr;
1154 } else { 1154 } else {
1155 const struct iphdr *iph = ip_hdr(skb); 1155 const struct iphdr *iph = ip_hdr(skb);
1156 saddr = iph->saddr; 1156 saddr = iph->saddr;
@@ -1366,8 +1366,8 @@ static int tcp_v4_conn_req_fastopen(struct sock *sk,
1366 kfree_skb(skb_synack); 1366 kfree_skb(skb_synack);
1367 return -1; 1367 return -1;
1368 } 1368 }
1369 err = ip_build_and_send_pkt(skb_synack, sk, ireq->loc_addr, 1369 err = ip_build_and_send_pkt(skb_synack, sk, ireq->ir_loc_addr,
1370 ireq->rmt_addr, ireq->opt); 1370 ireq->ir_rmt_addr, ireq->opt);
1371 err = net_xmit_eval(err); 1371 err = net_xmit_eval(err);
1372 if (!err) 1372 if (!err)
1373 tcp_rsk(req)->snt_synack = tcp_time_stamp; 1373 tcp_rsk(req)->snt_synack = tcp_time_stamp;
@@ -1502,8 +1502,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1502 tcp_openreq_init(req, &tmp_opt, skb); 1502 tcp_openreq_init(req, &tmp_opt, skb);
1503 1503
1504 ireq = inet_rsk(req); 1504 ireq = inet_rsk(req);
1505 ireq->loc_addr = daddr; 1505 ireq->ir_loc_addr = daddr;
1506 ireq->rmt_addr = saddr; 1506 ireq->ir_rmt_addr = saddr;
1507 ireq->no_srccheck = inet_sk(sk)->transparent; 1507 ireq->no_srccheck = inet_sk(sk)->transparent;
1508 ireq->opt = tcp_v4_save_options(skb); 1508 ireq->opt = tcp_v4_save_options(skb);
1509 1509
@@ -1578,15 +1578,15 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1578 fastopen_cookie_present(&valid_foc) ? &valid_foc : NULL); 1578 fastopen_cookie_present(&valid_foc) ? &valid_foc : NULL);
1579 1579
1580 if (skb_synack) { 1580 if (skb_synack) {
1581 __tcp_v4_send_check(skb_synack, ireq->loc_addr, ireq->rmt_addr); 1581 __tcp_v4_send_check(skb_synack, ireq->ir_loc_addr, ireq->ir_rmt_addr);
1582 skb_set_queue_mapping(skb_synack, skb_get_queue_mapping(skb)); 1582 skb_set_queue_mapping(skb_synack, skb_get_queue_mapping(skb));
1583 } else 1583 } else
1584 goto drop_and_free; 1584 goto drop_and_free;
1585 1585
1586 if (likely(!do_fastopen)) { 1586 if (likely(!do_fastopen)) {
1587 int err; 1587 int err;
1588 err = ip_build_and_send_pkt(skb_synack, sk, ireq->loc_addr, 1588 err = ip_build_and_send_pkt(skb_synack, sk, ireq->ir_loc_addr,
1589 ireq->rmt_addr, ireq->opt); 1589 ireq->ir_rmt_addr, ireq->opt);
1590 err = net_xmit_eval(err); 1590 err = net_xmit_eval(err);
1591 if (err || want_cookie) 1591 if (err || want_cookie)
1592 goto drop_and_free; 1592 goto drop_and_free;
@@ -1644,9 +1644,9 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1644 newtp = tcp_sk(newsk); 1644 newtp = tcp_sk(newsk);
1645 newinet = inet_sk(newsk); 1645 newinet = inet_sk(newsk);
1646 ireq = inet_rsk(req); 1646 ireq = inet_rsk(req);
1647 newinet->inet_daddr = ireq->rmt_addr; 1647 newinet->inet_daddr = ireq->ir_rmt_addr;
1648 newinet->inet_rcv_saddr = ireq->loc_addr; 1648 newinet->inet_rcv_saddr = ireq->ir_loc_addr;
1649 newinet->inet_saddr = ireq->loc_addr; 1649 newinet->inet_saddr = ireq->ir_loc_addr;
1650 inet_opt = ireq->opt; 1650 inet_opt = ireq->opt;
1651 rcu_assign_pointer(newinet->inet_opt, inet_opt); 1651 rcu_assign_pointer(newinet->inet_opt, inet_opt);
1652 ireq->opt = NULL; 1652 ireq->opt = NULL;
@@ -2548,10 +2548,10 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
2548 seq_printf(f, "%4d: %08X:%04X %08X:%04X" 2548 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
2549 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n", 2549 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n",
2550 i, 2550 i,
2551 ireq->loc_addr, 2551 ireq->ir_loc_addr,
2552 ntohs(inet_sk(sk)->inet_sport), 2552 ntohs(inet_sk(sk)->inet_sport),
2553 ireq->rmt_addr, 2553 ireq->ir_rmt_addr,
2554 ntohs(ireq->rmt_port), 2554 ntohs(ireq->ir_rmt_port),
2555 TCP_SYN_RECV, 2555 TCP_SYN_RECV,
2556 0, 0, /* could print option size, but that is af dependent. */ 2556 0, 0, /* could print option size, but that is af dependent. */
2557 1, /* timers active (only the expire timer) */ 2557 1, /* timers active (only the expire timer) */
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 8fcc2cb9dba4..4a2a84110dfb 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -215,13 +215,15 @@ static struct tcp_metrics_block *__tcp_get_metrics_req(struct request_sock *req,
215 addr.family = req->rsk_ops->family; 215 addr.family = req->rsk_ops->family;
216 switch (addr.family) { 216 switch (addr.family) {
217 case AF_INET: 217 case AF_INET:
218 addr.addr.a4 = inet_rsk(req)->rmt_addr; 218 addr.addr.a4 = inet_rsk(req)->ir_rmt_addr;
219 hash = (__force unsigned int) addr.addr.a4; 219 hash = (__force unsigned int) addr.addr.a4;
220 break; 220 break;
221#if IS_ENABLED(CONFIG_IPV6)
221 case AF_INET6: 222 case AF_INET6:
222 *(struct in6_addr *)addr.addr.a6 = inet6_rsk(req)->rmt_addr; 223 *(struct in6_addr *)addr.addr.a6 = inet_rsk(req)->ir_v6_rmt_addr;
223 hash = ipv6_addr_hash(&inet6_rsk(req)->rmt_addr); 224 hash = ipv6_addr_hash(&inet_rsk(req)->ir_v6_rmt_addr);
224 break; 225 break;
226#endif
225 default: 227 default:
226 return NULL; 228 return NULL;
227 } 229 }
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index c6f01f2cdb32..faec81353522 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2734,8 +2734,8 @@ 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->loc_port; 2737 th->source = ireq->ir_loc_port;
2738 th->dest = ireq->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)
2741 */ 2741 */
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index b7400b480e74..1317c569b58f 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -70,20 +70,20 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
70 struct flowi6 *fl6, 70 struct flowi6 *fl6,
71 const struct request_sock *req) 71 const struct request_sock *req)
72{ 72{
73 struct inet6_request_sock *treq = inet6_rsk(req); 73 struct inet_request_sock *ireq = inet_rsk(req);
74 struct ipv6_pinfo *np = inet6_sk(sk); 74 struct ipv6_pinfo *np = inet6_sk(sk);
75 struct in6_addr *final_p, final; 75 struct in6_addr *final_p, final;
76 struct dst_entry *dst; 76 struct dst_entry *dst;
77 77
78 memset(fl6, 0, sizeof(*fl6)); 78 memset(fl6, 0, sizeof(*fl6));
79 fl6->flowi6_proto = IPPROTO_TCP; 79 fl6->flowi6_proto = IPPROTO_TCP;
80 fl6->daddr = treq->rmt_addr; 80 fl6->daddr = ireq->ir_v6_rmt_addr;
81 final_p = fl6_update_dst(fl6, np->opt, &final); 81 final_p = fl6_update_dst(fl6, np->opt, &final);
82 fl6->saddr = treq->loc_addr; 82 fl6->saddr = ireq->ir_v6_loc_addr;
83 fl6->flowi6_oif = treq->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 = inet_rsk(req)->rmt_port; 85 fl6->fl6_dport = ireq->ir_rmt_port;
86 fl6->fl6_sport = inet_rsk(req)->loc_port; 86 fl6->fl6_sport = ireq->ir_loc_port;
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);
@@ -129,13 +129,13 @@ struct request_sock *inet6_csk_search_req(const struct sock *sk,
129 lopt->nr_table_entries)]; 129 lopt->nr_table_entries)];
130 (req = *prev) != NULL; 130 (req = *prev) != NULL;
131 prev = &req->dl_next) { 131 prev = &req->dl_next) {
132 const struct inet6_request_sock *treq = inet6_rsk(req); 132 const struct inet_request_sock *ireq = inet_rsk(req);
133 133
134 if (inet_rsk(req)->rmt_port == rport && 134 if (ireq->ir_rmt_port == rport &&
135 req->rsk_ops->family == AF_INET6 && 135 req->rsk_ops->family == AF_INET6 &&
136 ipv6_addr_equal(&treq->rmt_addr, raddr) && 136 ipv6_addr_equal(&ireq->ir_v6_rmt_addr, raddr) &&
137 ipv6_addr_equal(&treq->loc_addr, laddr) && 137 ipv6_addr_equal(&ireq->ir_v6_loc_addr, laddr) &&
138 (!treq->iif || treq->iif == iif)) { 138 (!ireq->ir_iif || ireq->ir_iif == iif)) {
139 WARN_ON(req->sk != NULL); 139 WARN_ON(req->sk != NULL);
140 *prevp = prev; 140 *prevp = prev;
141 return req; 141 return req;
@@ -153,8 +153,8 @@ void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
153{ 153{
154 struct inet_connection_sock *icsk = inet_csk(sk); 154 struct inet_connection_sock *icsk = inet_csk(sk);
155 struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; 155 struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt;
156 const u32 h = inet6_synq_hash(&inet6_rsk(req)->rmt_addr, 156 const u32 h = inet6_synq_hash(&inet_rsk(req)->ir_v6_rmt_addr,
157 inet_rsk(req)->rmt_port, 157 inet_rsk(req)->ir_rmt_port,
158 lopt->hash_rnd, lopt->nr_table_entries); 158 lopt->hash_rnd, lopt->nr_table_entries);
159 159
160 reqsk_queue_hash_req(&icsk->icsk_accept_queue, h, req, timeout); 160 reqsk_queue_hash_req(&icsk->icsk_accept_queue, h, req, timeout);
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index d703218a653b..bc5698f9e4cd 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -150,7 +150,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
150{ 150{
151 struct tcp_options_received tcp_opt; 151 struct tcp_options_received tcp_opt;
152 struct inet_request_sock *ireq; 152 struct inet_request_sock *ireq;
153 struct inet6_request_sock *ireq6;
154 struct tcp_request_sock *treq; 153 struct tcp_request_sock *treq;
155 struct ipv6_pinfo *np = inet6_sk(sk); 154 struct ipv6_pinfo *np = inet6_sk(sk);
156 struct tcp_sock *tp = tcp_sk(sk); 155 struct tcp_sock *tp = tcp_sk(sk);
@@ -187,7 +186,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
187 goto out; 186 goto out;
188 187
189 ireq = inet_rsk(req); 188 ireq = inet_rsk(req);
190 ireq6 = inet6_rsk(req);
191 treq = tcp_rsk(req); 189 treq = tcp_rsk(req);
192 treq->listener = NULL; 190 treq->listener = NULL;
193 191
@@ -195,22 +193,22 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
195 goto out_free; 193 goto out_free;
196 194
197 req->mss = mss; 195 req->mss = mss;
198 ireq->rmt_port = th->source; 196 ireq->ir_rmt_port = th->source;
199 ireq->loc_port = th->dest; 197 ireq->ir_loc_port = th->dest;
200 ireq6->rmt_addr = ipv6_hdr(skb)->saddr; 198 ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
201 ireq6->loc_addr = ipv6_hdr(skb)->daddr; 199 ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
202 if (ipv6_opt_accepted(sk, skb) || 200 if (ipv6_opt_accepted(sk, skb) ||
203 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || 201 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
204 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { 202 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {
205 atomic_inc(&skb->users); 203 atomic_inc(&skb->users);
206 ireq6->pktopts = skb; 204 ireq->pktopts = skb;
207 } 205 }
208 206
209 ireq6->iif = sk->sk_bound_dev_if; 207 ireq->ir_iif = sk->sk_bound_dev_if;
210 /* So that link locals have meaning */ 208 /* So that link locals have meaning */
211 if (!sk->sk_bound_dev_if && 209 if (!sk->sk_bound_dev_if &&
212 ipv6_addr_type(&ireq6->rmt_addr) & IPV6_ADDR_LINKLOCAL) 210 ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL)
213 ireq6->iif = inet6_iif(skb); 211 ireq->ir_iif = inet6_iif(skb);
214 212
215 req->expires = 0UL; 213 req->expires = 0UL;
216 req->num_retrans = 0; 214 req->num_retrans = 0;
@@ -234,12 +232,12 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
234 struct flowi6 fl6; 232 struct flowi6 fl6;
235 memset(&fl6, 0, sizeof(fl6)); 233 memset(&fl6, 0, sizeof(fl6));
236 fl6.flowi6_proto = IPPROTO_TCP; 234 fl6.flowi6_proto = IPPROTO_TCP;
237 fl6.daddr = ireq6->rmt_addr; 235 fl6.daddr = ireq->ir_v6_rmt_addr;
238 final_p = fl6_update_dst(&fl6, np->opt, &final); 236 final_p = fl6_update_dst(&fl6, np->opt, &final);
239 fl6.saddr = ireq6->loc_addr; 237 fl6.saddr = ireq->ir_v6_loc_addr;
240 fl6.flowi6_oif = sk->sk_bound_dev_if; 238 fl6.flowi6_oif = sk->sk_bound_dev_if;
241 fl6.flowi6_mark = sk->sk_mark; 239 fl6.flowi6_mark = sk->sk_mark;
242 fl6.fl6_dport = inet_rsk(req)->rmt_port; 240 fl6.fl6_dport = ireq->ir_rmt_port;
243 fl6.fl6_sport = inet_sk(sk)->inet_sport; 241 fl6.fl6_sport = inet_sk(sk)->inet_sport;
244 security_req_classify_flow(req, flowi6_to_flowi(&fl6)); 242 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
245 243
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 541dfc40c7b3..db234d609b33 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -465,7 +465,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
465 struct request_sock *req, 465 struct request_sock *req,
466 u16 queue_mapping) 466 u16 queue_mapping)
467{ 467{
468 struct inet6_request_sock *treq = inet6_rsk(req); 468 struct inet_request_sock *ireq = inet_rsk(req);
469 struct ipv6_pinfo *np = inet6_sk(sk); 469 struct ipv6_pinfo *np = inet6_sk(sk);
470 struct sk_buff * skb; 470 struct sk_buff * skb;
471 int err = -ENOMEM; 471 int err = -ENOMEM;
@@ -477,9 +477,10 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
477 skb = tcp_make_synack(sk, dst, req, NULL); 477 skb = tcp_make_synack(sk, dst, req, NULL);
478 478
479 if (skb) { 479 if (skb) {
480 __tcp_v6_send_check(skb, &treq->loc_addr, &treq->rmt_addr); 480 __tcp_v6_send_check(skb, &ireq->ir_v6_loc_addr,
481 &ireq->ir_v6_rmt_addr);
481 482
482 fl6->daddr = treq->rmt_addr; 483 fl6->daddr = ireq->ir_v6_rmt_addr;
483 skb_set_queue_mapping(skb, queue_mapping); 484 skb_set_queue_mapping(skb, queue_mapping);
484 err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass); 485 err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass);
485 err = net_xmit_eval(err); 486 err = net_xmit_eval(err);
@@ -502,7 +503,7 @@ static int tcp_v6_rtx_synack(struct sock *sk, struct request_sock *req)
502 503
503static void tcp_v6_reqsk_destructor(struct request_sock *req) 504static void tcp_v6_reqsk_destructor(struct request_sock *req)
504{ 505{
505 kfree_skb(inet6_rsk(req)->pktopts); 506 kfree_skb(inet_rsk(req)->pktopts);
506} 507}
507 508
508#ifdef CONFIG_TCP_MD5SIG 509#ifdef CONFIG_TCP_MD5SIG
@@ -521,7 +522,7 @@ static struct tcp_md5sig_key *tcp_v6_md5_lookup(struct sock *sk,
521static struct tcp_md5sig_key *tcp_v6_reqsk_md5_lookup(struct sock *sk, 522static struct tcp_md5sig_key *tcp_v6_reqsk_md5_lookup(struct sock *sk,
522 struct request_sock *req) 523 struct request_sock *req)
523{ 524{
524 return tcp_v6_md5_do_lookup(sk, &inet6_rsk(req)->rmt_addr); 525 return tcp_v6_md5_do_lookup(sk, &inet_rsk(req)->ir_v6_rmt_addr);
525} 526}
526 527
527static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval, 528static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval,
@@ -623,8 +624,8 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
623 saddr = &inet6_sk(sk)->saddr; 624 saddr = &inet6_sk(sk)->saddr;
624 daddr = &sk->sk_v6_daddr; 625 daddr = &sk->sk_v6_daddr;
625 } else if (req) { 626 } else if (req) {
626 saddr = &inet6_rsk(req)->loc_addr; 627 saddr = &inet_rsk(req)->ir_v6_loc_addr;
627 daddr = &inet6_rsk(req)->rmt_addr; 628 daddr = &inet_rsk(req)->ir_v6_rmt_addr;
628 } else { 629 } else {
629 const struct ipv6hdr *ip6h = ipv6_hdr(skb); 630 const struct ipv6hdr *ip6h = ipv6_hdr(skb);
630 saddr = &ip6h->saddr; 631 saddr = &ip6h->saddr;
@@ -949,7 +950,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
949{ 950{
950 struct tcp_options_received tmp_opt; 951 struct tcp_options_received tmp_opt;
951 struct request_sock *req; 952 struct request_sock *req;
952 struct inet6_request_sock *treq; 953 struct inet_request_sock *ireq;
953 struct ipv6_pinfo *np = inet6_sk(sk); 954 struct ipv6_pinfo *np = inet6_sk(sk);
954 struct tcp_sock *tp = tcp_sk(sk); 955 struct tcp_sock *tp = tcp_sk(sk);
955 __u32 isn = TCP_SKB_CB(skb)->when; 956 __u32 isn = TCP_SKB_CB(skb)->when;
@@ -994,25 +995,25 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
994 tmp_opt.tstamp_ok = tmp_opt.saw_tstamp; 995 tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
995 tcp_openreq_init(req, &tmp_opt, skb); 996 tcp_openreq_init(req, &tmp_opt, skb);
996 997
997 treq = inet6_rsk(req); 998 ireq = inet_rsk(req);
998 treq->rmt_addr = ipv6_hdr(skb)->saddr; 999 ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
999 treq->loc_addr = ipv6_hdr(skb)->daddr; 1000 ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
1000 if (!want_cookie || tmp_opt.tstamp_ok) 1001 if (!want_cookie || tmp_opt.tstamp_ok)
1001 TCP_ECN_create_request(req, skb, sock_net(sk)); 1002 TCP_ECN_create_request(req, skb, sock_net(sk));
1002 1003
1003 treq->iif = sk->sk_bound_dev_if; 1004 ireq->ir_iif = sk->sk_bound_dev_if;
1004 1005
1005 /* So that link locals have meaning */ 1006 /* So that link locals have meaning */
1006 if (!sk->sk_bound_dev_if && 1007 if (!sk->sk_bound_dev_if &&
1007 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) 1008 ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL)
1008 treq->iif = inet6_iif(skb); 1009 ireq->ir_iif = inet6_iif(skb);
1009 1010
1010 if (!isn) { 1011 if (!isn) {
1011 if (ipv6_opt_accepted(sk, skb) || 1012 if (ipv6_opt_accepted(sk, skb) ||
1012 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || 1013 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
1013 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { 1014 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {
1014 atomic_inc(&skb->users); 1015 atomic_inc(&skb->users);
1015 treq->pktopts = skb; 1016 ireq->pktopts = skb;
1016 } 1017 }
1017 1018
1018 if (want_cookie) { 1019 if (want_cookie) {
@@ -1051,7 +1052,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1051 * to the moment of synflood. 1052 * to the moment of synflood.
1052 */ 1053 */
1053 LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open request from %pI6/%u\n", 1054 LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open request from %pI6/%u\n",
1054 &treq->rmt_addr, ntohs(tcp_hdr(skb)->source)); 1055 &ireq->ir_v6_rmt_addr, ntohs(tcp_hdr(skb)->source));
1055 goto drop_and_release; 1056 goto drop_and_release;
1056 } 1057 }
1057 1058
@@ -1086,7 +1087,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1086 struct request_sock *req, 1087 struct request_sock *req,
1087 struct dst_entry *dst) 1088 struct dst_entry *dst)
1088{ 1089{
1089 struct inet6_request_sock *treq; 1090 struct inet_request_sock *ireq;
1090 struct ipv6_pinfo *newnp, *np = inet6_sk(sk); 1091 struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
1091 struct tcp6_sock *newtcp6sk; 1092 struct tcp6_sock *newtcp6sk;
1092 struct inet_sock *newinet; 1093 struct inet_sock *newinet;
@@ -1151,7 +1152,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1151 return newsk; 1152 return newsk;
1152 } 1153 }
1153 1154
1154 treq = inet6_rsk(req); 1155 ireq = inet_rsk(req);
1155 1156
1156 if (sk_acceptq_is_full(sk)) 1157 if (sk_acceptq_is_full(sk))
1157 goto out_overflow; 1158 goto out_overflow;
@@ -1185,10 +1186,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1185 1186
1186 memcpy(newnp, np, sizeof(struct ipv6_pinfo)); 1187 memcpy(newnp, np, sizeof(struct ipv6_pinfo));
1187 1188
1188 newsk->sk_v6_daddr = treq->rmt_addr; 1189 newsk->sk_v6_daddr = ireq->ir_v6_rmt_addr;
1189 newnp->saddr = treq->loc_addr; 1190 newnp->saddr = ireq->ir_v6_loc_addr;
1190 newsk->sk_v6_rcv_saddr = treq->loc_addr; 1191 newsk->sk_v6_rcv_saddr = ireq->ir_v6_loc_addr;
1191 newsk->sk_bound_dev_if = treq->iif; 1192 newsk->sk_bound_dev_if = ireq->ir_iif;
1192 1193
1193 /* Now IPv6 options... 1194 /* Now IPv6 options...
1194 1195
@@ -1203,11 +1204,11 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1203 1204
1204 /* Clone pktoptions received with SYN */ 1205 /* Clone pktoptions received with SYN */
1205 newnp->pktoptions = NULL; 1206 newnp->pktoptions = NULL;
1206 if (treq->pktopts != NULL) { 1207 if (ireq->pktopts != NULL) {
1207 newnp->pktoptions = skb_clone(treq->pktopts, 1208 newnp->pktoptions = skb_clone(ireq->pktopts,
1208 sk_gfp_atomic(sk, GFP_ATOMIC)); 1209 sk_gfp_atomic(sk, GFP_ATOMIC));
1209 consume_skb(treq->pktopts); 1210 consume_skb(ireq->pktopts);
1210 treq->pktopts = NULL; 1211 ireq->pktopts = NULL;
1211 if (newnp->pktoptions) 1212 if (newnp->pktoptions)
1212 skb_set_owner_r(newnp->pktoptions, newsk); 1213 skb_set_owner_r(newnp->pktoptions, newsk);
1213 } 1214 }
@@ -1722,8 +1723,8 @@ static void get_openreq6(struct seq_file *seq,
1722 const struct sock *sk, struct request_sock *req, int i, kuid_t uid) 1723 const struct sock *sk, struct request_sock *req, int i, kuid_t uid)
1723{ 1724{
1724 int ttd = req->expires - jiffies; 1725 int ttd = req->expires - jiffies;
1725 const struct in6_addr *src = &inet6_rsk(req)->loc_addr; 1726 const struct in6_addr *src = &inet_rsk(req)->ir_v6_loc_addr;
1726 const struct in6_addr *dest = &inet6_rsk(req)->rmt_addr; 1727 const struct in6_addr *dest = &inet_rsk(req)->ir_v6_rmt_addr;
1727 1728
1728 if (ttd < 0) 1729 if (ttd < 0)
1729 ttd = 0; 1730 ttd = 0;
@@ -1734,10 +1735,10 @@ static void get_openreq6(struct seq_file *seq,
1734 i, 1735 i,
1735 src->s6_addr32[0], src->s6_addr32[1], 1736 src->s6_addr32[0], src->s6_addr32[1],
1736 src->s6_addr32[2], src->s6_addr32[3], 1737 src->s6_addr32[2], src->s6_addr32[3],
1737 ntohs(inet_rsk(req)->loc_port), 1738 ntohs(inet_rsk(req)->ir_loc_port),
1738 dest->s6_addr32[0], dest->s6_addr32[1], 1739 dest->s6_addr32[0], dest->s6_addr32[1],
1739 dest->s6_addr32[2], dest->s6_addr32[3], 1740 dest->s6_addr32[2], dest->s6_addr32[3],
1740 ntohs(inet_rsk(req)->rmt_port), 1741 ntohs(inet_rsk(req)->ir_rmt_port),
1741 TCP_SYN_RECV, 1742 TCP_SYN_RECV,
1742 0,0, /* could print option size, but that is af dependent. */ 1743 0,0, /* could print option size, but that is af dependent. */
1743 1, /* timers active (only the expire timer) */ 1744 1, /* timers active (only the expire timer) */
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 96a458e12f60..dce1bebf7aec 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -817,7 +817,7 @@ int netlbl_req_setattr(struct request_sock *req,
817 switch (req->rsk_ops->family) { 817 switch (req->rsk_ops->family) {
818 case AF_INET: 818 case AF_INET:
819 entry = netlbl_domhsh_getentry_af4(secattr->domain, 819 entry = netlbl_domhsh_getentry_af4(secattr->domain,
820 inet_rsk(req)->rmt_addr); 820 inet_rsk(req)->ir_rmt_addr);
821 if (entry == NULL) { 821 if (entry == NULL) {
822 ret_val = -ENOENT; 822 ret_val = -ENOENT;
823 goto req_setattr_return; 823 goto req_setattr_return;