Support RADIUS accounting when using IKEv1 with xauth-eap and eap-radius
authorMartin Willi <martin@revosec.ch>
Tue, 11 Sep 2012 13:21:25 +0000 (15:21 +0200)
committerMartin Willi <martin@revosec.ch>
Tue, 11 Sep 2012 13:22:22 +0000 (15:22 +0200)
src/libcharon/plugins/eap_radius/eap_radius_accounting.c

index 33449d5..2d9a755 100644 (file)
@@ -285,10 +285,18 @@ METHOD(listener_t, message_hook, bool,
 {
        /* start accounting here, virtual IP now is set */
        if (plain && ike_sa->get_state(ike_sa) == IKE_ESTABLISHED &&
-               message->get_exchange_type(message) == IKE_AUTH &&
                !incoming && !message->get_request(message))
        {
-               send_start(this, ike_sa);
+               if (ike_sa->get_version(ike_sa) == IKEV1 &&
+                       message->get_exchange_type(message) == TRANSACTION)
+               {
+                       send_start(this, ike_sa);
+               }
+               if (ike_sa->get_version(ike_sa) == IKEV2 &&
+                       message->get_exchange_type(message) == IKE_AUTH)
+               {
+                       send_start(this, ike_sa);
+               }
        }
        return TRUE;
 }