diff options
author | Tobias Brunner <tobias@strongswan.org> | 2016-11-09 10:18:01 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2017-02-16 19:21:12 +0100 |
commit | 71fa1224ec9b227d4aa8f1350d132380af00e786 (patch) | |
tree | 1cdbc45dd75f740f7b7b2b341c39d4a7c5e9f855 /src/libcharon | |
parent | c2129d1cbe6b482cf956a1f609ff974c9dcd5b24 (diff) | |
download | strongswan-71fa1224ec9b227d4aa8f1350d132380af00e786.tar.bz2 strongswan-71fa1224ec9b227d4aa8f1350d132380af00e786.tar.xz |
vici: Add option to query a specific pool
Diffstat (limited to 'src/libcharon')
-rw-r--r-- | src/libcharon/plugins/vici/README.md | 1 | ||||
-rw-r--r-- | src/libcharon/plugins/vici/vici_attribute.c | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/libcharon/plugins/vici/README.md b/src/libcharon/plugins/vici/README.md index 4e53d7cc9..be0eff5c5 100644 --- a/src/libcharon/plugins/vici/README.md +++ b/src/libcharon/plugins/vici/README.md @@ -569,6 +569,7 @@ List the currently loaded pools. { leases = <set to yes to include leases> + name = <optional name of the pool to query> } => { <pool name>* = { base = <virtual IP pool base address> diff --git a/src/libcharon/plugins/vici/vici_attribute.c b/src/libcharon/plugins/vici/vici_attribute.c index e0d9b4ae8..4e1fa9708 100644 --- a/src/libcharon/plugins/vici/vici_attribute.c +++ b/src/libcharon/plugins/vici/vici_attribute.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 2014-2015 Tobias Brunner - * Hochschule fuer Technik Rapperswil + * Copyright (C) 2014-2016 Tobias Brunner + * HSR Hochschule fuer Technik Rapperswil * * Copyright (C) 2014 Martin Willi * Copyright (C) 2014 revosec AG @@ -668,10 +668,11 @@ CALLBACK(get_pools, vici_message_t*, identification_t *uid; host_t *lease; bool list_leases, on; - char buf[32]; + char buf[32], *filter; int i; list_leases = message->get_bool(message, FALSE, "leases"); + filter = message->get_str(message, NULL, "name"); builder = vici_builder_create(); @@ -679,6 +680,11 @@ CALLBACK(get_pools, vici_message_t*, enumerator = this->pools->create_enumerator(this->pools); while (enumerator->enumerate(enumerator, &name, &pool)) { + if (filter && !streq(name, filter)) + { + continue; + } + vips = pool->vips; builder->begin_section(builder, name); |