ike-mobike: Return FALSE in transmit() if no path was available
authorTobias Brunner <tobias@strongswan.org>
Mon, 28 Jul 2014 11:12:09 +0000 (13:12 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 12 Sep 2014 08:29:36 +0000 (10:29 +0200)
src/libcharon/sa/ikev2/tasks/ike_mobike.c
src/libcharon/sa/ikev2/tasks/ike_mobike.h

index 7d26de1..6567901 100644 (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,
index 2946f5e..bb2318c 100644 (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.