fixed mobike address update from and to NAT
This commit is contained in:
+14
-33
@@ -785,20 +785,11 @@ static status_t update_hosts(private_child_sa_t *this,
|
|||||||
updown(this, FALSE);
|
updown(this, FALSE);
|
||||||
|
|
||||||
/* update our (initator) SAs */
|
/* update our (initator) SAs */
|
||||||
if (charon->kernel_interface->update_sa(
|
charon->kernel_interface->update_sa(charon->kernel_interface, this->me.spi,
|
||||||
charon->kernel_interface, this->me.spi, this->protocol,
|
this->protocol, this->other.addr, this->me.addr, other, me);
|
||||||
this->other.addr, this->me.addr, other, me) != SUCCESS)
|
|
||||||
{
|
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update his (responder) SAs */
|
/* update his (responder) SAs */
|
||||||
if (charon->kernel_interface->update_sa(
|
charon->kernel_interface->update_sa(charon->kernel_interface, this->other.spi,
|
||||||
charon->kernel_interface, this->other.spi, this->protocol,
|
this->protocol, this->me.addr, this->other.addr, me, other);
|
||||||
this->me.addr, this->other.addr, me, other) != SUCCESS)
|
|
||||||
{
|
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update policies */
|
/* update policies */
|
||||||
if (!me->ip_equals(me, this->me.addr) ||
|
if (!me->ip_equals(me, this->me.addr) ||
|
||||||
@@ -806,7 +797,6 @@ static status_t update_hosts(private_child_sa_t *this,
|
|||||||
{
|
{
|
||||||
iterator_t *iterator;
|
iterator_t *iterator;
|
||||||
sa_policy_t *policy;
|
sa_policy_t *policy;
|
||||||
status_t status;
|
|
||||||
|
|
||||||
/* always use high priorities, as hosts getting updated are INSTALLED */
|
/* always use high priorities, as hosts getting updated are INSTALLED */
|
||||||
iterator = this->policies->create_iterator(this->policies, TRUE);
|
iterator = this->policies->create_iterator(this->policies, TRUE);
|
||||||
@@ -833,24 +823,15 @@ static status_t update_hosts(private_child_sa_t *this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reinstall updated policies */
|
/* reinstall updated policies */
|
||||||
status = charon->kernel_interface->add_policy(
|
charon->kernel_interface->add_policy(charon->kernel_interface,
|
||||||
charon->kernel_interface, me, other,
|
me, other, policy->my_ts, policy->other_ts, POLICY_OUT,
|
||||||
policy->my_ts, policy->other_ts, POLICY_OUT,
|
this->protocol, this->reqid, TRUE, this->mode);
|
||||||
this->protocol, this->reqid, TRUE, this->mode);
|
charon->kernel_interface->add_policy(charon->kernel_interface,
|
||||||
status |= charon->kernel_interface->add_policy(
|
other, me, policy->other_ts, policy->my_ts, POLICY_IN,
|
||||||
charon->kernel_interface, other, me,
|
this->protocol, this->reqid, TRUE, this->mode);
|
||||||
policy->other_ts, policy->my_ts, POLICY_IN,
|
charon->kernel_interface->add_policy(charon->kernel_interface,
|
||||||
this->protocol, this->reqid, TRUE, this->mode);
|
other, me, policy->other_ts, policy->my_ts, POLICY_FWD,
|
||||||
status |= charon->kernel_interface->add_policy(
|
this->protocol, this->reqid, TRUE, this->mode);
|
||||||
charon->kernel_interface, other, me,
|
|
||||||
policy->other_ts, policy->my_ts, POLICY_FWD,
|
|
||||||
this->protocol, this->reqid, TRUE, this->mode);
|
|
||||||
|
|
||||||
if (status != SUCCESS)
|
|
||||||
{
|
|
||||||
iterator->destroy(iterator);
|
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
iterator->destroy(iterator);
|
iterator->destroy(iterator);
|
||||||
}
|
}
|
||||||
@@ -861,7 +842,7 @@ static status_t update_hosts(private_child_sa_t *this,
|
|||||||
this->me.addr->destroy(this->me.addr);
|
this->me.addr->destroy(this->me.addr);
|
||||||
this->me.addr = me->clone(me);
|
this->me.addr = me->clone(me);
|
||||||
}
|
}
|
||||||
if (other->equals(other, this->other.addr))
|
if (!other->equals(other, this->other.addr))
|
||||||
{
|
{
|
||||||
this->other.addr->destroy(this->other.addr);
|
this->other.addr->destroy(this->other.addr);
|
||||||
this->other.addr = other->clone(other);
|
this->other.addr = other->clone(other);
|
||||||
|
|||||||
@@ -393,6 +393,11 @@ static void send_keepalive(private_ike_sa_t *this)
|
|||||||
send_keepalive_job_t *job;
|
send_keepalive_job_t *job;
|
||||||
time_t last_out, now, diff;
|
time_t last_out, now, diff;
|
||||||
|
|
||||||
|
if (!(this->conditions & COND_NAT_HERE))
|
||||||
|
{ /* disable keep alives if we are not NATed anymore */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
last_out = get_use_time(this, FALSE);
|
last_out = get_use_time(this, FALSE);
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
|
|
||||||
@@ -410,8 +415,8 @@ static void send_keepalive(private_ike_sa_t *this)
|
|||||||
data.ptr[0] = 0xFF;
|
data.ptr[0] = 0xFF;
|
||||||
data.len = 1;
|
data.len = 1;
|
||||||
packet->set_data(packet, data);
|
packet->set_data(packet, data);
|
||||||
charon->sender->send(charon->sender, packet);
|
|
||||||
DBG1(DBG_IKE, "sending keep alive");
|
DBG1(DBG_IKE, "sending keep alive");
|
||||||
|
charon->sender->send(charon->sender, packet);
|
||||||
diff = 0;
|
diff = 0;
|
||||||
}
|
}
|
||||||
job = send_keepalive_job_create(this->ike_sa_id);
|
job = send_keepalive_job_create(this->ike_sa_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user