summaryrefslogtreecommitdiff
path: root/res/res_stun_monitor.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-04-14 17:50:56 -0400
committerSean Bright <sean.bright@gmail.com>2017-04-14 16:55:03 -0500
commitf6600f2c2ed98f1566f9e24db8392a47ae710299 (patch)
tree75e7852c0a7d1c40ce9854bc64c322c7d44234ce /res/res_stun_monitor.c
parent2e6075c51fe0466d7410b02efb68f1d47aedb284 (diff)
res_stun_monitor: Don't fail to load if DNS resolution fails
res_stun_monitor will fail to load if DNS resolution of the STUN server fails. Instead, we continue without the STUN server being resolved and we will re-attempt the resolution on the STUN refresh interval. ASTERISK-21856 #close Reported by: Jeremy Kister Change-Id: I6334c54a1cc798f8a836b4b47948e0bb4ef59254
Diffstat (limited to 'res/res_stun_monitor.c')
-rw-r--r--res/res_stun_monitor.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/res/res_stun_monitor.c b/res/res_stun_monitor.c
index 46deaff75..08d1d6615 100644
--- a/res/res_stun_monitor.c
+++ b/res/res_stun_monitor.c
@@ -269,7 +269,7 @@ static int stun_start_monitor(void)
* \retval 0 on success.
* \retval -1 on error.
*/
-static int setup_stunaddr(const char *value)
+static int setup_stunaddr(const char *value, int reload)
{
char *val;
char *host_str;
@@ -305,8 +305,12 @@ static int setup_stunaddr(const char *value)
stun_addr.ss.ss_family = AF_INET;
if (ast_get_ip(&stun_addr, host_str)) {
ast_log(LOG_WARNING, "Unable to lookup STUN server '%s'\n", host_str);
- ast_free(host_str);
- return -1;
+
+ /* Only treat this as fatal if we are reloading */
+ if (reload) {
+ ast_free(host_str);
+ return -1;
+ }
}
/* Save STUN server information. */
@@ -348,7 +352,7 @@ static int load_config(int startup)
for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
if (!strcasecmp(v->name, "stunaddr")) {
- if (setup_stunaddr(v->value)) {
+ if (setup_stunaddr(v->value, !startup)) {
ast_log(LOG_WARNING, "Invalid STUN server address: %s at line %d\n",
v->value, v->lineno);
}