Properly handle Barbican IPv6 address in MTCE

barbican.conf stores Barbican IPv6 address enclosed by square brackets:
bind_host=[abde::2]
MTCE fails to connect to Barbican with such an IP address.
Need to strip square brackets during barbican.conf file read in MTCE.

Change-Id: I28ae627cd4998a5975d39b3edc466180e11aedf6
Closes-Bug: 1839870
Signed-off-by: Alex Kozyrev <alex.kozyrev@windriver.com>
This commit is contained in:
Alex Kozyrev 2019-08-12 14:30:45 -04:00
parent c25d088367
commit 0083538501
1 changed files with 7 additions and 0 deletions

View File

@ -280,6 +280,13 @@ int barbican_config_handler ( void * user,
else if (MATCH("DEFAULT", "bind_host")) // bind_host=192.168.204.2
{
config_ptr->barbican_api_host = strdup(value);
// strip square brackets in case IPv6 format: bind_host=[abde::2]
if (config_ptr->barbican_api_host[0] == '[')
{
memmove(config_ptr->barbican_api_host, config_ptr->barbican_api_host+1,
strlen(config_ptr->barbican_api_host));
config_ptr->barbican_api_host[strlen(config_ptr->barbican_api_host)-1] = '\0';
}
ilog("Barbican Host : %s\n", config_ptr->barbican_api_host );
}
return (PASS);