Sync remote virtual IP for IKEv1 SAs
authorMartin Willi <martin@revosec.ch>
Fri, 20 Jan 2012 10:36:26 +0000 (11:36 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:38 +0000 (17:31 +0100)
src/libcharon/plugins/ha/ha_ike.c

index ce3131b..09899a8 100644 (file)
@@ -296,6 +296,7 @@ METHOD(listener_t, message_hook, bool,
                keymat_v1_t *keymat;
                u_int32_t mid;
                chunk_t iv;
                keymat_v1_t *keymat;
                u_int32_t mid;
                chunk_t iv;
+               host_t *vip;
 
                mid = message->get_message_id(message);
                if (mid == 0)
 
                mid = message->get_message_id(message);
                if (mid == 0)
@@ -309,6 +310,18 @@ METHOD(listener_t, message_hook, bool,
                        this->socket->push(this->socket, m);
                        this->cache->cache(this->cache, ike_sa, m);
                }
                        this->socket->push(this->socket, m);
                        this->cache->cache(this->cache, ike_sa, m);
                }
+               if (!incoming && message->get_exchange_type(message) == TRANSACTION)
+               {
+                       vip = ike_sa->get_virtual_ip(ike_sa, FALSE);
+                       if (vip)
+                       {
+                               m = ha_message_create(HA_IKE_UPDATE);
+                               m->add_attribute(m, HA_IKE_ID, ike_sa->get_id(ike_sa));
+                               m->add_attribute(m, HA_REMOTE_VIP, vip);
+                               this->socket->push(this->socket, m);
+                               this->cache->cache(this->cache, ike_sa, m);
+                       }
+               }
        }
        return TRUE;
 }
        }
        return TRUE;
 }