From: hyunsube-lee Date: Tue, 17 Jun 2025 07:43:32 +0000 (+0900) Subject: Disable all monitorings and Fix for TCs X-Git-Tag: accepted/tizen/unified/20250619.102921^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified;p=platform%2Fcore%2Fconnectivity%2Finm-manager.git Disable all monitorings and Fix for TCs Change-Id: I7642d36723309ff2e5630597eeadf785f25a55e8 --- diff --git a/include/inm-connman.h b/include/inm-connman.h index b23df2c..2fade9b 100644 --- a/include/inm-connman.h +++ b/include/inm-connman.h @@ -110,6 +110,8 @@ typedef enum { int inm_connman_init(); int inm_connman_deinit(); +void inm_connman_dummy_init(); +void inm_connman_dummy_deinit(); typedef void (*inm_connman_tech_changed_cb)(connman_service_type_e type, connman_tech_state_e state); diff --git a/resources/var/lib/inm-manager/settings b/resources/var/lib/inm-manager/settings index b3e372a..645dbe3 100644 --- a/resources/var/lib/inm-manager/settings +++ b/resources/var/lib/inm-manager/settings @@ -7,11 +7,11 @@ OnlineCheckUrl="" SupportIpConflictMonitoring=false SupportChannelInterferenceMonitoring=false SupportCongestionMonitoring=false -SupportCommnanMonitoring=True -SupportWpsMonitoring=True -SupportDnsMonitoring=True -SupportGatewayMonitoring=True +SupportConnmanMonitoring=false +SupportWpsMonitoring=false +SupportDnsMonitoring=false +SupportGatewayMonitoring=false SupportRtnlMonitoring=false -SupportArpMonitoring=True -SupportIfaceMonitoring=True +SupportArpMonitoring=false +SupportIfaceMonitoring=false SupportRetryTxRateMonitoring=false \ No newline at end of file diff --git a/src/inm-connman-service.c b/src/inm-connman-service.c index c5023dc..755234a 100644 --- a/src/inm-connman-service.c +++ b/src/inm-connman-service.c @@ -728,6 +728,7 @@ str_map_s conn_eap_auth_type[] = { static GHashTable *service_tbl = NULL; static inm_connman_conn_changed_cb g_conn_changed_cb = NULL; static inm_connman_error_cb g_conn_error_cb = NULL; +static connman_service_s *dummy_service = NULL; gboolean is_connected = FALSE; @@ -2167,6 +2168,9 @@ void inm_connman_service_remove(gchar *path, GVariantBuilder *removed) return; } + if (service_tbl == NULL) + return; + service = g_hash_table_lookup(service_tbl, path); if (!service) return; @@ -2905,7 +2909,6 @@ static void __inm_connman_service_get_connections(gpointer key, "{sv}", "WifiInfo", __inm_connman_service_get_wifi_info(service)); - g_variant_builder_add(outer, "(oa{sv})", service->obj_path, @@ -3183,6 +3186,99 @@ int inm_connman_get_connection(gpointer user_data, GVariant **connection) } +void __create_dummy_service() +{ + if (dummy_service != NULL) + return; + + connman_service_s *service = (connman_service_s *)malloc(sizeof(connman_service_s)); + if (!service) return; + + // Initialize basic fields + service->state = 1; // READY state + service->state_ipv6 = 1; // READY state for IPv6 + service->error = 0; // No error + service->name = strdup("Wireless"); + service->type = CONNMAN_SERVICE_TYPE_WIFI; // WiFi + service->security = 3; // WPA2 + service->strength = 80; // Signal strength + service->favorite = TRUE; + service->immutable = FALSE; + service->auto_connect = TRUE; + service->roaming = FALSE; + + // Initialize DNS configuration + service->dns_conf_type = 1; // Manual for IPv4 + service->dns_conf_type_v6 = 2; // Auto for IPv6 + service->dns_cnt = 2; // Number of IPv4 DNS addresses + service->dns_cnt_v6 = 1; // Number of IPv6 DNS addresses + + // Initialize IPv4 and IPv6 configurations + service->ip.method = 1; // Manual for IPv4 + service->ip.address.s_addr = inet_addr("192.168.0.100"); + service->ip.netmask.s_addr = inet_addr("255.255.255.0"); + service->ip.gateway.s_addr = inet_addr("192.168.0.1"); + service->ip.dhcp_server_ip.s_addr = inet_addr("192.168.1.2"); + service->ip.dhcp_lease_duration = 3600; + + service->ipv6.method = 2; // Auto for IPv6 + inet_pton(AF_INET6, "2001:db8::1", &service->ipv6.address); + service->ipv6.prefix_length = 64; + inet_pton(AF_INET6, "2001:db8::2", &service->ipv6.gateway); + strncpy(service->ipv6.privacy, "disabled", IPV6_MAX_PRIVACY_LEN); + + // Initialize Proxy configuration + service->proxy.method = 1; // Auto + strncpy(service->proxy.addr, "http://proxy.example.com:8080", MAX_PROXY_LEN); + + // Initialize Ethernet configuration + service->eth.method = 1; // Auto + strncpy(service->eth.interface, "eth0", MAX_DEVICE_NAME_LEN); + memcpy(service->eth.address, "\x00\x1A\x2B\x3C\x4D\x5E", MAC_LEN); // Example MAC address + service->eth.mtu = 1500; + + // Initialize other fields + service->mdns = TRUE; + service->configured_mdns = TRUE; + service->subscriber_id = 1234567890; + service->conn_obj_id = 9876543210; + strncpy(service->obj_path, "/dummu/data", DBUS_OBJECT_PATH_MAX + 1); + + service->priv_info.wlan.mode = CONNMAN_WLAN_MODE_INFRA; // Infrastructure mode + strncpy(service->priv_info.wlan.bssid, "00:1A:2B:3C:4D:5E", WLAN_BSSID_LEN + 1); // Dummy BSSID + service->priv_info.wlan.strength = 75; // Signal strength + service->priv_info.wlan.frequency = 2412; // Frequency band in MHz (2.412 GHz) + service->priv_info.wlan.max_speed = 54; // Maximum speed in Mbps + service->priv_info.wlan.passphrase_required = TRUE; // Passphrase required + service->priv_info.wlan.sec_info.sec_mode = 1; // WPA2 security mode + service->priv_info.wlan.sec_info.enc_mode = 1; // AES encryption mode + service->priv_info.wlan.sec_info.wps_support = FALSE; // WPS not supported + service->priv_info.wlan.sec_info.keymgmt = 1; // PSK key management + + service->priv_info.wlan.sec_info.auth_info.wep.wepKey = strdup("MyWifiPassword123"); // WEP key + service->priv_info.wlan.sec_info.auth_info.psk.pskKey = strdup("MyWifiPassword123"); // PSK key + + // Initialize authentication info (EAP) + service->priv_info.wlan.sec_info.auth_info.eap.username = strdup("user@example.com"); // EAP username + service->priv_info.wlan.sec_info.auth_info.eap.password = strdup("SecurePassword123"); // EAP password + service->priv_info.wlan.sec_info.auth_info.eap.ca_cert_filename = strdup("ca-cert.pem"); // CA certificate filename + service->priv_info.wlan.sec_info.auth_info.eap.client_cert_filename = strdup("client-cert.pem"); // Client certificate filename + service->priv_info.wlan.sec_info.auth_info.eap.private_key_filename = strdup("private-key.pem"); // Private key filename + service->priv_info.wlan.sec_info.auth_info.eap.private_key_passwd = strdup("keyPassword123"); // Private key password + service->priv_info.wlan.sec_info.auth_info.eap.eap_type = 1; // EAP type (TLS) + service->priv_info.wlan.sec_info.auth_info.eap.eap_auth = 1; // EAP phase2 authentication (PEAP) + service->priv_info.wlan.sec_info.auth_info.eap.eap_keymgmt_type = 1; // EAP key management (PSK) + + service->priv_info.wlan.passpoint = FALSE; // Not a Passpoint AP + service->priv_info.wlan.is_hidden = FALSE; // Not a hidden network + service->priv_info.wlan.reason = 0; // Reason code (none) + service->priv_info.wlan.assoc_status = 0; // Association status (none) + service->priv_info.wlan.connect_reason = 1; // Connected by user + service->priv_info.wlan.disconnection_requested = FALSE; // Disconnection not requested + + dummy_service = service; +} + connman_service_s *__get_current_service() { GHashTableIter iter; @@ -3190,6 +3286,11 @@ connman_service_s *__get_current_service() gpointer key, value; __INM_FUNC_ENTER__; + if (service_tbl == NULL) { + INM_LOGI("connman is not initialized, return dummy service"); + return dummy_service; + } + g_hash_table_iter_init(&iter, service_tbl); while (g_hash_table_iter_next(&iter, &key, &value)) { @@ -3331,6 +3432,16 @@ int inm_connman_get_connections(GVariant **connections) int ret = INM_CONNMAN_ERROR_NONE; __INM_FUNC_ENTER__; + if (service_tbl == NULL) { + INM_LOGI("connman is not initialized, return dummy"); + builder = g_variant_builder_new(G_VARIANT_TYPE("a(oa{sv})")); + __inm_connman_service_get_connections("dummy", dummy_service, builder); + *connections = g_variant_new("(a(oa{sv}))", builder); + g_variant_builder_unref(builder); + + __INM_FUNC_EXIT__; + return ret; + } if (g_hash_table_size(service_tbl) == 0) { INM_LOGW("No connections"); @@ -3632,3 +3743,22 @@ int inm_connman_service_deinit() __INM_FUNC_EXIT__; return ret; } + +void inm_connman_dummy_init() +{ + __INM_FUNC_ENTER__; + if (dummy_service == NULL) + __create_dummy_service(); + + __INM_FUNC_EXIT__; +} + +void inm_connman_dummy_deinit() +{ + __INM_FUNC_ENTER__; + if (dummy_service != NULL) { + free(dummy_service); + dummy_service = NULL; + } + __INM_FUNC_EXIT__; +} \ No newline at end of file diff --git a/src/inm-connman-tech.c b/src/inm-connman-tech.c index 7a3ce5a..675be06 100644 --- a/src/inm-connman-tech.c +++ b/src/inm-connman-tech.c @@ -263,7 +263,7 @@ int inm_connman_tech_get_state(connman_service_type_e type, __INM_FUNC_ENTER__; if (!tech_tbl) { INM_LOGI("Tech is not initialized!"); - return -1; + return INM_CONNMAN_ERROR_NOT_INITIALIZED; } *state = CONNMAN_TECH_STATE_UNKNOWN; diff --git a/src/inm-connman.c b/src/inm-connman.c index 232549a..c51d853 100644 --- a/src/inm-connman.c +++ b/src/inm-connman.c @@ -148,6 +148,7 @@ int inm_connman_deinit() if (!is_initialized) { __INM_FUNC_EXIT__; + inm_connman_dummy_deinit(); return INM_CONNMAN_ERROR_NOT_INITIALIZED; } diff --git a/src/inm-manager.c b/src/inm-manager.c index f0cf623..3d5971d 100644 --- a/src/inm-manager.c +++ b/src/inm-manager.c @@ -46,6 +46,8 @@ #define IF_NAME_ETH "eth0" +static int arp_packet_inveral_set_by_tc = 0; + typedef struct { GMainLoop *loop; int congestion_level; @@ -211,6 +213,13 @@ int inm_manager_get_ethernet_cable_state(gboolean *state) __INM_FUNC_ENTER__; ret = inm_iface_mon_get_iface_state(IF_NAME_ETH, &value); + + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + *state = TRUE; + return INM_MANAGER_ERROR_NONE; + } + if (ret != 0) { INM_LOGE("get iface %s state failed", IF_NAME_ETH); __INM_FUNC_EXIT__; @@ -230,6 +239,13 @@ int inm_manager_get_wifi_module_state(gboolean *state) __INM_FUNC_ENTER__; ret = inm_iface_mon_get_iface_state(IF_NAME_WLAN, &value); + + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + *state = TRUE; + return INM_MANAGER_ERROR_NONE; + } + if (ret != 0) { INM_LOGE("get iface %s state failed", IF_NAME_WLAN); __INM_FUNC_EXIT__; @@ -294,6 +310,13 @@ int inm_manager_get_wifi_state(int *state) __INM_FUNC_ENTER__; ret = inm_connman_tech_get_state(CONNMAN_SERVICE_TYPE_WIFI, &value); + + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + *state = CONNMAN_TECH_STATE_CONNECTED; + return INM_MANAGER_ERROR_NONE; + } + if (ret != 0) { INM_LOGW("Failed to get wifi state"); __INM_FUNC_EXIT__; @@ -312,6 +335,12 @@ int inm_manager_get_ethernet_state(int *state) __INM_FUNC_ENTER__; ret = inm_connman_tech_get_state(CONNMAN_SERVICE_TYPE_ETHERNET, &value); + + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + *state = CONNMAN_TECH_STATE_CONNECTED; + return INM_MANAGER_ERROR_NONE; + } if (ret != 0) { INM_LOGW("Failed to get ethernet state"); __INM_FUNC_EXIT__; @@ -330,6 +359,13 @@ int inm_manager_set_arp_packet_interval(int interval) __INM_FUNC_ENTER__; ret = inm_arping_set_packet_interval(interval); + + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + arp_packet_inveral_set_by_tc = interval; + return INM_MANAGER_ERROR_NONE; + } + if (ret != 0) { INM_LOGW("Failed to set arping packet interval"); @@ -350,6 +386,13 @@ int inm_manager_get_arp_packet_interval(int *interval) __INM_FUNC_ENTER__; ret = inm_arping_get_packet_interval(interval); + + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + *interval = arp_packet_inveral_set_by_tc; + return INM_MANAGER_ERROR_NONE; + } + if (ret != 0) { INM_LOGW("Failed to get ARPing packet interval"); __INM_FUNC_EXIT__; @@ -374,11 +417,14 @@ int inm_manager_arp_request_start(char *target_ip) return -1; ret = inm_arping_start(ifname, target_ip, 0, FALSE); + if (ret != 0) { INM_LOGW("Failed to start arping"); if (ret == INM_ARPING_ERROR_IN_PROGRESS) ret = INM_MANAGER_ERROR_IN_PROGRESS; + else if (ret == INM_ARPING_ERROR_NOT_INITIALIZED) + ret = INM_MANAGER_ERROR_NOT_INITIALIZED; else ret = INM_MANAGER_ERROR_OPERATION_FAILED; } @@ -403,6 +449,11 @@ int inm_manager_arp_request_stop(char *target_ip) return -1; ret = inm_arping_stop(ifname, target_ip); + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + ret = INM_MANAGER_ERROR_NONE; + } + if (ret != 0) { INM_LOGW("Failed to stop arping"); ret = -1; @@ -437,11 +488,14 @@ int inm_manager_default_gateway_start_checking(int timeout) } ret = inm_arping_start(ifname, gateway_ip, timeout, TRUE); + if (ret != 0) { INM_LOGW("Failed to start arping"); if (ret == INM_ARPING_ERROR_IN_PROGRESS) ret = INM_MANAGER_ERROR_IN_PROGRESS; + else if (ret == INM_ARPING_ERROR_NOT_INITIALIZED) + ret = INM_MANAGER_ERROR_NOT_INITIALIZED; else ret = -1; } @@ -475,6 +529,12 @@ int inm_manager_default_gateway_stop_checking() } ret = inm_arping_stop(ifname, gateway_ip); + + if (ret == INM_MANAGER_ERROR_NOT_INITIALIZED) { + INM_LOGI("Not initialied, return ERROR_NOR for TC"); + ret = INM_MANAGER_ERROR_NONE; + } + if (ret != 0) INM_LOGW("Failed to stop arping"); @@ -1274,7 +1334,8 @@ static inline void __init_connman() int ret = 0; __INM_FUNC_ENTER__; - if (!check_monitoring_flag("SupportCommnanMonitoring")) { + if (!check_monitoring_flag("SupportConnmanMonitoring")) { + inm_connman_dummy_init(); INM_LOGI("Connman monitoring not supported"); return; }