aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/plugins/load_tester
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-02-26 10:21:01 +0000
committerMartin Willi <martin@revosec.ch>2010-02-26 11:44:34 +0100
commitf16ca9e89c5e6f694c14fbaf9a84c4eaf67778f9 (patch)
tree20f8c561814094b5eb283ada1bfe1bdce273e63a /src/charon/plugins/load_tester
parent347488bd6764c7bbb022287f70734df7c70cabe2 (diff)
downloadstrongswan-f16ca9e89c5e6f694c14fbaf9a84c4eaf67778f9.tar.bz2
strongswan-f16ca9e89c5e6f694c14fbaf9a84c4eaf67778f9.tar.xz
Add support for dynamic ports in load tester
Diffstat (limited to 'src/charon/plugins/load_tester')
-rw-r--r--src/charon/plugins/load_tester/load_tester_config.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/charon/plugins/load_tester/load_tester_config.c b/src/charon/plugins/load_tester/load_tester_config.c
index bb9eabf47..c1f98f2fe 100644
--- a/src/charon/plugins/load_tester/load_tester_config.c
+++ b/src/charon/plugins/load_tester/load_tester_config.c
@@ -78,6 +78,11 @@ struct private_load_tester_config_t {
* incremental numbering of generated configs
*/
u_int num;
+
+ /**
+ * Dynamic source port, if used
+ */
+ u_int16_t port;
};
/**
@@ -189,8 +194,16 @@ static peer_cfg_t* generate_config(private_load_tester_config_t *this, uint num)
}
};
- ike_cfg = ike_cfg_create(FALSE, FALSE,
- "0.0.0.0", IKEV2_UDP_PORT, this->remote, IKEV2_UDP_PORT);
+ if (this->port && num)
+ {
+ ike_cfg = ike_cfg_create(FALSE, FALSE,
+ "0.0.0.0", this->port + num - 1, this->remote, IKEV2_NATT_PORT);
+ }
+ else
+ {
+ ike_cfg = ike_cfg_create(FALSE, FALSE,
+ "0.0.0.0", IKEV2_UDP_PORT, this->remote, IKEV2_UDP_PORT);
+ }
ike_cfg->add_proposal(ike_cfg, this->proposal->clone(this->proposal));
peer_cfg = peer_cfg_create("load-test", 2, ike_cfg,
CERT_SEND_IF_ASKED, UNIQUE_NO, 1, /* keytries */
@@ -309,6 +322,9 @@ load_tester_config_t *load_tester_config_create()
this->responder_auth = lib->settings->get_str(lib->settings,
"charon.plugins.load-tester.responder_auth", "pubkey");
+ this->port = lib->settings->get_int(lib->settings,
+ "charon.plugins.load-tester.dynamic_port", 0);
+
this->num = 1;
this->peer_cfg = generate_config(this, 0);