mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-15 00:00:16 -04:00
show in-memory pools in ipsec statusall
This commit is contained in:
parent
b1701d097c
commit
ec96692c38
@ -40,7 +40,8 @@
|
|||||||
#include "connections.h"
|
#include "connections.h"
|
||||||
#include "myid.h"
|
#include "myid.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "whack.h" /* needs connections.h */
|
#include "whack.h"
|
||||||
|
#include "whack_attribute.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
/* close one per-peer log */
|
/* close one per-peer log */
|
||||||
@ -856,6 +857,7 @@ void show_status(bool all, const char *name)
|
|||||||
show_myid_status();
|
show_myid_status();
|
||||||
show_loaded_plugins();
|
show_loaded_plugins();
|
||||||
show_debug_status();
|
show_debug_status();
|
||||||
|
show_pools(name);
|
||||||
whack_log(RC_COMMENT, BLANK_FORMAT); /* spacer */
|
whack_log(RC_COMMENT, BLANK_FORMAT); /* spacer */
|
||||||
}
|
}
|
||||||
show_connections_status(all, name);
|
show_connections_status(all, name);
|
||||||
|
@ -332,3 +332,29 @@ void list_leases(char *name, char *addr, char *id)
|
|||||||
DESTROY_IF(address);
|
DESTROY_IF(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* see header file
|
||||||
|
*/
|
||||||
|
void show_pools(const char *name)
|
||||||
|
{
|
||||||
|
enumerator_t *enumerator;
|
||||||
|
u_int size, online, offline;
|
||||||
|
char *pool;
|
||||||
|
bool first = TRUE;
|
||||||
|
|
||||||
|
enumerator = whack_attr->create_pool_enumerator(whack_attr);
|
||||||
|
while (enumerator->enumerate(enumerator, &pool, &size, &online, &offline))
|
||||||
|
{
|
||||||
|
if (name && !streq(name, pool))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
first = FALSE;
|
||||||
|
whack_log(RC_COMMENT, "Virtual IP pools (size/online/offline):");
|
||||||
|
}
|
||||||
|
whack_log(RC_COMMENT, "\"%s\": %u/%u/%u", pool, size, online, offline);
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
}
|
||||||
|
@ -101,4 +101,11 @@ void whack_attribute_finalize();
|
|||||||
*/
|
*/
|
||||||
void list_leases(char *name, char *addr, char *id);
|
void list_leases(char *name, char *addr, char *id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List either all pools or the pool with a given name
|
||||||
|
*
|
||||||
|
* @param name name of the pool, NULL for all pools
|
||||||
|
*/
|
||||||
|
void show_pools(const char *name);
|
||||||
|
|
||||||
#endif /** WHACK_ATTRIBUTE_H_ @}*/
|
#endif /** WHACK_ATTRIBUTE_H_ @}*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user