mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
supplicant: add an enum to specify the driver
With macsec we now have 3 drivers and a boolean is no longer enough.
This commit is contained in:
parent
17da42704a
commit
0150b644ed
|
@ -776,7 +776,7 @@ supplicant_interface_init (NMDeviceEthernet *self)
|
|||
|
||||
priv->supplicant.iface = nm_supplicant_manager_create_interface (priv->supplicant.mgr,
|
||||
nm_device_get_iface (NM_DEVICE (self)),
|
||||
FALSE);
|
||||
NM_SUPPLICANT_DRIVER_WIRED);
|
||||
|
||||
if (!priv->supplicant.iface) {
|
||||
_LOGE (LOGD_DEVICE | LOGD_ETHER,
|
||||
|
|
|
@ -232,7 +232,7 @@ supplicant_interface_acquire (NMDeviceWifi *self)
|
|||
|
||||
priv->sup_iface = nm_supplicant_manager_create_interface (priv->sup_mgr,
|
||||
nm_device_get_iface (NM_DEVICE (self)),
|
||||
TRUE);
|
||||
NM_SUPPLICANT_DRIVER_WIRELESS);
|
||||
if (!priv->sup_iface) {
|
||||
_LOGE (LOGD_WIFI, "Couldn't initialize supplicant interface");
|
||||
return FALSE;
|
||||
|
|
|
@ -56,14 +56,14 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSupplicantInterface,
|
|||
PROP_IFACE,
|
||||
PROP_SCANNING,
|
||||
PROP_CURRENT_BSS,
|
||||
PROP_IS_WIRELESS,
|
||||
PROP_DRIVER,
|
||||
PROP_FAST_SUPPORTED,
|
||||
PROP_AP_SUPPORT,
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
char * dev;
|
||||
bool is_wireless;
|
||||
NMSupplicantDriver driver;
|
||||
bool fast_supported;
|
||||
gboolean has_credreq; /* Whether querying 802.1x credentials is supported */
|
||||
NMSupplicantFeature ap_support; /* Lightweight AP mode support */
|
||||
|
@ -918,6 +918,7 @@ on_wpas_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_d
|
|||
gs_free_error GError *error = NULL;
|
||||
GDBusProxy *wpas_proxy;
|
||||
GVariantBuilder props;
|
||||
const char *driver_name = NULL;
|
||||
|
||||
wpas_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
|
||||
if (!wpas_proxy) {
|
||||
|
@ -939,10 +940,24 @@ on_wpas_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_d
|
|||
* when the supplicant has started.
|
||||
*/
|
||||
|
||||
switch (priv->driver) {
|
||||
case NM_SUPPLICANT_DRIVER_WIRELESS:
|
||||
driver_name = DEFAULT_WIFI_DRIVER;
|
||||
break;
|
||||
case NM_SUPPLICANT_DRIVER_WIRED:
|
||||
driver_name = "wired";
|
||||
break;
|
||||
case NM_SUPPLICANT_DRIVER_MACSEC:
|
||||
driver_name = "macsec_linux";
|
||||
break;
|
||||
}
|
||||
|
||||
g_return_if_fail (driver_name);
|
||||
|
||||
g_variant_builder_init (&props, G_VARIANT_TYPE_VARDICT);
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
"Driver",
|
||||
g_variant_new_string (priv->is_wireless ? DEFAULT_WIFI_DRIVER : "wired"));
|
||||
g_variant_new_string (driver_name));
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
"Ifname",
|
||||
g_variant_new_string (priv->dev));
|
||||
|
@ -1448,7 +1463,7 @@ nm_supplicant_interface_get_max_scan_ssids (NMSupplicantInterface *self)
|
|||
|
||||
NMSupplicantInterface *
|
||||
nm_supplicant_interface_new (const char *ifname,
|
||||
gboolean is_wireless,
|
||||
NMSupplicantDriver driver,
|
||||
gboolean fast_supported,
|
||||
NMSupplicantFeature ap_support)
|
||||
{
|
||||
|
@ -1456,7 +1471,7 @@ nm_supplicant_interface_new (const char *ifname,
|
|||
|
||||
return g_object_new (NM_TYPE_SUPPLICANT_INTERFACE,
|
||||
NM_SUPPLICANT_INTERFACE_IFACE, ifname,
|
||||
NM_SUPPLICANT_INTERFACE_IS_WIRELESS, is_wireless,
|
||||
NM_SUPPLICANT_INTERFACE_DRIVER, (guint) driver,
|
||||
NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED, fast_supported,
|
||||
NM_SUPPLICANT_INTERFACE_AP_SUPPORT, (int) ap_support,
|
||||
NULL);
|
||||
|
@ -1485,9 +1500,9 @@ set_property (GObject *object,
|
|||
priv->dev = g_value_dup_string (value);
|
||||
g_return_if_fail (priv->dev);
|
||||
break;
|
||||
case PROP_IS_WIRELESS:
|
||||
case PROP_DRIVER:
|
||||
/* construct-only */
|
||||
priv->is_wireless = g_value_get_boolean (value);
|
||||
priv->driver = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_FAST_SUPPORTED:
|
||||
/* construct-only */
|
||||
|
@ -1576,12 +1591,12 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
|
|||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_properties[PROP_IS_WIRELESS] =
|
||||
g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_IS_WIRELESS, "", "",
|
||||
TRUE,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_properties[PROP_DRIVER] =
|
||||
g_param_spec_uint (NM_SUPPLICANT_INTERFACE_DRIVER, "", "",
|
||||
0, G_MAXUINT, NM_SUPPLICANT_DRIVER_WIRELESS,
|
||||
G_PARAM_WRITABLE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_properties[PROP_FAST_SUPPORTED] =
|
||||
g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED, "", "",
|
||||
TRUE,
|
||||
|
|
|
@ -57,7 +57,7 @@ enum {
|
|||
#define NM_SUPPLICANT_INTERFACE_IFACE "iface"
|
||||
#define NM_SUPPLICANT_INTERFACE_SCANNING "scanning"
|
||||
#define NM_SUPPLICANT_INTERFACE_CURRENT_BSS "current-bss"
|
||||
#define NM_SUPPLICANT_INTERFACE_IS_WIRELESS "is-wireless"
|
||||
#define NM_SUPPLICANT_INTERFACE_DRIVER "driver"
|
||||
#define NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED "fast-supported"
|
||||
#define NM_SUPPLICANT_INTERFACE_AP_SUPPORT "ap-support"
|
||||
|
||||
|
@ -76,7 +76,7 @@ typedef struct _NMSupplicantInterfaceClass NMSupplicantInterfaceClass;
|
|||
GType nm_supplicant_interface_get_type (void);
|
||||
|
||||
NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname,
|
||||
gboolean is_wireless,
|
||||
NMSupplicantDriver driver,
|
||||
gboolean fast_supported,
|
||||
NMSupplicantFeature ap_support);
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ _sup_iface_last_ref (gpointer data,
|
|||
NMSupplicantInterface *
|
||||
nm_supplicant_manager_create_interface (NMSupplicantManager *self,
|
||||
const char *ifname,
|
||||
gboolean is_wireless)
|
||||
NMSupplicantDriver driver)
|
||||
{
|
||||
NMSupplicantManagerPrivate *priv;
|
||||
NMSupplicantInterface *iface;
|
||||
|
@ -157,7 +157,7 @@ nm_supplicant_manager_create_interface (NMSupplicantManager *self,
|
|||
}
|
||||
|
||||
iface = nm_supplicant_interface_new (ifname,
|
||||
is_wireless,
|
||||
driver,
|
||||
priv->fast_supported,
|
||||
priv->ap_support);
|
||||
|
||||
|
|
|
@ -40,6 +40,6 @@ NMSupplicantManager *nm_supplicant_manager_get (void);
|
|||
|
||||
NMSupplicantInterface *nm_supplicant_manager_create_interface (NMSupplicantManager *mgr,
|
||||
const char *ifname,
|
||||
gboolean is_wireless);
|
||||
NMSupplicantDriver driver);
|
||||
|
||||
#endif /* __NETWORKMANAGER_SUPPLICANT_MANAGER_H__ */
|
||||
|
|
|
@ -46,6 +46,12 @@ typedef enum {
|
|||
NM_SUPPLICANT_ERROR_CONFIG = 1, /*< nick=Config >*/
|
||||
} NMSupplicantError;
|
||||
|
||||
typedef enum {
|
||||
NM_SUPPLICANT_DRIVER_WIRELESS,
|
||||
NM_SUPPLICANT_DRIVER_WIRED,
|
||||
NM_SUPPLICANT_DRIVER_MACSEC,
|
||||
} NMSupplicantDriver;
|
||||
|
||||
#define NM_SUPPLICANT_ERROR (nm_supplicant_error_quark ())
|
||||
GQuark nm_supplicant_error_quark (void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue