kernel-pfkey: Use interface to next hop for shunt policies
authorTobias Brunner <tobias@strongswan.org>
Fri, 11 Mar 2016 18:17:03 +0000 (19:17 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 10 Jun 2016 11:57:27 +0000 (13:57 +0200)
src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c

index d54a96e..82abc76 100644 (file)
@@ -2329,14 +2329,15 @@ static bool install_route(private_kernel_pfkey_ipsec_t *this,
        {       /* for shunt policies */
                route->gateway = charon->kernel->get_nexthop(charon->kernel,
                                                                                        policy->src.net, policy->src.mask,
        {       /* for shunt policies */
                route->gateway = charon->kernel->get_nexthop(charon->kernel,
                                                                                        policy->src.net, policy->src.mask,
-                                                                                       route->src_ip, NULL);
+                                                                                       route->src_ip, &route->if_name);
 
                /* we don't have a source address, use the address we found */
                src = route->src_ip;
        }
 
        /* get interface for route, using source address */
 
                /* we don't have a source address, use the address we found */
                src = route->src_ip;
        }
 
        /* get interface for route, using source address */
-       if (!charon->kernel->get_interface(charon->kernel, src, &route->if_name))
+       if (!route->if_name &&
+               !charon->kernel->get_interface(charon->kernel, src, &route->if_name))
        {
                route_entry_destroy(route);
                return FALSE;
        {
                route_entry_destroy(route);
                return FALSE;