diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/tcp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 0d486f654..1bb6eaad1 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3528,16 +3528,24 @@ void __init tcp_init(void) static int tcp_is_local(struct net *net, __be32 addr) { struct rtable *rt; struct flowi4 fl4 = { .daddr = addr }; + int is_local; rt = ip_route_output_key(net, &fl4); if (IS_ERR_OR_NULL(rt)) return 0; - return rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK); + + is_local = rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK); + ip_rt_put(rt); + return is_local; } #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) static int tcp_is_local6(struct net *net, struct in6_addr *addr) { struct rt6_info *rt6 = rt6_lookup(net, addr, addr, 0, 0); - return rt6 && rt6->dst.dev && (rt6->dst.dev->flags & IFF_LOOPBACK); + int is_local; + + is_local = rt6 && rt6->dst.dev && (rt6->dst.dev->flags & IFF_LOOPBACK); + ip6_rt_put(rt6); + return is_local; } #endif |
