From af18c84ffb712fd72670dcdcea0e7a86eb7b890f Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Mon, 21 Jul 2008 19:08:03 +0000 Subject: [PATCH] display protoport in dynamic/32 traffic selectors --- src/charon/config/traffic_selector.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/charon/config/traffic_selector.c b/src/charon/config/traffic_selector.c index 3b70688..a12e750 100644 --- a/src/charon/config/traffic_selector.c +++ b/src/charon/config/traffic_selector.c @@ -195,21 +195,22 @@ static int print(FILE *stream, const struct printf_info *info, memeq(this->from, from, this->type == TS_IPV4_ADDR_RANGE ? 4 : 16) && memeq(this->to, to, this->type == TS_IPV4_ADDR_RANGE ? 4 : 16)) { - return fprintf(stream, "dynamic/%d", - this->type == TS_IPV4_ADDR_RANGE ? 32 : 128); - } - - if (this->type == TS_IPV4_ADDR_RANGE) - { - inet_ntop(AF_INET, &this->from4, addr_str, sizeof(addr_str)); + written += fprintf(stream, "dynamic/%d", + this->type == TS_IPV4_ADDR_RANGE ? 32 : 128); } else { - inet_ntop(AF_INET6, &this->from6, addr_str, sizeof(addr_str)); + if (this->type == TS_IPV4_ADDR_RANGE) + { + inet_ntop(AF_INET, &this->from4, addr_str, sizeof(addr_str)); + } + else + { + inet_ntop(AF_INET6, &this->from6, addr_str, sizeof(addr_str)); + } + mask = calc_netbits(this); + written += fprintf(stream, "%s/%d", addr_str, mask); } - mask = calc_netbits(this); - - written += fprintf(stream, "%s/%d", addr_str, mask); /* check if we have protocol and/or port selectors */ has_proto = this->protocol != 0; -- 2.7.4