diff options
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index fe32255a9808..c7cda1ca8e65 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -344,16 +344,17 @@ struct dst_entry *inet_csk_route_req(struct sock *sk, | |||
344 | struct net *net = sock_net(sk); | 344 | struct net *net = sock_net(sk); |
345 | 345 | ||
346 | security_req_classify_flow(req, &fl); | 346 | security_req_classify_flow(req, &fl); |
347 | if (ip_route_output_flow(net, &rt, &fl, sk, 0)) { | 347 | if (ip_route_output_flow(net, &rt, &fl, sk, 0)) |
348 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); | 348 | goto no_route; |
349 | return NULL; | 349 | if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) |
350 | } | 350 | goto route_err; |
351 | if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) { | ||
352 | ip_rt_put(rt); | ||
353 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); | ||
354 | return NULL; | ||
355 | } | ||
356 | return &rt->u.dst; | 351 | return &rt->u.dst; |
352 | |||
353 | route_err: | ||
354 | ip_rt_put(rt); | ||
355 | no_route: | ||
356 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); | ||
357 | return NULL; | ||
357 | } | 358 | } |
358 | 359 | ||
359 | EXPORT_SYMBOL_GPL(inet_csk_route_req); | 360 | EXPORT_SYMBOL_GPL(inet_csk_route_req); |