Commit 3967eca4 authored by Andrew Zaborowski's avatar Andrew Zaborowski Committed by Thomas Haller

devices/wifi: Add the wifi-backend config option

Let the config file select between creating classes of NMDeviceWifi
(for the usual wpa_supplicant based devices) and NMDeviceIwd depending
on the new NetworkManager.conf setting.

[bgalvani@redhat.com: fix leaking @backend in create_device()]
parent a25d99f5
......@@ -27,8 +27,10 @@
#include "nm-setting-olpc-mesh.h"
#include "nm-device-wifi.h"
#include "nm-device-olpc-mesh.h"
#include "nm-device-iwd.h"
#include "settings/nm-settings-connection.h"
#include "platform/nm-platform.h"
#include "nm-config.h"
/*****************************************************************************/
......@@ -75,6 +77,7 @@ create_device (NMDeviceFactory *factory,
{
NMDeviceWifiCapabilities capabilities;
NM80211Mode mode;
gs_free char *backend = NULL;
g_return_val_if_fail (iface != NULL, NULL);
g_return_val_if_fail (plink != NULL, NULL);
......@@ -98,10 +101,24 @@ create_device (NMDeviceFactory *factory,
return NULL;
}
if (plink->type == NM_LINK_TYPE_WIFI)
return nm_device_wifi_new (iface, capabilities);
else
if (plink->type != NM_LINK_TYPE_WIFI)
return nm_device_olpc_mesh_new (iface);
backend = nm_config_data_get_value (NM_CONFIG_GET_DATA_ORIG,
NM_CONFIG_KEYFILE_GROUP_MAIN,
NM_CONFIG_KEYFILE_KEY_MAIN_WIFI_BACKEND,
NM_CONFIG_GET_VALUE_STRIP);
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI, "(%s) config: backend is %s, %i", iface, backend, WITH_IWD);
if (!backend || !strcasecmp (backend, "wpa_supplicant"))
return nm_device_wifi_new (iface, capabilities);
#if WITH_IWD
else if (!strcasecmp (backend, "iwd"))
return nm_device_iwd_new (iface, capabilities);
#endif
nm_log_warn (LOGD_PLATFORM | LOGD_WIFI, "(%s) config: unknown or unsupported wifi-backend %s", iface, backend);
return NULL;
}
/*****************************************************************************/
......
......@@ -65,6 +65,7 @@
#define NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG "debug"
#define NM_CONFIG_KEYFILE_KEY_MAIN_HOSTNAME_MODE "hostname-mode"
#define NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER "slaves-order"
#define NM_CONFIG_KEYFILE_KEY_MAIN_WIFI_BACKEND "wifi-backend"
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment