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

This commit is contained in:
Tobias Brunner
2014-09-12 10:29:36 +02:00
parent 1b17f647a5
commit 7840952edc
2 changed files with 7 additions and 3 deletions
+5 -2
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); 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) private_ike_mobike_t *this, packet_t *packet)
{ {
host_t *me, *other, *me_old, *other_old; host_t *me, *other, *me_old, *other_old;
@@ -314,10 +314,11 @@ METHOD(ike_mobike_t, transmit, void,
ike_cfg_t *ike_cfg; ike_cfg_t *ike_cfg;
packet_t *copy; packet_t *copy;
int family = AF_UNSPEC; int family = AF_UNSPEC;
bool found = FALSE;
if (!this->check) if (!this->check)
{ {
return; return TRUE;
} }
switch (charon->socket->supported_families(charon->socket)) switch (charon->socket->supported_families(charon->socket))
@@ -357,9 +358,11 @@ METHOD(ike_mobike_t, transmit, void,
copy->set_source(copy, me); copy->set_source(copy, me);
copy->set_destination(copy, other); copy->set_destination(copy, other);
charon->sender->send(charon->sender, copy); charon->sender->send(charon->sender, copy);
found = TRUE;
} }
} }
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
return found;
} }
METHOD(task_t, build_i, status_t, METHOD(task_t, build_i, status_t,
+2 -1
View File
@@ -70,8 +70,9 @@ struct ike_mobike_t {
* probing. * probing.
* *
* @param packet the packet to transmit * @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. * Check if this task is probing for routability.