Fix ethernet setting errors
authorwansu.yoo <wansu.yoo@samsung.com>
Thu, 28 Dec 2017 01:22:40 +0000 (10:22 +0900)
committerwansu.yoo <wansu.yoo@samsung.com>
Thu, 28 Dec 2017 01:22:40 +0000 (10:22 +0900)
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 <wansu.yoo@samsung.com>
src/sa_types.h
src/setup_network.c

index b891dc7b716f79a6c33d06b13b15b6fd95b4b220..2d3cb4505b570e81a3d67003c6716e05c7427b14 100644 (file)
@@ -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"
index eb2306fd709b59cb4c2f62dc84997667fb2fb174..e9523e1f3423f30e1e2fa237a7ce0607275d1f04 100644 (file)
@@ -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));