From 3dfb5203ce6951ed49b4543b7cd78dca6c836435 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Fri, 18 Mar 2016 22:32:26 +0000 Subject: [PATCH] Fixed some uissues with detection of loacl ip address. FossilOrigin-Name: 6437630df2aef4adc7b8a58d374bf3fa175e04e2cf8685ce56d6ec5fee269803 --- src/wtp/conf_uci.c | 5 +++++ src/wtp/wtp_conf.c | 16 ++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/wtp/conf_uci.c b/src/wtp/conf_uci.c index 096ad0c3..d399f9d7 100644 --- a/src/wtp/conf_uci.c +++ b/src/wtp/conf_uci.c @@ -151,6 +151,11 @@ int read_config(const char * filename){ if (str) conf_mtu_discovery = atoi(str); + str = uci_lookup_option_string(ctx,section,"interface"); + if (str) + conf_primary_if=strdup(str); + + str = uci_lookup_option_string(ctx,section,"ssl_key"); if (str) conf_sslkeyfilename=strdup(str); diff --git a/src/wtp/wtp_conf.c b/src/wtp/wtp_conf.c index cd309030..382e6c99 100644 --- a/src/wtp/wtp_conf.c +++ b/src/wtp/wtp_conf.c @@ -94,14 +94,12 @@ LONGSTRS conf_timer_cfgstrs[] = { int wtpconf_primary_if() { + if (!conf_primary_if ) { + conf_primary_if = sock_get_primary_if(AF_INET6); + if (!conf_primary_if) + conf_primary_if = sock_get_primary_if(AF_INET); + } -#ifdef WITH_IPV6 - conf_primary_if = sock_get_primary_if(AF_INET6); - if (!conf_primary_if) - conf_primary_if = sock_get_primary_if(AF_INET); -#else - conf_primary_if = get_primary_if(AF_INET); -#endif if (!conf_primary_if){ cw_log(LOG_ERR,"Fatal: Unable to detect primary interface"); @@ -117,10 +115,7 @@ int wtpconf_primary_if() conf_primary_if, sock_hwaddr2str(conf_macaddress,conf_macaddress_len) ); - - return 1; - } int wtpconf_name() @@ -192,6 +187,7 @@ int wtpconf_ac_list() } conf_ac_list_len=len; + #ifdef WITH_CW_LOG_DEBUG for (i=0; i