summaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/main.c
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-10-11 15:44:48 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-10-11 16:38:38 +0200
commit0bfd0847d74298387da9b3e71e96e2010d881c7d (patch)
treee387fde3f48acfd6cc533b1342a7eeb4a46e8325 /ctrl/facemgr/src/main.c
parent91304b8cb75df7cb516518b53e3c1156d0f27ba5 (diff)
[HICN-319] facemgr should allow face creation even though already in cache
Change-Id: Icadfdc6369711575cfc8b8fee8e956b004860e1b Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src/main.c')
-rw-r--r--ctrl/facemgr/src/main.c52
1 files changed, 40 insertions, 12 deletions
diff --git a/ctrl/facemgr/src/main.c b/ctrl/facemgr/src/main.c
index 2a336db8f..307d05236 100644
--- a/ctrl/facemgr/src/main.c
+++ b/ctrl/facemgr/src/main.c
@@ -211,14 +211,18 @@ parse_config_global(facemgr_cfg_t * cfg, config_setting_t * setting)
config_setting_t *overlay_v4 = config_setting_get_member(overlay, "ipv4");
if (overlay_v4) {
const char * local_addr_str, * remote_addr_str;
- ip_address_t local_addr, remote_addr;
+ ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ ip_address_t remote_addr = IP_ADDRESS_EMPTY;
ip_address_t * local_addr_p = NULL;
ip_address_t * remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v4, "local_addr", &local_addr_str)) {
- ip_address_pton(local_addr_str, &local_addr);
+ if (ip_address_pton(local_addr_str, &local_addr) < 0) {
+ ERROR("Error parsing v4 local addr");
+ goto ERR;
+ }
local_addr_p = &local_addr;
}
@@ -228,7 +232,10 @@ parse_config_global(facemgr_cfg_t * cfg, config_setting_t * setting)
}
if (config_setting_lookup_string(overlay_v4, "remote_addr", &remote_addr_str)) {
- ip_address_pton(remote_addr_str, &remote_addr);
+ if (ip_address_pton(remote_addr_str, &remote_addr) < 0) {
+ ERROR("Error parsing v4 remote addr");
+ goto ERR;
+ }
remote_addr_p = &remote_addr;
}
@@ -247,14 +254,18 @@ parse_config_global(facemgr_cfg_t * cfg, config_setting_t * setting)
config_setting_t *overlay_v6 = config_setting_get_member(overlay, "ipv6");
if (overlay_v6) {
const char * local_addr_str, * remote_addr_str;
- ip_address_t local_addr, remote_addr;
+ ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ ip_address_t remote_addr = IP_ADDRESS_EMPTY;
ip_address_t * local_addr_p = NULL;
ip_address_t * remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v6, "local_addr", &local_addr_str)) {
- ip_address_pton(local_addr_str, &local_addr);
+ if (ip_address_pton(local_addr_str, &local_addr) < 0) {
+ ERROR("Error parsing v6 local addr");
+ goto ERR;
+ }
local_addr_p = &local_addr;
}
@@ -264,7 +275,10 @@ parse_config_global(facemgr_cfg_t * cfg, config_setting_t * setting)
}
if (config_setting_lookup_string(overlay_v6, "remote_addr", &remote_addr_str)) {
- ip_address_pton(remote_addr_str, &remote_addr);
+ if (ip_address_pton(remote_addr_str, &remote_addr) < 0) {
+ ERROR("Error parsing v6 remote addr");
+ goto ERR;
+ }
remote_addr_p = &remote_addr;
}
@@ -462,14 +476,18 @@ parse_config_rules(facemgr_cfg_t * cfg, config_setting_t * setting)
config_setting_t *overlay_v4 = config_setting_get_member(overlay, "ipv4");
if (overlay_v4) {
const char * local_addr_str, * remote_addr_str;
- ip_address_t local_addr, remote_addr;
+ ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ ip_address_t remote_addr = IP_ADDRESS_EMPTY;
ip_address_t * local_addr_p = NULL;
ip_address_t * remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v4, "local_addr", &local_addr_str)) {
- ip_address_pton(local_addr_str, &local_addr);
+ if (ip_address_pton(local_addr_str, &local_addr) < 0) {
+ ERROR("Error parsing v4 local addr");
+ goto ERR;
+ }
local_addr_p = &local_addr;
}
@@ -479,7 +497,10 @@ parse_config_rules(facemgr_cfg_t * cfg, config_setting_t * setting)
}
if (config_setting_lookup_string(overlay_v4, "remote_addr", &remote_addr_str)) {
- ip_address_pton(remote_addr_str, &remote_addr);
+ if (ip_address_pton(remote_addr_str, &remote_addr) < 0) {
+ ERROR("Error parsing v4 remote addr");
+ goto ERR;
+ }
remote_addr_p = &remote_addr;
}
@@ -498,14 +519,18 @@ parse_config_rules(facemgr_cfg_t * cfg, config_setting_t * setting)
config_setting_t *overlay_v6 = config_setting_get_member(overlay, "ipv6");
if (overlay_v6) {
const char * local_addr_str, * remote_addr_str;
- ip_address_t local_addr, remote_addr;
+ ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ ip_address_t remote_addr = IP_ADDRESS_EMPTY;
ip_address_t * local_addr_p = NULL;
ip_address_t * remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v6, "local_addr", &local_addr_str)) {
- ip_address_pton(local_addr_str, &local_addr);
+ if (ip_address_pton(local_addr_str, &local_addr) < 0) {
+ ERROR("Error parsing v6 local addr");
+ goto ERR;
+ }
local_addr_p = &local_addr;
}
@@ -515,7 +540,10 @@ parse_config_rules(facemgr_cfg_t * cfg, config_setting_t * setting)
}
if (config_setting_lookup_string(overlay_v6, "remote_addr", &remote_addr_str)) {
- ip_address_pton(remote_addr_str, &remote_addr);
+ if (ip_address_pton(remote_addr_str, &remote_addr) < 0) {
+ ERROR("Error parsing v6 remote addr");
+ goto ERR;
+ }
remote_addr_p = &remote_addr;
}