ike-mobike: Return FALSE in transmit() if no path was available

This commit is contained in:
Tobias Brunner 2014-07-28 13:12:09 +02:00
parent 1b17f647a5
commit 7840952edc
2 changed files with 7 additions and 3 deletions

View File

@ -306,7 +306,7 @@ static void apply_port(host_t *host, host_t *old, u_int16_t port, bool local)
host->set_port(host, port);
}
METHOD(ike_mobike_t, transmit, void,
METHOD(ike_mobike_t, transmit, bool,
private_ike_mobike_t *this, packet_t *packet)
{
host_t *me, *other, *me_old, *other_old;
@ -314,10 +314,11 @@ METHOD(ike_mobike_t, transmit, void,
ike_cfg_t *ike_cfg;
packet_t *copy;
int family = AF_UNSPEC;
bool found = FALSE;
if (!this->check)
{
return;
return TRUE;
}
switch (charon->socket->supported_families(charon->socket))
@ -357,9 +358,11 @@ METHOD(ike_mobike_t, transmit, void,
copy->set_source(copy, me);
copy->set_destination(copy, other);
charon->sender->send(charon->sender, copy);
found = TRUE;
}
}
enumerator->destroy(enumerator);
return found;
}
METHOD(task_t, build_i, status_t,

View File

@ -70,8 +70,9 @@ struct ike_mobike_t {
* probing.
*
* @param packet the packet to transmit
* @return TRUE if transmitted, FALSE if no path found
*/
void (*transmit)(ike_mobike_t *this, packet_t *packet);
bool (*transmit)(ike_mobike_t *this, packet_t *packet);
/**
* Check if this task is probing for routability.