summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-11-15 15:32:40 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-11-15 15:33:17 +0100
commit56d4ce1db07f32a5804db764f72c3b880ab5f961 (patch)
treeebc9218c3b3dc637341e3bd6063293706d769124 /lib
parent4f2b5bb4c0fb4083b4f2bb19296117c6e66e862e (diff)
[HICN-386] Improve API error management in libhicnctrl
Change-Id: I3f5e3840303265ccc3d4b864d026b63a2ccb7fdf Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/includes/hicn/policy.h2
-rw-r--r--lib/includes/hicn/util/log.h2
-rw-r--r--lib/src/util/ip_address.c11
3 files changed, 7 insertions, 8 deletions
diff --git a/lib/includes/hicn/policy.h b/lib/includes/hicn/policy.h
index 12f8c1e12..73d281cd6 100644
--- a/lib/includes/hicn/policy.h
+++ b/lib/includes/hicn/policy.h
@@ -104,7 +104,7 @@ foreach_policy_tag
return POLICY_TAG_N + 1;
}
-#define MAXSZ_POLICY_TAGS_ POLICY_TAG_N
+#define MAXSZ_POLICY_TAGS_ POLICY_TAG_N + 1
#define MAXSZ_POLICY_TAGS MAXSZ_POLICY_TAGS_ + 1
/* POLICY STATE */
diff --git a/lib/includes/hicn/util/log.h b/lib/includes/hicn/util/log.h
index f1cafba47..26d7d9418 100644
--- a/lib/includes/hicn/util/log.h
+++ b/lib/includes/hicn/util/log.h
@@ -34,7 +34,7 @@ typedef struct {
} log_conf_t;
#define DEFAULT_LOG_CONF { \
- .log_level = LOG_DEBUG, \
+ .log_level = LOG_INFO, \
.debug = 0, \
.log_file = NULL, \
};
diff --git a/lib/src/util/ip_address.c b/lib/src/util/ip_address.c
index 2b7c69bb5..8bbb2bf5d 100644
--- a/lib/src/util/ip_address.c
+++ b/lib/src/util/ip_address.c
@@ -145,19 +145,18 @@ ip_address_snprintf(char * s, size_t size, const ip_address_t * ip_address, int
if (size <= INET_ADDRSTRLEN)
return -1;
rc = inet_ntop (AF_INET, ip_address->v4.buffer, s, INET_ADDRSTRLEN);
- if (!rc)
- return -1;
- return INET_ADDRSTRLEN;
+ break;
case AF_INET6:
if (size <= INET6_ADDRSTRLEN)
return -1;
rc = inet_ntop (AF_INET6, ip_address->v6.buffer, s, INET6_ADDRSTRLEN);
- if (!rc)
- return -1;
- return INET6_ADDRSTRLEN;
+ break;
default:
return -1;
}
+ if (!rc)
+ return -1;
+ return strlen(s);
}
int