[UTC][connection][ACR-1705][Check network.route feature] 30/277630/3
authorcheoleun moon <chleun.moon@samsung.com>
Mon, 11 Jul 2022 07:56:34 +0000 (16:56 +0900)
committercheoleun moon <chleun.moon@samsung.com>
Tue, 12 Jul 2022 10:00:20 +0000 (19:00 +0900)
Change-Id: Ifdf24e8f97f753684490c401c2b30c9c4b034f4f

src/utc/connection/utc-connection-common.h
src/utc/connection/utc-network-connection.c

index 7e85bd387d49a2baaf5f3c8d8b9e5558fb9ed245..9665db405670894e528c063333e786a2ab0ac9b9 100755 (executable)
@@ -35,6 +35,7 @@
 #define FEATURE_ETHERNET                       "http://tizen.org/feature/network.ethernet"
 #define FEATURE_TELEPHONY                      "http://tizen.org/feature/network.telephony"
 #define FEATURE_BT_TETHERING                   "http://tizen.org/feature/network.tethering.bluetooth"
+#define FEATURE_ROUTE                          "http://tizen.org/feature/network.route"
 #define CALLBACK_RETURN                                "callback return"
 
 GMainLoop *g_pMainLoop;
@@ -45,6 +46,7 @@ bool wifi_supported;
 bool telephony_supported;
 bool bt_tethering_supported;
 bool ethernet_supported;
+bool route_supported;
 bool all_features_not_supported;
 
 connection_profile_h profile_cellular;
index 225772b38f36ac5247f1feca50ac825af4f51bce..45e4cbabe67200fc1e590d030253cc3858f91806 100755 (executable)
@@ -124,9 +124,11 @@ void utc_network_connection_startup(void)
        telephony_supported = connection_check_feature_supported(FEATURE_TELEPHONY);
        bt_tethering_supported = connection_check_feature_supported(FEATURE_BT_TETHERING);
        ethernet_supported = connection_check_feature_supported(FEATURE_ETHERNET);
+       route_supported = connection_check_feature_supported(FEATURE_ROUTE);
 
        if (telephony_supported == false && wifi_supported == false
-                       && bt_tethering_supported == false && ethernet_supported == false) {
+                       && bt_tethering_supported == false && ethernet_supported == false
+                       && route_supported == false) {
                all_features_not_supported = true;
                FPRINTF("[%s:%d] all feature is not supported\\n", __FILE__, __LINE__);
                return ;
@@ -1501,7 +1503,7 @@ int utc_connection_add_route_n1(void)
 {
        int ret;
 
-       if (all_features_not_supported) {
+       if (!route_supported || all_features_not_supported) {
                ret = connection_add_route(connection, NULL, NULL);
                CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1534,7 +1536,7 @@ int utc_connection_add_route_n2(void)
        int ret;
        char* interface_name = NULL;
 
-       if (all_features_not_supported) {
+       if (!route_supported || all_features_not_supported) {
                ret = connection_add_route(connection, interface_name, "192.168.129.3");
                CHECK_RETURN("connection_add_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1564,7 +1566,7 @@ int utc_connection_remove_route_n1(void)
 {
        int ret;
 
-       if (all_features_not_supported) {
+       if (!route_supported || all_features_not_supported) {
                ret = connection_remove_route(NULL, NULL, NULL);
                CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1597,7 +1599,7 @@ int utc_connection_remove_route_n2(void)
        int ret;
        char* interface_name = NULL;
 
-       if (all_features_not_supported) {
+       if (!route_supported || all_features_not_supported) {
                ret = connection_remove_route(connection, interface_name, "192.168.129.3");
                CHECK_RETURN("connection_remove_route", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1627,7 +1629,7 @@ int utc_connection_add_route_ipv6_n1(void)
 {
        int ret;
 
-       if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_add_route_ipv6(NULL, NULL, NULL, NULL);
                CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1657,7 +1659,7 @@ int utc_connection_add_route_ipv6_n2(void)
        int ret;
        char* interface_name = NULL;
 
-       if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_add_route_ipv6(connection, interface_name, "2001:db8:1:0::1", "fe80::");
                CHECK_RETURN("connection_add_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1686,7 +1688,7 @@ int utc_connection_remove_route_ipv6_n1(void)
 {
        int ret;
 
-       if (all_features_not_supported) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_remove_route_ipv6(NULL, NULL, NULL, NULL);
                CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1716,7 +1718,7 @@ int utc_connection_remove_route_ipv6_n2(void)
        int ret;
        char* interface_name = NULL;
 
-       if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_remove_route_ipv6(connection, interface_name, "2001:db8:1:0::1", "fe80::");
                FREE_RESOURCE(interface_name);
                CHECK_RETURN("connection_remove_route_ipv6", ret, CONNECTION_ERROR_NOT_SUPPORTED);
@@ -1746,7 +1748,7 @@ int utc_connection_add_route_entry_n1(void)
 {
        int ret;
 
-       if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_add_route_entry(NULL, -1, NULL, NULL, NULL);
                CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1776,7 +1778,7 @@ int utc_connection_add_route_entry_n2(void)
        int ret;
        char* interface_name = NULL;
 
-       if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, interface_name, "2001:db8:1:0::1", "fe80::");
                CHECK_RETURN("connection_add_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1805,7 +1807,7 @@ int utc_connection_remove_route_entry_n1(void)
 {
        int ret;
 
-       if (all_features_not_supported) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_remove_route_entry(NULL, -1, NULL, NULL, NULL);
                CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
@@ -1835,7 +1837,7 @@ int utc_connection_remove_route_entry_n2(void)
        int ret;
        char* interface_name = NULL;
 
-       if (telephony_supported == false && wifi_supported == false && ethernet_supported == false) {
+       if (!route_supported || (telephony_supported == false && wifi_supported == false && ethernet_supported == false)) {
                ret = connection_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, interface_name, "2001:db8:1:0::1", "fe80::");
                FREE_RESOURCE(interface_name);
                CHECK_RETURN("connection_remove_route_entry", ret, CONNECTION_ERROR_NOT_SUPPORTED);