summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/stroke/stroke_list.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
commit5313d2d78ca150515f7f5eb39801c100690b6b29 (patch)
treec78e420367283bb1b16f14210b12687cdfbd26eb /src/libcharon/plugins/stroke/stroke_list.c
parent6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (diff)
downloadvyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.tar.gz
vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.zip
Imported Upstream version 5.1.1
Diffstat (limited to 'src/libcharon/plugins/stroke/stroke_list.c')
-rw-r--r--src/libcharon/plugins/stroke/stroke_list.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c
index e81f3fc32..ea168058f 100644
--- a/src/libcharon/plugins/stroke/stroke_list.c
+++ b/src/libcharon/plugins/stroke/stroke_list.c
@@ -245,6 +245,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
u_int16_t encr_alg = ENCR_UNDEFINED, int_alg = AUTH_UNDEFINED;
u_int16_t encr_size = 0, int_size = 0;
u_int16_t esn = NO_EXT_SEQ_NUMBERS;
+ bool first = TRUE;
proposal->get_algorithm(proposal, ENCRYPTION_ALGORITHM,
&encr_alg, &encr_size);
@@ -256,6 +257,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
if (encr_alg != ENCR_UNDEFINED)
{
fprintf(out, "%N", encryption_algorithm_names, encr_alg);
+ first = FALSE;
if (encr_size)
{
fprintf(out, "_%u", encr_size);
@@ -263,7 +265,11 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
}
if (int_alg != AUTH_UNDEFINED)
{
- fprintf(out, "/%N", integrity_algorithm_names, int_alg);
+ if (!first)
+ {
+ fprintf(out, "/");
+ }
+ fprintf(out, "%N", integrity_algorithm_names, int_alg);
if (int_size)
{
fprintf(out, "_%u", int_size);
@@ -544,7 +550,6 @@ METHOD(stroke_list_t, status, void,
while (enumerator->enumerate(enumerator, &peer_cfg))
{
char *my_addr, *other_addr;
- bool my_allow_any, other_allow_any;
if (name && !streq(name, peer_cfg->get_name(peer_cfg)))
{
@@ -553,12 +558,10 @@ METHOD(stroke_list_t, status, void,
ike_cfg = peer_cfg->get_ike_cfg(peer_cfg);
ike_version = peer_cfg->get_ike_version(peer_cfg);
- my_addr = ike_cfg->get_my_addr(ike_cfg, &my_allow_any);
- other_addr = ike_cfg->get_other_addr(ike_cfg, &other_allow_any);
- fprintf(out, "%12s: %s%s...%s%s %N", peer_cfg->get_name(peer_cfg),
- my_allow_any ? "%":"", my_addr,
- other_allow_any ? "%":"", other_addr,
- ike_version_names, ike_version);
+ my_addr = ike_cfg->get_my_addr(ike_cfg);
+ other_addr = ike_cfg->get_other_addr(ike_cfg);
+ fprintf(out, "%12s: %s...%s %N", peer_cfg->get_name(peer_cfg),
+ my_addr, other_addr, ike_version_names, ike_version);
if (ike_version == IKEV1 && peer_cfg->use_aggressive(peer_cfg))
{
@@ -647,7 +650,7 @@ METHOD(stroke_list_t, status, void,
half_open);
enumerator = charon->controller->create_ike_sa_enumerator(
charon->controller, wait);
- while (enumerator->enumerate(enumerator, &ike_sa))
+ while (enumerator->enumerate(enumerator, &ike_sa) && ferror(out) == 0)
{
bool ike_printed = FALSE;
enumerator_t *children = ike_sa->create_child_sa_enumerator(ike_sa);