From 9655be446353e059dd70083193db60692584596f Mon Sep 17 00:00:00 2001 From: "wansu.yoo" Date: Thu, 28 Dec 2017 10:22:40 +0900 Subject: [PATCH] Fix ethernet setting errors 1. fix parsing error of "secondaryDnsServer" key ethernet is being enabled successfully with correct "secondaryDnsServer" value. 2. increase delay time for sync after setting. (2 -> 5 sec) currently, __network_get_state is returning wrong value using previous connection handle. there need more delay time after setting network to get new connection. 3. remove temporary blocked code / add some debug info Signed-off-by: wansu.yoo --- src/sa_types.h | 2 +- src/setup_network.c | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/sa_types.h b/src/sa_types.h index b891dc7..2d3cb45 100644 --- a/src/sa_types.h +++ b/src/sa_types.h @@ -32,7 +32,7 @@ #define SA_CONFIG_NETWORKDATA_NETMASK "netmask" #define SA_CONFIG_NETWORKDATA_DEFAULTGATEWAY "defaultGateway" #define SA_CONFIG_NETWORKDATA_PRIMARYDNSSERVER "primaryDnsServer" -#define SA_CONFIG_NETWORKDATA_SECONDARYDNSSERVER "SecondaryDnsServer" +#define SA_CONFIG_NETWORKDATA_SECONDARYDNSSERVER "secondaryDnsServer" #define SA_CONFIG_NETWORKDATA_HTTPPROXYHOST "httpProxyHost" #define SA_CONFIG_NETWORKDATA_HTTPPROXYPORT "httpProxyPort" diff --git a/src/setup_network.c b/src/setup_network.c index eb2306f..e9523e1 100644 --- a/src/setup_network.c +++ b/src/setup_network.c @@ -424,7 +424,6 @@ static int __eth_update_ip_info(sa_eth_s *info, connection_profile_h profile, co char input_str[100] = {0,}; _D("ipaddress =%s", info->staticInfo->ipAddress); - if (info->staticInfo->ipAddress != NULL) { rv = connection_profile_set_ip_address(profile, address_family, @@ -432,7 +431,7 @@ static int __eth_update_ip_info(sa_eth_s *info, connection_profile_h profile, co if (rv != CONNECTION_ERROR_NONE) return -1; } -#if 0 + _D("netmask =%s", info->staticInfo->netmask); if (info->staticInfo->netmask != NULL) { rv = connection_profile_set_subnet_mask(profile, @@ -471,7 +470,6 @@ static int __eth_update_ip_info(sa_eth_s *info, connection_profile_h profile, co _D("DNS 2 =%s", info->staticInfo->secondaryDnsServer); } } -#endif return 1; } @@ -649,6 +647,25 @@ static sa_error_e __network_connect(sa_network_s *info) if (info == NULL) { return SA_ERROR_INVALID_PARAMETER; + } else { + _D("----------- wifi info -----------"); + _D("info|wifi|enabled(%d)", info->wifi->enabled); + _D("info|wifi|dhcpEnabled(%d)", info->wifi->dhcpEnabled); + _D("info|wifi|ssid(%s)", info->wifi->ssid); + _D("info|wifi|password(%s)", info->wifi->password); + _D("info|wifi|staticInfo|ipAddress(%s)", info->wifi->staticInfo->ipAddress); + _D("info|wifi|staticInfo|netmask(%s)", info->wifi->staticInfo->netmask); + _D("info|wifi|staticInfo|defaultGateway(%s)", info->wifi->staticInfo->defaultGateway); + _D("info|wifi|staticInfo|primaryDnsServer(%s)", info->wifi->staticInfo->primaryDnsServer); + _D("info|wifi|staticInfo|secondaryDnsServer(%s)", info->wifi->staticInfo->secondaryDnsServer); + _D("----------- ethernet info -----------"); + _D("info|eth|enabled(%d)", info->eth->enabled); + _D("info|eth|dhcpEnabled(%d)", info->eth->dhcpEnabled); + _D("info|eth|staticInfo|ipAddress(%s)", info->eth->staticInfo->ipAddress); + _D("info|eth|staticInfo|netmask(%s)", info->eth->staticInfo->netmask); + _D("info|eth|staticInfo|defaultGateway(%s)", info->eth->staticInfo->defaultGateway); + _D("info|eth|staticInfo|primaryDnsServer(%s)", info->eth->staticInfo->primaryDnsServer); + _D("info|eth|staticInfo|secondaryDnsServer(%s)", info->eth->staticInfo->secondaryDnsServer); } if (info->eth != NULL) { @@ -689,7 +706,7 @@ sa_error_e sa_setup_network(sa_network_s *network) ret = __network_connect(network); // need to delay to sync with setting... - sleep(2); + sleep(5); ret = __network_get_state(&conn_state, &conn_type); if (ret == SA_ERROR_NONE) { _D("Device Network : T[%s] S[%s]", __print_network_type(conn_type), __print_connection_state(conn_state)); -- 2.34.1