Add support for container environment 42/265142/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 12 Oct 2021 02:53:44 +0000 (11:53 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 12 Oct 2021 02:53:44 +0000 (11:53 +0900)
Modified the container's wifi-manager to use the host's network daemons
to allow the container and host to control the same wifi interface.

Change-Id: Ifcdf4f1f722be9aeb4ae14dfc465e6c590f19ef8
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/network_internal.c
src/network_internal.h

index b801b12..43da9a6 100644 (file)
@@ -399,7 +399,14 @@ int _net_dbus_create_gdbus_call(network_info_s *network_info)
                return NET_ERR_APP_NOT_REGISTERED;
        }
 
-       network_info->connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       if (access(CONTAINER_FILE, F_OK) == 0) {
+               network_info->connection = g_dbus_connection_new_for_address_sync(
+                               DBUS_HOST_SYSTEM_BUS_ADDRESS,
+                               G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+                               NULL, NULL, &error);
+       } else
+               network_info->connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+
        if (network_info->connection == NULL) {
                if (error != NULL) {
                        WIFI_LOG(WIFI_ERROR,
index 386f147..5176b7a 100644 (file)
@@ -122,7 +122,8 @@ extern "C" {
 #define NETCONFIG_SIGNAL_DPP_FAILED "DppFailed"
 #define NETCONFIG_SIGNAL_DPP_REMOVED "DppRemoved"
 
-
+#define CONTAINER_FILE "/run/systemd/container"
+#define DBUS_HOST_SYSTEM_BUS_ADDRESS "unix:path=/run/host/dbus/system_bus_socket"
 
 #define __NETWORK_FUNC_ENTER__         /*WIFI_LOG(WIFI_INFO, "Enter (%s)", __func__);*/
 #define __NETWORK_FUNC_EXIT__          /*WIFI_LOG(WIFI_INFO, "Quit (%s)", __func__);*/