diff options
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index a12b973164d0..711ab143d4cb 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -403,18 +403,17 @@ struct dst_entry *inet_csk_route_req(struct sock *sk, | |||
403 | struct flowi4 *fl4, | 403 | struct flowi4 *fl4, |
404 | const struct request_sock *req) | 404 | const struct request_sock *req) |
405 | { | 405 | { |
406 | struct rtable *rt; | ||
407 | const struct inet_request_sock *ireq = inet_rsk(req); | 406 | const struct inet_request_sock *ireq = inet_rsk(req); |
408 | struct ip_options_rcu *opt = inet_rsk(req)->opt; | 407 | struct net *net = read_pnet(&ireq->ireq_net); |
409 | struct net *net = sock_net(sk); | 408 | struct ip_options_rcu *opt = ireq->opt; |
410 | int flags = inet_sk_flowi_flags(sk); | 409 | struct rtable *rt; |
411 | 410 | ||
412 | flowi4_init_output(fl4, sk->sk_bound_dev_if, ireq->ir_mark, | 411 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
413 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 412 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
414 | sk->sk_protocol, | 413 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
415 | flags, | ||
416 | (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr, | 414 | (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr, |
417 | ireq->ir_loc_addr, ireq->ir_rmt_port, inet_sk(sk)->inet_sport); | 415 | ireq->ir_loc_addr, ireq->ir_rmt_port, |
416 | htons(ireq->ir_num)); | ||
418 | security_req_classify_flow(req, flowi4_to_flowi(fl4)); | 417 | security_req_classify_flow(req, flowi4_to_flowi(fl4)); |
419 | rt = ip_route_output_flow(net, fl4, sk); | 418 | rt = ip_route_output_flow(net, fl4, sk); |
420 | if (IS_ERR(rt)) | 419 | if (IS_ERR(rt)) |
@@ -436,9 +435,9 @@ struct dst_entry *inet_csk_route_child_sock(struct sock *sk, | |||
436 | const struct request_sock *req) | 435 | const struct request_sock *req) |
437 | { | 436 | { |
438 | const struct inet_request_sock *ireq = inet_rsk(req); | 437 | const struct inet_request_sock *ireq = inet_rsk(req); |
438 | struct net *net = read_pnet(&ireq->ireq_net); | ||
439 | struct inet_sock *newinet = inet_sk(newsk); | 439 | struct inet_sock *newinet = inet_sk(newsk); |
440 | struct ip_options_rcu *opt; | 440 | struct ip_options_rcu *opt; |
441 | struct net *net = sock_net(sk); | ||
442 | struct flowi4 *fl4; | 441 | struct flowi4 *fl4; |
443 | struct rtable *rt; | 442 | struct rtable *rt; |
444 | 443 | ||
@@ -446,11 +445,12 @@ struct dst_entry *inet_csk_route_child_sock(struct sock *sk, | |||
446 | 445 | ||
447 | rcu_read_lock(); | 446 | rcu_read_lock(); |
448 | opt = rcu_dereference(newinet->inet_opt); | 447 | opt = rcu_dereference(newinet->inet_opt); |
449 | flowi4_init_output(fl4, sk->sk_bound_dev_if, inet_rsk(req)->ir_mark, | 448 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
450 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 449 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
451 | sk->sk_protocol, inet_sk_flowi_flags(sk), | 450 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
452 | (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr, | 451 | (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr, |
453 | ireq->ir_loc_addr, ireq->ir_rmt_port, inet_sk(sk)->inet_sport); | 452 | ireq->ir_loc_addr, ireq->ir_rmt_port, |
453 | htons(ireq->ir_num)); | ||
454 | security_req_classify_flow(req, flowi4_to_flowi(fl4)); | 454 | security_req_classify_flow(req, flowi4_to_flowi(fl4)); |
455 | rt = ip_route_output_flow(net, fl4, sk); | 455 | rt = ip_route_output_flow(net, fl4, sk); |
456 | if (IS_ERR(rt)) | 456 | if (IS_ERR(rt)) |