adding new virtual ip before deleting old one to keep IP on reauthentication

This commit is contained in:
Martin Willi
2007-10-25 07:50:23 +00:00
parent bd99d1852a
commit 00fb758755
+5 -5
View File
@@ -680,18 +680,18 @@ static void reset(private_ike_sa_t *this)
static void set_virtual_ip(private_ike_sa_t *this, bool local, host_t *ip) static void set_virtual_ip(private_ike_sa_t *this, bool local, host_t *ip)
{ {
if (local) if (local)
{
DBG1(DBG_IKE, "installing new virtual IP %H", ip);
if (charon->kernel_interface->add_ip(charon->kernel_interface, ip,
this->my_host) == SUCCESS)
{ {
if (this->my_virtual_ip) if (this->my_virtual_ip)
{ {
DBG1(DBG_IKE, "removing old virtual IP %H", this->my_virtual_ip); DBG1(DBG_IKE, "removing old virtual IP %H", this->my_virtual_ip);
charon->kernel_interface->del_ip(charon->kernel_interface, charon->kernel_interface->del_ip(charon->kernel_interface,
this->my_virtual_ip); this->my_virtual_ip);
this->my_virtual_ip->destroy(this->my_virtual_ip);
} }
DBG1(DBG_IKE, "installing new virtual IP %H", ip); DESTROY_IF(this->my_virtual_ip);
if (charon->kernel_interface->add_ip(charon->kernel_interface, ip,
this->my_host) == SUCCESS)
{
this->my_virtual_ip = ip->clone(ip); this->my_virtual_ip = ip->clone(ip);
} }
else else