[strongSwan-dev] Add Initial-contact alerts

Guillaume DEBROS guillaume.debros at stormshield.eu
Wed Jul 29 16:39:29 CEST 2015


Hello,

I had to call hook when initial contact was sent or received : adding new alerts has been adopted 

(on 5.2.2)

diff --git a/src/libcharon/bus/bus.h b/src/libcharon/bus/bus.h
index e1d221c..586347b 100644
--- a/src/libcharon/bus/bus.h
+++ b/src/libcharon/bus/bus.h
@@ -152,6 +152,10 @@ enum alert_t {
        ALERT_CERT_EXCEEDED_PATH_LEN,
        /** Certificate rejected; other policy violation, certificate_t */
        ALERT_CERT_POLICY_VIOLATION,
+       /** Initial contact received, no argument */
+       ALERT_INITIAL_CONTACT_RECEIVED,
+       /** Initial contact sent, no argument */
+       ALERT_INITIAL_CONTACT_SENT,
 };
 
 /**
diff --git a/src/libcharon/sa/ikev2/tasks/ike_auth.c b/src/libcharon/sa/ikev2/tasks/ike_auth.c
index bf747a4..914bf9d 100644
--- a/src/libcharon/sa/ikev2/tasks/ike_auth.c
+++ b/src/libcharon/sa/ikev2/tasks/ike_auth.c
@@ -466,6 +466,7 @@ METHOD(task_t, build_i, status_t,
                                                                                        idi, idr, host->get_family(host)))
                        {
                                message->add_notify(message, FALSE, INITIAL_CONTACT, chunk_empty);
+                               charon->bus->alert(charon->bus, ALERT_INITIAL_CONTACT_SENT);
                        }
                }
 
@@ -647,6 +648,7 @@ METHOD(task_t, process_r, status_t,
                message->get_notify(message, INITIAL_CONTACT))
        {
                this->initial_contact = TRUE;
+               charon->bus->alert(charon->bus, ALERT_INITIAL_CONTACT_RECEIVED);
        }
 
        /* another auth round done, invoke authorize hook */


Regards, 

Guillaume



More information about the Dev mailing list