From: Tobias Brunner Date: Mon, 18 Mar 2013 18:11:10 +0000 (+0100) Subject: Use proper address family when adding multiple addresses to SQL pool X-Git-Tag: 5.0.3rc1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ac772a5d089b80e61b93066e9052eee69d11bc2;p=thirdparty%2Fstrongswan.git Use proper address family when adding multiple addresses to SQL pool --- diff --git a/src/libhydra/plugins/attr_sql/pool.c b/src/libhydra/plugins/attr_sql/pool.c index f355e96e23..880af61dc6 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);