devices/wifi: Add NMDeviceIwd class to support IWD backend

This is very similar to NMDeviceWifi but simplified to remove the things
currently unsupported and with calls to nm_platform_wifi_* and
nm_supplicant_* replaced with IWD DBus API calls.  Only unsecured
infrastructure-mode networks are supported here.

[bgalvani@redhat.com: fix compilation error after rebase for
  NMActRequestGetSecretsCallId]
[thaller@redhat.com: don't use _() macro strings server side.
  Translating strings only makes sense for clients that set environment
  variables accordingly.]
This commit is contained in:
Andrew Zaborowski 2017-12-09 16:28:10 +01:00 committed by Thomas Haller
parent 89bbcb816b
commit ec1db966f7
4 changed files with 1859 additions and 0 deletions

View File

@ -2703,6 +2703,12 @@ src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \
src/devices/wifi/nm-device-olpc-mesh.c \
src/devices/wifi/nm-device-olpc-mesh.h
if WITH_IWD
src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES += \
src/devices/wifi/nm-device-iwd.c \
src/devices/wifi/nm-device-iwd.h
endif
src_devices_wifi_libnm_device_plugin_wifi_la_CPPFLAGS = \
-I$(srcdir)/src \
-I$(builddir)/src \

View File

@ -279,6 +279,26 @@ else
AC_DEFINE(HAVE_NL80211_CRITICAL_PROTOCOL_CMDS, 0, [Define if nl80211 has critical protocol support])
fi
dnl
dnl Default to using wpa_supplicant but allow IWD as wifi backend
dnl
AC_ARG_WITH(iwd,
AS_HELP_STRING([--with-iwd=yes],
[Support IWD as wifi-backend in addition to wpa_supplicant (experimental)]),
ac_with_iwd=$withval, ac_with_iwd="no")
if test "$ac_with_iwd" != 'no'; then
ac_with_iwd='yes'
fi
if test x"$ac_with_iwd" = x"yes"; then
if test "$enable_wifi" != "yes"; then
AC_MSG_ERROR(Enabling IWD support and disabling Wi-Fi makes no sense)
fi
AC_DEFINE(WITH_IWD, 1, [Define to compile with the IWD wifi-backend])
else
AC_DEFINE(WITH_IWD, 0, [Define to compile without the IWD wifi-backend])
fi
AM_CONDITIONAL(WITH_IWD, test x"${ac_with_iwd}" = x"yes")
dnl
dnl Check for newer VLAN flags
dnl
@ -1417,6 +1437,7 @@ echo " ovs: $enable_ovs"
echo " libnm-glib: $with_libnm_glib"
echo " nmcli: $build_nmcli"
echo " nmtui: $build_nmtui"
echo " iwd: $ac_with_iwd"
echo
echo "Configuration plugins (main.plugins=${config_plugins_default})"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager -- Network link manager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2017 Intel Corporation
*/
#ifndef __NETWORKMANAGER_DEVICE_IWD_H__
#define __NETWORKMANAGER_DEVICE_IWD_H__
#include "devices/nm-device.h"
#include "nm-wifi-ap.h"
#include "nm-device-wifi.h"
#define NM_TYPE_DEVICE_IWD (nm_device_iwd_get_type ())
#define NM_DEVICE_IWD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_IWD, NMDeviceIwd))
#define NM_DEVICE_IWD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_IWD, NMDeviceIwdClass))
#define NM_IS_DEVICE_IWD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_IWD))
#define NM_IS_DEVICE_IWD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_IWD))
#define NM_DEVICE_IWD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_IWD, NMDeviceIwdClass))
#define NM_DEVICE_IWD_MODE NM_DEVICE_WIFI_MODE
#define NM_DEVICE_IWD_BITRATE NM_DEVICE_WIFI_BITRATE
#define NM_DEVICE_IWD_ACCESS_POINTS NM_DEVICE_WIFI_ACCESS_POINTS
#define NM_DEVICE_IWD_ACTIVE_ACCESS_POINT NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT
#define NM_DEVICE_IWD_CAPABILITIES NM_DEVICE_WIFI_CAPABILITIES
#define NM_DEVICE_IWD_SCANNING NM_DEVICE_WIFI_SCANNING
/* signals */
#define NM_DEVICE_IWD_ACCESS_POINT_ADDED NM_DEVICE_WIFI_ACCESS_POINT_ADDED
#define NM_DEVICE_IWD_ACCESS_POINT_REMOVED NM_DEVICE_WIFI_ACCESS_POINT_REMOVED
/* internal signals */
#define NM_DEVICE_IWD_SCANNING_PROHIBITED NM_DEVICE_WIFI_SCANNING_PROHIBITED
typedef struct _NMDeviceIwd NMDeviceIwd;
typedef struct _NMDeviceIwdClass NMDeviceIwdClass;
GType nm_device_iwd_get_type (void);
NMDevice *nm_device_iwd_new (const char *iface, NMDeviceWifiCapabilities capabilities);
#endif /* __NETWORKMANAGER_DEVICE_IWD_H__ */