do not install route if interface lookup failed

This commit is contained in:
Martin Willi
2008-11-05 07:38:55 +00:00
parent 746115a0be
commit 31537fd970
@@ -1506,8 +1506,11 @@ static status_t add_policy(private_kernel_netlink_ipsec_t *this,
memcpy(route->dst_net.ptr, &policy->sel.saddr, route->dst_net.len);
route->prefixlen = policy->sel.prefixlen_s;
switch (charon->kernel_interface->add_route(charon->kernel_interface,
route->dst_net, route->prefixlen, route->gateway,
if (route->if_name)
{
switch (charon->kernel_interface->add_route(
charon->kernel_interface, route->dst_net,
route->prefixlen, route->gateway,
route->src_ip, route->if_name))
{
default:
@@ -1525,11 +1528,15 @@ static status_t add_policy(private_kernel_netlink_ipsec_t *this,
}
}
else
{
route_entry_destroy(route);
}
}
else
{
free(route);
}
}
return SUCCESS;
}