diff --git a/features/nanostack/mbed-mesh-api/mbed-mesh-api/WisunBorderRouter.h b/features/nanostack/mbed-mesh-api/mbed-mesh-api/WisunBorderRouter.h index bd6e3400509..f5bb21b7768 100644 --- a/features/nanostack/mbed-mesh-api/mbed-mesh-api/WisunBorderRouter.h +++ b/features/nanostack/mbed-mesh-api/mbed-mesh-api/WisunBorderRouter.h @@ -331,6 +331,7 @@ class WisunBorderRouter { char *_shared_secret = NULL; uint16_t _shared_secret_len = 0; int8_t _mesh_if_id = -1; + bool _radius_ipv6_addr_init = false; bool _radius_ipv6_addr_set = false; bool _configured = false; bool _radius_timing_set = false; diff --git a/features/nanostack/mbed-mesh-api/source/WisunBorderRouter.cpp b/features/nanostack/mbed-mesh-api/source/WisunBorderRouter.cpp index 3b98c9cfc43..46977f994e9 100644 --- a/features/nanostack/mbed-mesh-api/source/WisunBorderRouter.cpp +++ b/features/nanostack/mbed-mesh-api/source/WisunBorderRouter.cpp @@ -109,7 +109,7 @@ void WisunBorderRouter::stop() mesh_error_t WisunBorderRouter::configure() { -#if defined(MBED_CONF_MBED_MESH_API_RADIUS_SHARED_SECRET) || defined(MBED_CONF_MBED_MESH_API_RADIUS_SERVER_IPV6_ADDRESS) || defined(MBED_CONF_MBED_MESH_API_RADIUS_RETRY_IMIN) +#if defined(MBED_CONF_MBED_MESH_API_RADIUS_SHARED_SECRET) || defined(MBED_CONF_MBED_MESH_API_RADIUS_SERVER_IPV6_ADDRESS) mesh_error_t status; #endif @@ -281,8 +281,10 @@ mesh_error_t WisunBorderRouter::set_radius_server_ipv6_address(const char *addre } // Stored address (returned by get) is in the format given by user of the interface strcpy(_radius_ipv6_addr, address); + _radius_ipv6_addr_init = true; _radius_ipv6_addr_set = true; } else { + _radius_ipv6_addr_init = true; _radius_ipv6_addr_set = false; } @@ -303,6 +305,10 @@ mesh_error_t WisunBorderRouter::set_bbr_radius_address(void) { int status; + if (!_radius_ipv6_addr_init) { + return MESH_ERROR_NONE; + } + if (_radius_ipv6_addr_set) { uint8_t ipv6_addr[16]; if (!stoip6(_radius_ipv6_addr, strlen(_radius_ipv6_addr), ipv6_addr)) { @@ -348,7 +354,7 @@ mesh_error_t WisunBorderRouter::set_radius_shared_secret(uint16_t shared_secret_ mesh_error_t WisunBorderRouter::set_bbr_radius_shared_secret(void) { if (_shared_secret_len == 0 || _shared_secret == NULL) { - return MESH_ERROR_UNKNOWN; + return MESH_ERROR_NONE; } int status = ws_bbr_radius_shared_secret_set(_mesh_if_id, _shared_secret_len, (uint8_t *) _shared_secret);