diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-03-18 19:11:10 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-03-19 16:33:07 +0100 |
commit | 2ac772a5d089b80e61b93066e9052eee69d11bc2 (patch) | |
tree | 1c502ae89b288d5c775732d478aa66a4613c65a4 /src | |
parent | fe62707209d93b80be83e6c002509b3269fbebe2 (diff) | |
download | strongswan-2ac772a5d089b80e61b93066e9052eee69d11bc2.tar.bz2 strongswan-2ac772a5d089b80e61b93066e9052eee69d11bc2.tar.xz |
Use proper address family when adding multiple addresses to SQL pool
Diffstat (limited to 'src')
-rw-r--r-- | src/libhydra/plugins/attr_sql/pool.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libhydra/plugins/attr_sql/pool.c b/src/libhydra/plugins/attr_sql/pool.c index f355e96e2..880af61dc 100644 --- a/src/libhydra/plugins/attr_sql/pool.c +++ b/src/libhydra/plugins/attr_sql/pool.c @@ -495,6 +495,21 @@ static void add_addresses(char *pool, char *path, int timeout) fclose(file); } + if (family == AF_INET6) + { /* update address family if necessary */ + addr = host_create_from_string("%any6", 0); + if (db->execute(db, NULL, + "UPDATE pools SET start = ?, end = ? WHERE id = ?", + DB_BLOB, addr->get_address(addr), + DB_BLOB, addr->get_address(addr), DB_UINT, pool_id) <= 0) + { + addr->destroy(addr); + fprintf(stderr, "updating pool address family failed.\n"); + exit(EXIT_FAILURE); + } + addr->destroy(addr); + } + commit_transaction(); printf("%d addresses done.\n", count); |