Silently install route again, even if it did not change.
authorTobias Brunner <tobias@strongswan.org>
Fri, 4 Nov 2011 09:03:48 +0000 (10:03 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 4 Nov 2011 10:11:17 +0000 (11:11 +0100)
Address/interface changes can cause the route to disappear. Afterwards
the route might look the same but that does not mean it is still installed.

src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c

index ff7b40d..649c560 100644 (file)
@@ -2154,7 +2154,12 @@ static status_t add_policy_internal(private_kernel_netlink_ipsec_t *this,
                        {
                                route_entry_t *old = policy->route;
                                if (route_entry_equals(old, route))
-                               {       /* keep previously installed route */
+                               {       /* keep previously installed route. since it might have
+                                        * still been removed by an address change, we install it
+                                        * again but ignore the result */
+                                       hydra->kernel_interface->add_route(hydra->kernel_interface,
+                                                       route->dst_net, route->prefixlen, route->gateway,
+                                                       route->src_ip, route->if_name);
                                        this->mutex->unlock(this->mutex);
                                        route_entry_destroy(route);
                                        return SUCCESS;
index d9327fc..da10edf 100644 (file)
@@ -2016,7 +2016,12 @@ static status_t add_policy_internal(private_kernel_pfkey_ipsec_t *this,
                        {
                                route_entry_t *old = policy->route;
                                if (route_entry_equals(old, route))
-                               {       /* keep previously installed route */
+                               {       /* keep previously installed route. since it might have
+                                        * still been removed by an address change, we install it
+                                        * again but ignore the result */
+                                       hydra->kernel_interface->add_route(hydra->kernel_interface,
+                                                       route->dst_net, route->prefixlen, route->gateway,
+                                                       route->src_ip, route->if_name);
                                        this->mutex->unlock(this->mutex);
                                        route_entry_destroy(route);
                                        return SUCCESS;