]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Add a load-tester initiator_match option to match custom initiator_id
authorMartin Willi <martin@revosec.ch>
Mon, 1 Oct 2012 13:14:35 +0000 (15:14 +0200)
committerMartin Willi <martin@revosec.ch>
Tue, 16 Oct 2012 11:43:54 +0000 (13:43 +0200)
src/libcharon/plugins/load_tester/load_tester_config.c

index 735f17985fab865dcdcd5ebeae4baf703e29f560..db8d844e9b8f8d0665675fc17ef2f7d8975f8f82 100644 (file)
@@ -74,6 +74,11 @@ struct private_load_tester_config_t {
         */
        char *initiator_id;
 
+       /**
+        * Initiator ID to to match against as responder
+        */
+       char *initiator_match;
+
        /**
         * Responder ID to enforce
         */
@@ -133,8 +138,14 @@ static void generate_auth_cfg(private_load_tester_config_t *this, char *str,
 
                if (this->initiator_id)
                {
-                       if ((local && num) || (!local && !num))
-                       {
+                       if (this->initiator_match && (!local && !num))
+                       {       /* as responder, use the secified identity that matches
+                                * all used initiator identities, if given. */
+                               snprintf(buf, sizeof(buf), this->initiator_match, rnd);
+                               id = identification_create_from_string(buf);
+                       }
+                       else if ((local && num) || (!local && !num))
+                       {       /* as initiator, create peer specific identities */
                                snprintf(buf, sizeof(buf), this->initiator_id, num, rnd);
                                id = identification_create_from_string(buf);
                        }
@@ -391,6 +402,8 @@ load_tester_config_t *load_tester_config_create()
                        "%s.plugins.load-tester.responder_auth", "pubkey", charon->name);
        this->initiator_id = lib->settings->get_str(lib->settings,
                        "%s.plugins.load-tester.initiator_id", NULL, charon->name);
+       this->initiator_match = lib->settings->get_str(lib->settings,
+                       "%s.plugins.load-tester.initiator_match", NULL, charon->name);
        this->responder_id = lib->settings->get_str(lib->settings,
                        "%s.plugins.load-tester.responder_id", NULL, charon->name);