aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/sql
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2010-12-05 11:21:40 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2010-12-05 11:21:40 +0100
commit2da636fd9bb76a0fed94ee291315b26c82481918 (patch)
tree870c41078bd6cf41a24cdec76344d1d6af73d6e7 /src/libcharon/plugins/sql
parente150442bede467e7b23cd43cccff2542ce079673 (diff)
downloadstrongswan-2da636fd9bb76a0fed94ee291315b26c82481918.tar.bz2
strongswan-2da636fd9bb76a0fed94ee291315b26c82481918.tar.xz
support of reqid field in SQL database
Diffstat (limited to 'src/libcharon/plugins/sql')
-rw-r--r--src/libcharon/plugins/sql/mysql.sql1
-rw-r--r--src/libcharon/plugins/sql/sql_config.c13
-rw-r--r--src/libcharon/plugins/sql/sqlite.sql1
3 files changed, 9 insertions, 6 deletions
diff --git a/src/libcharon/plugins/sql/mysql.sql b/src/libcharon/plugins/sql/mysql.sql
index a09cbeaa7..721e5a2a8 100644
--- a/src/libcharon/plugins/sql/mysql.sql
+++ b/src/libcharon/plugins/sql/mysql.sql
@@ -24,6 +24,7 @@ CREATE TABLE `child_configs` (
`dpd_action` tinyint(4) unsigned NOT NULL default '0',
`close_action` tinyint(4) unsigned NOT NULL default '0',
`ipcomp` tinyint(4) unsigned NOT NULL default '0',
+ `reqid` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
INDEX (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
diff --git a/src/libcharon/plugins/sql/sql_config.c b/src/libcharon/plugins/sql/sql_config.c
index a4e718fbe..9de3daa9c 100644
--- a/src/libcharon/plugins/sql/sql_config.c
+++ b/src/libcharon/plugins/sql/sql_config.c
@@ -161,19 +161,20 @@ static void add_esp_proposals(private_sql_config_t *this,
*/
static child_cfg_t *build_child_cfg(private_sql_config_t *this, enumerator_t *e)
{
- int id, lifetime, rekeytime, jitter, hostaccess, mode, ipcomp;
+ int id, lifetime, rekeytime, jitter, hostaccess, mode, ipcomp, reqid;
int start, dpd, close;
char *name, *updown;
child_cfg_t *child_cfg;
if (e->enumerate(e, &id, &name, &lifetime, &rekeytime, &jitter, &updown,
- &hostaccess, &mode, &start, &dpd, &close, &ipcomp))
+ &hostaccess, &mode, &start, &dpd, &close, &ipcomp, %reqid))
{
lifetime_cfg_t lft = {
.time = { .life = lifetime, .rekey = rekeytime, .jitter = jitter }
};
child_cfg = child_cfg_create(name, &lft, updown, hostaccess, mode,
- start, dpd, close, ipcomp, 0, 0, NULL, NULL);
+ start, dpd, close, ipcomp, 0, reqid,
+ NULL, NULL);
add_esp_proposals(this, child_cfg, id);
add_traffic_selectors(this, child_cfg, id);
return child_cfg;
@@ -190,12 +191,12 @@ static void add_child_cfgs(private_sql_config_t *this, peer_cfg_t *peer, int id)
child_cfg_t *child_cfg;
e = this->db->query(this->db,
- "SELECT id, name, lifetime, rekeytime, jitter, updown, "
- "hostaccess, mode, start_action, dpd_action, close_action, ipcomp "
+ "SELECT id, name, lifetime, rekeytime, jitter, updown, hostaccess, "
+ "mode, start_action, dpd_action, close_action, ipcomp, reqid "
"FROM child_configs JOIN peer_config_child_config ON id = child_cfg "
"WHERE peer_cfg = ?",
DB_INT, id,
- DB_INT, DB_TEXT, DB_INT, DB_INT, DB_INT, DB_TEXT,
+ DB_INT, DB_TEXT, DB_INT, DB_INT, DB_INT, DB_TEXT, DB_INT,
DB_INT, DB_INT, DB_INT, DB_INT, DB_INT, DB_INT);
if (e)
{
diff --git a/src/libcharon/plugins/sql/sqlite.sql b/src/libcharon/plugins/sql/sqlite.sql
index 2cb0c23cf..3d106351d 100644
--- a/src/libcharon/plugins/sql/sqlite.sql
+++ b/src/libcharon/plugins/sql/sqlite.sql
@@ -23,6 +23,7 @@ CREATE TABLE child_configs (
dpd_action INTEGER NOT NULL DEFAULT '0',
close_action INTEGER NOT NULL DEFAULT '0',
ipcomp INTEGER NOT NULL DEFAULT '0'
+ reqid INTEGER NOT NULL DEFAULT '0'
);
DROP INDEX IF EXISTS child_configs_name;
CREATE INDEX child_configs_name ON child_configs (