summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2013-07-04 21:31:28 +0000
committerrpaulo <rpaulo@FreeBSD.org>2013-07-04 21:31:28 +0000
commite6a397a86b346664059134538fccc45498f6a9b5 (patch)
treefd9f235e5dfabfff4ea75e4f405f48dfb866d2b2
parent0b91a49dc386ab3b22c408e885e16a87c0ae7889 (diff)
downloadFreeBSD-src-e6a397a86b346664059134538fccc45498f6a9b5.zip
FreeBSD-src-e6a397a86b346664059134538fccc45498f6a9b5.tar.gz
Remove unused files / directories.
-rw-r--r--contrib/wpa/hostapd/Makefile907
-rw-r--r--contrib/wpa/src/Makefile11
-rw-r--r--contrib/wpa/src/ap/Makefile8
-rw-r--r--contrib/wpa/src/common/Makefile8
-rw-r--r--contrib/wpa/src/crypto/Makefile62
-rw-r--r--contrib/wpa/src/drivers/Makefile9
-rw-r--r--contrib/wpa/src/drivers/android_drv.h60
-rw-r--r--contrib/wpa/src/drivers/drivers.mak183
-rw-r--r--contrib/wpa/src/drivers/drivers.mk187
-rw-r--r--contrib/wpa/src/drivers/linux_wext.h45
-rw-r--r--contrib/wpa/src/drivers/rfkill.c188
-rw-r--r--contrib/wpa/src/drivers/rfkill.h25
-rw-r--r--contrib/wpa/src/eap_common/Makefile8
-rw-r--r--contrib/wpa/src/eap_peer/Makefile11
-rw-r--r--contrib/wpa/src/eap_server/Makefile8
-rw-r--r--contrib/wpa/src/eapol_auth/Makefile8
-rw-r--r--contrib/wpa/src/eapol_supp/Makefile8
-rw-r--r--contrib/wpa/src/l2_packet/Makefile8
-rw-r--r--contrib/wpa/src/lib.rules21
-rw-r--r--contrib/wpa/src/p2p/Makefile9
-rw-r--r--contrib/wpa/src/radius/Makefile22
-rw-r--r--contrib/wpa/src/rsn_supp/Makefile8
-rw-r--r--contrib/wpa/src/tls/Makefile39
-rw-r--r--contrib/wpa/src/utils/Makefile39
-rw-r--r--contrib/wpa/src/wps/Makefile8
-rw-r--r--contrib/wpa/wpa_supplicant/Makefile1630
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/.gitignore1
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/Makefile73
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus-wpa_supplicant.conf27
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_common.c365
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_common.h20
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_common_i.h28
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.c1104
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.h163
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new.c3710
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new.h498
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.c3759
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.h285
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.c2438
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.h211
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_wps.c391
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c1061
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.h150
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_new_introspect.c279
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_old.c743
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_old.h137
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c1462
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.h101
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers_wps.c157
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in5
-rw-r--r--contrib/wpa/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in5
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/.gitignore6
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/Makefile27
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/manpage.links0
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/manpage.refs4
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.884
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.sgml101
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.8210
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.sgml339
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.851
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.sgml85
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.840
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.sgml73
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.8120
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.sgml148
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.8511
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5225
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml239
-rw-r--r--contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.sgml690
69 files changed, 0 insertions, 23646 deletions
diff --git a/contrib/wpa/hostapd/Makefile b/contrib/wpa/hostapd/Makefile
deleted file mode 100644
index d8c01e5..0000000
--- a/contrib/wpa/hostapd/Makefile
+++ /dev/null
@@ -1,907 +0,0 @@
-ifndef CC
-CC=gcc
-endif
-
-ifndef CFLAGS
-CFLAGS = -MMD -O2 -Wall -g
-endif
-
-CFLAGS += -I../src
-CFLAGS += -I../src/utils
-
-# Uncomment following line and set the path to your kernel tree include
-# directory if your C library does not include all header files.
-# CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
-
--include .config
-
-ifndef CONFIG_OS
-ifdef CONFIG_NATIVE_WINDOWS
-CONFIG_OS=win32
-else
-CONFIG_OS=unix
-endif
-endif
-
-ifeq ($(CONFIG_OS), internal)
-CFLAGS += -DOS_NO_C_LIB_DEFINES
-endif
-
-ifdef CONFIG_NATIVE_WINDOWS
-CFLAGS += -DCONFIG_NATIVE_WINDOWS
-LIBS += -lws2_32
-endif
-
-OBJS += main.o
-OBJS += config_file.o
-
-OBJS += ../src/ap/hostapd.o
-OBJS += ../src/ap/wpa_auth_glue.o
-OBJS += ../src/ap/drv_callbacks.o
-OBJS += ../src/ap/ap_drv_ops.o
-OBJS += ../src/ap/utils.o
-OBJS += ../src/ap/authsrv.o
-OBJS += ../src/ap/ieee802_1x.o
-OBJS += ../src/ap/ap_config.o
-OBJS += ../src/ap/eap_user_db.o
-OBJS += ../src/ap/ieee802_11_auth.o
-OBJS += ../src/ap/sta_info.o
-OBJS += ../src/ap/wpa_auth.o
-OBJS += ../src/ap/tkip_countermeasures.o
-OBJS += ../src/ap/ap_mlme.o
-OBJS += ../src/ap/wpa_auth_ie.o
-OBJS += ../src/ap/preauth_auth.o
-OBJS += ../src/ap/pmksa_cache_auth.o
-OBJS += ../src/ap/ieee802_11_shared.o
-OBJS += ../src/ap/beacon.o
-
-OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
-
-NEED_RC4=y
-NEED_AES=y
-NEED_MD5=y
-NEED_SHA1=y
-
-OBJS += ../src/drivers/drivers.o
-CFLAGS += -DHOSTAPD
-
-ifdef CONFIG_WPA_TRACE
-CFLAGS += -DWPA_TRACE
-OBJS += ../src/utils/trace.o
-HOBJS += ../src/utils/trace.o
-LDFLAGS += -rdynamic
-CFLAGS += -funwind-tables
-ifdef CONFIG_WPA_TRACE_BFD
-CFLAGS += -DWPA_TRACE_BFD
-LIBS += -lbfd
-LIBS_c += -lbfd
-LIBS_h += -lbfd
-endif
-endif
-
-ifndef CONFIG_ELOOP
-CONFIG_ELOOP=eloop
-endif
-OBJS += ../src/utils/$(CONFIG_ELOOP).o
-OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
-OBJS += ../src/utils/common.o
-OBJS += ../src/utils/wpa_debug.o
-OBJS_c += ../src/utils/wpa_debug.o
-OBJS += ../src/utils/wpabuf.o
-OBJS += ../src/utils/os_$(CONFIG_OS).o
-OBJS += ../src/utils/ip_addr.o
-
-OBJS += ../src/common/ieee802_11_common.o
-OBJS += ../src/common/wpa_common.o
-
-OBJS += ../src/eapol_auth/eapol_auth_sm.o
-
-
-ifndef CONFIG_NO_DUMP_STATE
-# define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
-# a file (undefine it, if you want to save in binary size)
-CFLAGS += -DHOSTAPD_DUMP_STATE
-OBJS += dump_state.o
-OBJS += ../src/eapol_auth/eapol_auth_dump.o
-endif
-
-ifdef CONFIG_NO_RADIUS
-CFLAGS += -DCONFIG_NO_RADIUS
-CONFIG_NO_ACCOUNTING=y
-else
-OBJS += ../src/radius/radius.o
-OBJS += ../src/radius/radius_client.o
-OBJS += ../src/radius/radius_das.o
-endif
-
-ifdef CONFIG_NO_ACCOUNTING
-CFLAGS += -DCONFIG_NO_ACCOUNTING
-else
-OBJS += ../src/ap/accounting.o
-endif
-
-ifdef CONFIG_NO_VLAN
-CFLAGS += -DCONFIG_NO_VLAN
-else
-OBJS += ../src/ap/vlan_init.o
-ifdef CONFIG_VLAN_NETLINK
-ifdef CONFIG_FULL_DYNAMIC_VLAN
-OBJS += ../src/ap/vlan_util.o
-endif
-CFLAGS += -DCONFIG_VLAN_NETLINK
-endif
-endif
-
-ifdef CONFIG_NO_CTRL_IFACE
-CFLAGS += -DCONFIG_NO_CTRL_IFACE
-else
-OBJS += ctrl_iface.o
-OBJS += ../src/ap/ctrl_iface_ap.o
-endif
-
-OBJS += ../src/crypto/md5.o
-
-CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
-
-ifdef CONFIG_IAPP
-CFLAGS += -DCONFIG_IAPP
-OBJS += ../src/ap/iapp.o
-endif
-
-ifdef CONFIG_RSN_PREAUTH
-CFLAGS += -DCONFIG_RSN_PREAUTH
-CONFIG_L2_PACKET=y
-endif
-
-ifdef CONFIG_PEERKEY
-CFLAGS += -DCONFIG_PEERKEY
-OBJS += ../src/ap/peerkey_auth.o
-endif
-
-ifdef CONFIG_IEEE80211W
-CFLAGS += -DCONFIG_IEEE80211W
-NEED_SHA256=y
-NEED_AES_OMAC1=y
-endif
-
-ifdef CONFIG_IEEE80211R
-CFLAGS += -DCONFIG_IEEE80211R
-OBJS += ../src/ap/wpa_auth_ft.o
-NEED_SHA256=y
-NEED_AES_OMAC1=y
-NEED_AES_UNWRAP=y
-endif
-
-ifdef CONFIG_SAE
-CFLAGS += -DCONFIG_SAE
-endif
-
-ifdef CONFIG_WNM
-CFLAGS += -DCONFIG_WNM
-OBJS += ../src/ap/wnm_ap.o
-endif
-
-ifdef CONFIG_IEEE80211N
-CFLAGS += -DCONFIG_IEEE80211N
-endif
-
-ifdef CONFIG_IEEE80211AC
-CFLAGS += -DCONFIG_IEEE80211AC
-endif
-
-include ../src/drivers/drivers.mak
-OBJS += $(DRV_AP_OBJS)
-CFLAGS += $(DRV_AP_CFLAGS)
-LDFLAGS += $(DRV_AP_LDFLAGS)
-LIBS += $(DRV_AP_LIBS)
-
-ifdef CONFIG_L2_PACKET
-ifdef CONFIG_DNET_PCAP
-ifdef CONFIG_L2_FREEBSD
-LIBS += -lpcap
-OBJS += ../src/l2_packet/l2_packet_freebsd.o
-else
-LIBS += -ldnet -lpcap
-OBJS += ../src/l2_packet/l2_packet_pcap.o
-endif
-else
-OBJS += ../src/l2_packet/l2_packet_linux.o
-endif
-else
-OBJS += ../src/l2_packet/l2_packet_none.o
-endif
-
-
-ifdef CONFIG_EAP_MD5
-CFLAGS += -DEAP_SERVER_MD5
-OBJS += ../src/eap_server/eap_server_md5.o
-CHAP=y
-endif
-
-ifdef CONFIG_EAP_TLS
-CFLAGS += -DEAP_SERVER_TLS
-OBJS += ../src/eap_server/eap_server_tls.o
-TLS_FUNCS=y
-endif
-
-ifdef CONFIG_EAP_UNAUTH_TLS
-CFLAGS += -DEAP_SERVER_UNAUTH_TLS
-ifndef CONFIG_EAP_TLS
-OBJS += ../src/eap_server/eap_server_tls.o
-TLS_FUNCS=y
-endif
-endif
-
-ifdef CONFIG_EAP_PEAP
-CFLAGS += -DEAP_SERVER_PEAP
-OBJS += ../src/eap_server/eap_server_peap.o
-OBJS += ../src/eap_common/eap_peap_common.o
-TLS_FUNCS=y
-CONFIG_EAP_MSCHAPV2=y
-endif
-
-ifdef CONFIG_EAP_TTLS
-CFLAGS += -DEAP_SERVER_TTLS
-OBJS += ../src/eap_server/eap_server_ttls.o
-TLS_FUNCS=y
-CHAP=y
-endif
-
-ifdef CONFIG_EAP_MSCHAPV2
-CFLAGS += -DEAP_SERVER_MSCHAPV2
-OBJS += ../src/eap_server/eap_server_mschapv2.o
-MS_FUNCS=y
-endif
-
-ifdef CONFIG_EAP_GTC
-CFLAGS += -DEAP_SERVER_GTC
-OBJS += ../src/eap_server/eap_server_gtc.o
-endif
-
-ifdef CONFIG_EAP_SIM
-CFLAGS += -DEAP_SERVER_SIM
-OBJS += ../src/eap_server/eap_server_sim.o
-CONFIG_EAP_SIM_COMMON=y
-NEED_AES_CBC=y
-endif
-
-ifdef CONFIG_EAP_AKA
-CFLAGS += -DEAP_SERVER_AKA
-OBJS += ../src/eap_server/eap_server_aka.o
-CONFIG_EAP_SIM_COMMON=y
-NEED_SHA256=y
-NEED_AES_CBC=y
-endif
-
-ifdef CONFIG_EAP_AKA_PRIME
-CFLAGS += -DEAP_SERVER_AKA_PRIME
-endif
-
-ifdef CONFIG_EAP_SIM_COMMON
-OBJS += ../src/eap_common/eap_sim_common.o
-# Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
-# replaced with another file implementating the interface specified in
-# eap_sim_db.h.
-OBJS += ../src/eap_server/eap_sim_db.o
-NEED_FIPS186_2_PRF=y
-endif
-
-ifdef CONFIG_EAP_PAX
-CFLAGS += -DEAP_SERVER_PAX
-OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
-endif
-
-ifdef CONFIG_EAP_PSK
-CFLAGS += -DEAP_SERVER_PSK
-OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
-NEED_AES_OMAC1=y
-NEED_AES_ENCBLOCK=y
-NEED_AES_EAX=y
-endif
-
-ifdef CONFIG_EAP_SAKE
-CFLAGS += -DEAP_SERVER_SAKE
-OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
-endif
-
-ifdef CONFIG_EAP_GPSK
-CFLAGS += -DEAP_SERVER_GPSK
-OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
-ifdef CONFIG_EAP_GPSK_SHA256
-CFLAGS += -DEAP_SERVER_GPSK_SHA256
-endif
-NEED_SHA256=y
-NEED_AES_OMAC1=y
-endif
-
-ifdef CONFIG_EAP_PWD
-CFLAGS += -DEAP_SERVER_PWD
-OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o
-NEED_SHA256=y
-endif
-
-ifdef CONFIG_EAP_VENDOR_TEST
-CFLAGS += -DEAP_SERVER_VENDOR_TEST
-OBJS += ../src/eap_server/eap_server_vendor_test.o
-endif
-
-ifdef CONFIG_EAP_FAST
-CFLAGS += -DEAP_SERVER_FAST
-OBJS += ../src/eap_server/eap_server_fast.o
-OBJS += ../src/eap_common/eap_fast_common.o
-TLS_FUNCS=y
-NEED_T_PRF=y
-NEED_AES_UNWRAP=y
-endif
-
-ifdef CONFIG_WPS
-ifdef CONFIG_WPS2
-CFLAGS += -DCONFIG_WPS2
-endif
-
-CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
-OBJS += ../src/utils/uuid.o
-OBJS += ../src/ap/wps_hostapd.o
-OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
-OBJS += ../src/wps/wps.o
-OBJS += ../src/wps/wps_common.o
-OBJS += ../src/wps/wps_attr_parse.o
-OBJS += ../src/wps/wps_attr_build.o
-OBJS += ../src/wps/wps_attr_process.o
-OBJS += ../src/wps/wps_dev_attr.o
-OBJS += ../src/wps/wps_enrollee.o
-OBJS += ../src/wps/wps_registrar.o
-NEED_DH_GROUPS=y
-NEED_SHA256=y
-NEED_BASE64=y
-NEED_AES_CBC=y
-NEED_MODEXP=y
-CONFIG_EAP=y
-
-ifdef CONFIG_WPS_NFC
-CFLAGS += -DCONFIG_WPS_NFC
-OBJS += ../src/wps/ndef.o
-NEED_WPS_OOB=y
-endif
-
-ifdef NEED_WPS_OOB
-CFLAGS += -DCONFIG_WPS_OOB
-endif
-
-ifdef CONFIG_WPS_UPNP
-CFLAGS += -DCONFIG_WPS_UPNP
-OBJS += ../src/wps/wps_upnp.o
-OBJS += ../src/wps/wps_upnp_ssdp.o
-OBJS += ../src/wps/wps_upnp_web.o
-OBJS += ../src/wps/wps_upnp_event.o
-OBJS += ../src/wps/wps_upnp_ap.o
-OBJS += ../src/wps/upnp_xml.o
-OBJS += ../src/wps/httpread.o
-OBJS += ../src/wps/http_client.o
-OBJS += ../src/wps/http_server.o
-endif
-
-ifdef CONFIG_WPS_STRICT
-CFLAGS += -DCONFIG_WPS_STRICT
-OBJS += ../src/wps/wps_validate.o
-endif
-
-ifdef CONFIG_WPS_TESTING
-CFLAGS += -DCONFIG_WPS_TESTING
-endif
-
-endif
-
-ifdef CONFIG_EAP_IKEV2
-CFLAGS += -DEAP_SERVER_IKEV2
-OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
-OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
-NEED_DH_GROUPS=y
-NEED_DH_GROUPS_ALL=y
-NEED_MODEXP=y
-NEED_CIPHER=y
-endif
-
-ifdef CONFIG_EAP_TNC
-CFLAGS += -DEAP_SERVER_TNC
-OBJS += ../src/eap_server/eap_server_tnc.o
-OBJS += ../src/eap_server/tncs.o
-NEED_BASE64=y
-ifndef CONFIG_DRIVER_BSD
-LIBS += -ldl
-endif
-endif
-
-# Basic EAP functionality is needed for EAPOL
-OBJS += eap_register.o
-OBJS += ../src/eap_server/eap_server.o
-OBJS += ../src/eap_common/eap_common.o
-OBJS += ../src/eap_server/eap_server_methods.o
-OBJS += ../src/eap_server/eap_server_identity.o
-CFLAGS += -DEAP_SERVER_IDENTITY
-
-ifdef CONFIG_EAP
-CFLAGS += -DEAP_SERVER
-endif
-
-ifdef CONFIG_PKCS12
-CFLAGS += -DPKCS12_FUNCS
-endif
-
-ifdef MS_FUNCS
-OBJS += ../src/crypto/ms_funcs.o
-NEED_DES=y
-NEED_MD4=y
-endif
-
-ifdef CHAP
-OBJS += ../src/eap_common/chap.o
-endif
-
-ifdef TLS_FUNCS
-NEED_DES=y
-# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
-CFLAGS += -DEAP_TLS_FUNCS
-OBJS += ../src/eap_server/eap_server_tls_common.o
-NEED_TLS_PRF=y
-endif
-
-ifndef CONFIG_TLS
-CONFIG_TLS=openssl
-endif
-
-ifdef CONFIG_TLSV11
-CFLAGS += -DCONFIG_TLSV11
-endif
-
-ifdef CONFIG_TLSV12
-CFLAGS += -DCONFIG_TLSV12
-NEED_SHA256=y
-endif
-
-ifeq ($(CONFIG_TLS), openssl)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_openssl.o
-LIBS += -lssl
-endif
-OBJS += ../src/crypto/crypto_openssl.o
-HOBJS += ../src/crypto/crypto_openssl.o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_openssl.o
-endif
-LIBS += -lcrypto
-LIBS_h += -lcrypto
-endif
-
-ifeq ($(CONFIG_TLS), gnutls)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_gnutls.o
-LIBS += -lgnutls -lgpg-error
-endif
-OBJS += ../src/crypto/crypto_gnutls.o
-HOBJS += ../src/crypto/crypto_gnutls.o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_gnutls.o
-endif
-LIBS += -lgcrypt
-LIBS_h += -lgcrypt
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-
-ifeq ($(CONFIG_TLS), schannel)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_schannel.o
-endif
-OBJS += ../src/crypto/crypto_cryptoapi.o
-OBJS_p += ../src/crypto/crypto_cryptoapi.o
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-
-ifeq ($(CONFIG_TLS), nss)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_nss.o
-LIBS += -lssl3
-endif
-OBJS += ../src/crypto/crypto_nss.o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_nss.o
-endif
-LIBS += -lnss3
-LIBS_h += -lnss3
-CONFIG_INTERNAL_MD4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-
-ifeq ($(CONFIG_TLS), internal)
-ifndef CONFIG_CRYPTO
-CONFIG_CRYPTO=internal
-endif
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/crypto_internal-rsa.o
-OBJS += ../src/crypto/tls_internal.o
-OBJS += ../src/tls/tlsv1_common.o
-OBJS += ../src/tls/tlsv1_record.o
-OBJS += ../src/tls/tlsv1_cred.o
-OBJS += ../src/tls/tlsv1_server.o
-OBJS += ../src/tls/tlsv1_server_write.o
-OBJS += ../src/tls/tlsv1_server_read.o
-OBJS += ../src/tls/asn1.o
-OBJS += ../src/tls/rsa.o
-OBJS += ../src/tls/x509v3.o
-OBJS += ../src/tls/pkcs1.o
-OBJS += ../src/tls/pkcs5.o
-OBJS += ../src/tls/pkcs8.o
-NEED_SHA256=y
-NEED_BASE64=y
-NEED_TLS_PRF=y
-ifdef CONFIG_TLSV12
-NEED_TLS_PRF_SHA256=y
-endif
-NEED_MODEXP=y
-NEED_CIPHER=y
-CFLAGS += -DCONFIG_TLS_INTERNAL
-CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
-endif
-ifdef NEED_CIPHER
-NEED_DES=y
-OBJS += ../src/crypto/crypto_internal-cipher.o
-endif
-ifdef NEED_MODEXP
-OBJS += ../src/crypto/crypto_internal-modexp.o
-OBJS += ../src/tls/bignum.o
-endif
-ifeq ($(CONFIG_CRYPTO), libtomcrypt)
-OBJS += ../src/crypto/crypto_libtomcrypt.o
-LIBS += -ltomcrypt -ltfm
-LIBS_h += -ltomcrypt -ltfm
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-ifeq ($(CONFIG_CRYPTO), internal)
-OBJS += ../src/crypto/crypto_internal.o
-NEED_AES_DEC=y
-CFLAGS += -DCONFIG_CRYPTO_INTERNAL
-ifdef CONFIG_INTERNAL_LIBTOMMATH
-CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
-ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
-CFLAGS += -DLTM_FAST
-endif
-else
-LIBS += -ltommath
-LIBS_h += -ltommath
-endif
-CONFIG_INTERNAL_AES=y
-CONFIG_INTERNAL_DES=y
-CONFIG_INTERNAL_SHA1=y
-CONFIG_INTERNAL_MD4=y
-CONFIG_INTERNAL_MD5=y
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-ifeq ($(CONFIG_CRYPTO), cryptoapi)
-OBJS += ../src/crypto/crypto_cryptoapi.o
-OBJS_p += ../src/crypto/crypto_cryptoapi.o
-CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-endif
-endif
-
-ifeq ($(CONFIG_TLS), none)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_none.o
-CFLAGS += -DEAP_TLS_NONE
-CONFIG_INTERNAL_AES=y
-CONFIG_INTERNAL_SHA1=y
-CONFIG_INTERNAL_MD5=y
-endif
-OBJS += ../src/crypto/crypto_none.o
-OBJS_p += ../src/crypto/crypto_none.o
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-endif
-
-ifndef TLS_FUNCS
-OBJS += ../src/crypto/tls_none.o
-ifeq ($(CONFIG_TLS), internal)
-CONFIG_INTERNAL_AES=y
-CONFIG_INTERNAL_SHA1=y
-CONFIG_INTERNAL_MD5=y
-CONFIG_INTERNAL_RC4=y
-endif
-endif
-
-AESOBJS = # none so far
-ifdef CONFIG_INTERNAL_AES
-AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
-endif
-
-AESOBJS += ../src/crypto/aes-wrap.o
-ifdef NEED_AES_EAX
-AESOBJS += ../src/crypto/aes-eax.o
-NEED_AES_CTR=y
-endif
-ifdef NEED_AES_CTR
-AESOBJS += ../src/crypto/aes-ctr.o
-endif
-ifdef NEED_AES_ENCBLOCK
-AESOBJS += ../src/crypto/aes-encblock.o
-endif
-ifdef NEED_AES_OMAC1
-AESOBJS += ../src/crypto/aes-omac1.o
-endif
-ifdef NEED_AES_UNWRAP
-NEED_AES_DEC=y
-AESOBJS += ../src/crypto/aes-unwrap.o
-endif
-ifdef NEED_AES_CBC
-NEED_AES_DEC=y
-AESOBJS += ../src/crypto/aes-cbc.o
-endif
-ifdef NEED_AES_DEC
-ifdef CONFIG_INTERNAL_AES
-AESOBJS += ../src/crypto/aes-internal-dec.o
-endif
-endif
-ifdef NEED_AES
-OBJS += $(AESOBJS)
-endif
-
-ifdef NEED_SHA1
-ifneq ($(CONFIG_TLS), openssl)
-SHA1OBJS += ../src/crypto/sha1.o
-endif
-SHA1OBJS += ../src/crypto/sha1-prf.o
-ifdef CONFIG_INTERNAL_SHA1
-SHA1OBJS += ../src/crypto/sha1-internal.o
-ifdef NEED_FIPS186_2_PRF
-SHA1OBJS += ../src/crypto/fips_prf_internal.o
-endif
-endif
-ifneq ($(CONFIG_TLS), openssl)
-SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
-endif
-ifdef NEED_T_PRF
-SHA1OBJS += ../src/crypto/sha1-tprf.o
-endif
-ifdef NEED_TLS_PRF
-SHA1OBJS += ../src/crypto/sha1-tlsprf.o
-endif
-endif
-
-ifdef NEED_SHA1
-OBJS += $(SHA1OBJS)
-endif
-
-ifdef NEED_MD5
-ifdef CONFIG_INTERNAL_MD5
-OBJS += ../src/crypto/md5-internal.o
-HOBJS += ../src/crypto/md5-internal.o
-endif
-endif
-
-ifdef NEED_MD4
-ifdef CONFIG_INTERNAL_MD4
-OBJS += ../src/crypto/md4-internal.o
-endif
-endif
-
-ifdef NEED_DES
-ifdef CONFIG_INTERNAL_DES
-OBJS += ../src/crypto/des-internal.o
-endif
-endif
-
-ifdef NEED_RC4
-ifdef CONFIG_INTERNAL_RC4
-OBJS += ../src/crypto/rc4.o
-endif
-endif
-
-ifdef NEED_SHA256
-CFLAGS += -DCONFIG_SHA256
-ifneq ($(CONFIG_TLS), openssl)
-OBJS += ../src/crypto/sha256.o
-endif
-OBJS += ../src/crypto/sha256-prf.o
-ifdef CONFIG_INTERNAL_SHA256
-OBJS += ../src/crypto/sha256-internal.o
-endif
-ifdef NEED_TLS_PRF_SHA256
-OBJS += ../src/crypto/sha256-tlsprf.o
-endif
-endif
-
-ifdef NEED_DH_GROUPS
-OBJS += ../src/crypto/dh_groups.o
-endif
-ifdef NEED_DH_GROUPS_ALL
-CFLAGS += -DALL_DH_GROUPS
-endif
-ifdef CONFIG_INTERNAL_DH_GROUP5
-ifdef NEED_DH_GROUPS
-OBJS += ../src/crypto/dh_group5.o
-endif
-endif
-
-ifdef CONFIG_NO_RANDOM_POOL
-CFLAGS += -DCONFIG_NO_RANDOM_POOL
-else
-OBJS += ../src/crypto/random.o
-HOBJS += ../src/crypto/random.o
-HOBJS += ../src/utils/eloop.o
-HOBJS += $(SHA1OBJS)
-HOBJS += ../src/crypto/md5.o
-endif
-
-ifdef CONFIG_RADIUS_SERVER
-CFLAGS += -DRADIUS_SERVER
-OBJS += ../src/radius/radius_server.o
-endif
-
-ifdef CONFIG_IPV6
-CFLAGS += -DCONFIG_IPV6
-endif
-
-ifdef CONFIG_DRIVER_RADIUS_ACL
-CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
-endif
-
-ifdef CONFIG_FULL_DYNAMIC_VLAN
-# define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
-# and vlan interfaces for the vlan feature.
-CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
-endif
-
-ifdef NEED_BASE64
-OBJS += ../src/utils/base64.o
-endif
-
-ifdef NEED_AP_MLME
-OBJS += ../src/ap/wmm.o
-OBJS += ../src/ap/ap_list.o
-OBJS += ../src/ap/ieee802_11.o
-OBJS += ../src/ap/hw_features.o
-CFLAGS += -DNEED_AP_MLME
-endif
-ifdef CONFIG_IEEE80211N
-OBJS += ../src/ap/ieee802_11_ht.o
-endif
-
-ifdef CONFIG_IEEE80211AC
-OBJS += ../src/ap/ieee802_11_vht.o
-endif
-
-ifdef CONFIG_P2P_MANAGER
-CFLAGS += -DCONFIG_P2P_MANAGER
-OBJS += ../src/ap/p2p_hostapd.o
-endif
-
-ifdef CONFIG_HS20
-CFLAGS += -DCONFIG_HS20
-OBJS += ../src/ap/hs20.o
-CONFIG_INTERWORKING=y
-endif
-
-ifdef CONFIG_INTERWORKING
-CFLAGS += -DCONFIG_INTERWORKING
-OBJS += ../src/common/gas.o
-OBJS += ../src/ap/gas_serv.o
-endif
-
-OBJS += ../src/drivers/driver_common.o
-
-ifdef CONFIG_WPA_CLI_EDIT
-OBJS_c += ../src/utils/edit.o
-else
-OBJS_c += ../src/utils/edit_simple.o
-endif
-
-ifdef CONFIG_NO_STDOUT_DEBUG
-CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
-endif
-
-ifdef CONFIG_DEBUG_FILE
-CFLAGS += -DCONFIG_DEBUG_FILE
-endif
-
-ifdef CONFIG_SQLITE
-CFLAGS += -DCONFIG_SQLITE
-LIBS += -lsqlite3
-LIBS_h += -lsqlite3
-endif
-
-ALL=hostapd hostapd_cli
-
-all: verify_config $(ALL)
-
-Q=@
-E=echo
-ifeq ($(V), 1)
-Q=
-E=true
-endif
-
-%.o: %.c
- $(Q)$(CC) -c -o $@ $(CFLAGS) $<
- @$(E) " CC " $<
-
-verify_config:
- @if [ ! -r .config ]; then \
- echo 'Building hostapd requires a configuration file'; \
- echo '(.config). See README for more instructions. You can'; \
- echo 'run "cp defconfig .config" to create an example'; \
- echo 'configuration.'; \
- exit 1; \
- fi
-
-install: all
- mkdir -p $(DESTDIR)/usr/local/bin
- for i in $(ALL); do cp -f $$i $(DESTDIR)/usr/local/bin/$$i; done
-
-../src/drivers/build.hostapd:
- @if [ -f ../src/drivers/build.wpa_supplicant ]; then \
- $(MAKE) -C ../src/drivers clean; \
- fi
- @touch ../src/drivers/build.hostapd
-
-BCHECK=../src/drivers/build.hostapd
-
-hostapd: $(BCHECK) $(OBJS)
- $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
- @$(E) " LD " $@
-
-ifdef CONFIG_WPA_TRACE
-OBJS_c += ../src/utils/trace.o
-endif
-hostapd_cli: $(OBJS_c)
- $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
- @$(E) " LD " $@
-
-NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) ../src/crypto/md5.o
-ifdef NEED_RC4
-ifdef CONFIG_INTERNAL_RC4
-NOBJS += ../src/crypto/rc4.o
-endif
-endif
-ifdef CONFIG_INTERNAL_MD5
-NOBJS += ../src/crypto/md5-internal.o
-endif
-NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
-NOBJS += ../src/utils/wpa_debug.o
-NOBJS += ../src/utils/wpabuf.o
-ifdef CONFIG_WPA_TRACE
-NOBJS += ../src/utils/trace.o
-LIBS_n += -lbfd
-endif
-ifdef TLS_FUNCS
-LIBS_n += -lcrypto
-endif
-
-HOBJS += hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/utils/wpabuf.o ../src/crypto/milenage.o
-HOBJS += ../src/crypto/aes-encblock.o
-ifdef CONFIG_INTERNAL_AES
-HOBJS += ../src/crypto/aes-internal.o
-HOBJS += ../src/crypto/aes-internal-enc.o
-endif
-
-nt_password_hash: $(NOBJS)
- $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
- @$(E) " LD " $@
-
-hlr_auc_gw: $(HOBJS)
- $(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
- @$(E) " LD " $@
-
-clean:
- $(MAKE) -C ../src clean
- rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
- rm -f *.d
-
--include $(OBJS:%.o=%.d)
diff --git a/contrib/wpa/src/Makefile b/contrib/wpa/src/Makefile
deleted file mode 100644
index d73a175..0000000
--- a/contrib/wpa/src/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-SUBDIRS=ap common crypto drivers eapol_auth eapol_supp eap_common eap_peer eap_server l2_packet p2p radius rsn_supp tls utils wps
-
-all:
- for d in $(SUBDIRS); do [ -d $$d ] && $(MAKE) -C $$d; done
-
-clean:
- for d in $(SUBDIRS); do [ -d $$d ] && $(MAKE) -C $$d clean; done
- rm -f *~
-
-install:
- for d in $(SUBDIRS); do [ -d $$d ] && $(MAKE) -C $$d install; done
diff --git a/contrib/wpa/src/ap/Makefile b/contrib/wpa/src/ap/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/ap/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/common/Makefile b/contrib/wpa/src/common/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/common/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/crypto/Makefile b/contrib/wpa/src/crypto/Makefile
deleted file mode 100644
index a605a65..0000000
--- a/contrib/wpa/src/crypto/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-all: libcrypto.a
-
-clean:
- rm -f *~ *.o *.d libcrypto.a
-
-install:
- @echo Nothing to be made.
-
-
-include ../lib.rules
-
-CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT
-CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
-#CFLAGS += -DALL_DH_GROUPS
-CFLAGS += -DCONFIG_SHA256
-
-LIB_OBJS= \
- aes-cbc.o \
- aes-ccm.o \
- aes-ctr.o \
- aes-eax.o \
- aes-encblock.o \
- aes-gcm.o \
- aes-internal.o \
- aes-internal-dec.o \
- aes-internal-enc.o \
- aes-omac1.o \
- aes-unwrap.o \
- aes-wrap.o \
- des-internal.o \
- dh_group5.o \
- dh_groups.o \
- md4-internal.o \
- md5.o \
- md5-internal.o \
- milenage.o \
- ms_funcs.o \
- rc4.o \
- sha1.o \
- sha1-internal.o \
- sha1-pbkdf2.o \
- sha1-prf.o \
- sha1-tlsprf.o \
- sha1-tprf.o \
- sha256.o \
- sha256-prf.o \
- sha256-tlsprf.o \
- sha256-internal.o
-
-LIB_OBJS += crypto_internal.o
-LIB_OBJS += crypto_internal-cipher.o
-LIB_OBJS += crypto_internal-modexp.o
-LIB_OBJS += crypto_internal-rsa.o
-LIB_OBJS += tls_internal.o
-LIB_OBJS += fips_prf_internal.o
-LIB_OBJS += random.o
-
-
-libcrypto.a: $(LIB_OBJS)
- $(AR) crT $@ $?
-
--include $(OBJS:%.o=%.d)
diff --git a/contrib/wpa/src/drivers/Makefile b/contrib/wpa/src/drivers/Makefile
deleted file mode 100644
index 07600e5..0000000
--- a/contrib/wpa/src/drivers/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
- rm -f build.wpa_supplicant build.hostapd
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/drivers/android_drv.h b/contrib/wpa/src/drivers/android_drv.h
deleted file mode 100644
index 5906527..0000000
--- a/contrib/wpa/src/drivers/android_drv.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Android driver interface
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- */
-
-#ifndef ANDROID_DRV_H
-#define ANDROID_DRV_H
-
-#define WPA_EVENT_DRIVER_STATE "CTRL-EVENT-DRIVER-STATE "
-
-#define MAX_SSID_LEN 32
-
-#define MAX_DRV_CMD_SIZE 248
-#define DRV_NUMBER_SEQUENTIAL_ERRORS 4
-
-#define WEXT_PNOSETUP_HEADER "PNOSETUP "
-#define WEXT_PNOSETUP_HEADER_SIZE 9
-#define WEXT_PNO_TLV_PREFIX 'S'
-#define WEXT_PNO_TLV_VERSION '1'
-#define WEXT_PNO_TLV_SUBVERSION '2'
-#define WEXT_PNO_TLV_RESERVED '0'
-#define WEXT_PNO_VERSION_SIZE 4
-#define WEXT_PNO_AMOUNT 16
-#define WEXT_PNO_SSID_SECTION 'S'
-/* SSID header size is SSID section type above + SSID length */
-#define WEXT_PNO_SSID_HEADER_SIZE 2
-#define WEXT_PNO_SCAN_INTERVAL_SECTION 'T'
-#define WEXT_PNO_SCAN_INTERVAL_LENGTH 2
-#define WEXT_PNO_SCAN_INTERVAL 30
-/* Scan interval size is scan interval section type + scan interval length
- * above */
-#define WEXT_PNO_SCAN_INTERVAL_SIZE (1 + WEXT_PNO_SCAN_INTERVAL_LENGTH)
-#define WEXT_PNO_REPEAT_SECTION 'R'
-#define WEXT_PNO_REPEAT_LENGTH 1
-#define WEXT_PNO_REPEAT 4
-/* Repeat section size is Repeat section type + Repeat value length above */
-#define WEXT_PNO_REPEAT_SIZE (1 + WEXT_PNO_REPEAT_LENGTH)
-#define WEXT_PNO_MAX_REPEAT_SECTION 'M'
-#define WEXT_PNO_MAX_REPEAT_LENGTH 1
-#define WEXT_PNO_MAX_REPEAT 3
-/* Max Repeat section size is Max Repeat section type + Max Repeat value length
- * above */
-#define WEXT_PNO_MAX_REPEAT_SIZE (1 + WEXT_PNO_MAX_REPEAT_LENGTH)
-/* This corresponds to the size of all sections expect SSIDs */
-#define WEXT_PNO_NONSSID_SECTIONS_SIZE \
-(WEXT_PNO_SCAN_INTERVAL_SIZE + WEXT_PNO_REPEAT_SIZE + WEXT_PNO_MAX_REPEAT_SIZE)
-/* PNO Max command size is total of header, version, ssid and other sections +
- * Null termination */
-#define WEXT_PNO_MAX_COMMAND_SIZE \
- (WEXT_PNOSETUP_HEADER_SIZE + WEXT_PNO_VERSION_SIZE \
- + WEXT_PNO_AMOUNT * (WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN) \
- + WEXT_PNO_NONSSID_SECTIONS_SIZE + 1)
-
-#endif /* ANDROID_DRV_H */
diff --git a/contrib/wpa/src/drivers/drivers.mak b/contrib/wpa/src/drivers/drivers.mak
deleted file mode 100644
index c7a98d3..0000000
--- a/contrib/wpa/src/drivers/drivers.mak
+++ /dev/null
@@ -1,183 +0,0 @@
-##### CLEAR VARS
-
-DRV_CFLAGS =
-DRV_WPA_CFLAGS =
-DRV_AP_CFLAGS =
-DRV_OBJS =
-DRV_WPA_OBJS =
-DRV_AP_OBJS =
-DRV_LIBS =
-DRV_WPA_LIBS =
-DRV_AP_LIBS =
-
-##### COMMON DRIVERS
-
-ifdef CONFIG_DRIVER_WIRED
-DRV_CFLAGS += -DCONFIG_DRIVER_WIRED
-DRV_OBJS += ../src/drivers/driver_wired.o
-endif
-
-ifdef CONFIG_DRIVER_NL80211
-DRV_CFLAGS += -DCONFIG_DRIVER_NL80211
-DRV_OBJS += ../src/drivers/driver_nl80211.o
-DRV_OBJS += ../src/utils/radiotap.o
-NEED_SME=y
-NEED_AP_MLME=y
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-NEED_RFKILL=y
-
-ifdef CONFIG_LIBNL32
- DRV_LIBS += -lnl-3
- DRV_LIBS += -lnl-genl-3
- DRV_CFLAGS += -DCONFIG_LIBNL20 -I/usr/include/libnl3
-else
- ifdef CONFIG_LIBNL_TINY
- DRV_LIBS += -lnl-tiny
- else
- DRV_LIBS += -lnl
- endif
-
- ifdef CONFIG_LIBNL20
- DRV_LIBS += -lnl-genl
- DRV_CFLAGS += -DCONFIG_LIBNL20
- endif
-endif
-endif
-
-ifdef CONFIG_DRIVER_BSD
-ifndef CONFIG_L2_PACKET
-CONFIG_L2_PACKET=freebsd
-endif
-DRV_CFLAGS += -DCONFIG_DRIVER_BSD
-DRV_OBJS += ../src/drivers/driver_bsd.o
-CONFIG_L2_FREEBSD=y
-CONFIG_DNET_PCAP=y
-endif
-
-ifdef CONFIG_DRIVER_TEST
-DRV_CFLAGS += -DCONFIG_DRIVER_TEST
-DRV_OBJS += ../src/drivers/driver_test.o
-NEED_AP_MLME=y
-endif
-
-ifdef CONFIG_DRIVER_NONE
-DRV_CFLAGS += -DCONFIG_DRIVER_NONE
-DRV_OBJS += ../src/drivers/driver_none.o
-endif
-
-##### PURE AP DRIVERS
-
-ifdef CONFIG_DRIVER_HOSTAP
-DRV_AP_CFLAGS += -DCONFIG_DRIVER_HOSTAP
-DRV_AP_OBJS += ../src/drivers/driver_hostap.o
-CONFIG_WIRELESS_EXTENSION=y
-NEED_AP_MLME=y
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-endif
-
-ifdef CONFIG_DRIVER_MADWIFI
-DRV_AP_CFLAGS += -DCONFIG_DRIVER_MADWIFI
-DRV_AP_OBJS += ../src/drivers/driver_madwifi.o
-CONFIG_WIRELESS_EXTENSION=y
-CONFIG_L2_PACKET=linux
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-endif
-
-ifdef CONFIG_DRIVER_ATHEROS
-DRV_AP_CFLAGS += -DCONFIG_DRIVER_ATHEROS
-DRV_AP_OBJS += ../src/drivers/driver_atheros.o
-CONFIG_L2_PACKET=linux
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-endif
-
-##### PURE CLIENT DRIVERS
-
-ifdef CONFIG_DRIVER_WEXT
-DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
-CONFIG_WIRELESS_EXTENSION=y
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-NEED_RFKILL=y
-endif
-
-ifdef CONFIG_DRIVER_NDIS
-DRV_WPA_CFLAGS += -DCONFIG_DRIVER_NDIS
-DRV_WPA_OBJS += ../src/drivers/driver_ndis.o
-ifdef CONFIG_NDIS_EVENTS_INTEGRATED
-DRV_WPA_OBJS += ../src/drivers/driver_ndis_.o
-endif
-ifndef CONFIG_L2_PACKET
-CONFIG_L2_PACKET=pcap
-endif
-CONFIG_WINPCAP=y
-ifdef CONFIG_USE_NDISUIO
-DRV_WPA_CFLAGS += -DCONFIG_USE_NDISUIO
-endif
-endif
-
-ifdef CONFIG_DRIVER_ROBOSWITCH
-DRV_WPA_CFLAGS += -DCONFIG_DRIVER_ROBOSWITCH
-DRV_WPA_OBJS += ../src/drivers/driver_roboswitch.o
-endif
-
-ifdef CONFIG_WIRELESS_EXTENSION
-DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
-DRV_WPA_OBJS += ../src/drivers/driver_wext.o
-NEED_RFKILL=y
-endif
-
-ifdef NEED_NETLINK
-DRV_OBJS += ../src/drivers/netlink.o
-endif
-
-ifdef NEED_LINUX_IOCTL
-DRV_OBJS += ../src/drivers/linux_ioctl.o
-endif
-
-ifdef NEED_RFKILL
-DRV_OBJS += ../src/drivers/rfkill.o
-endif
-
-ifdef CONFIG_VLAN_NETLINK
-ifdef CONFIG_FULL_DYNAMIC_VLAN
-ifdef CONFIG_LIBNL32
- DRV_LIBS += -lnl-3
- DRV_LIBS += -lnl-genl-3
- DRV_LIBS += -lnl-route-3
- DRV_CFLAGS += -DCONFIG_LIBNL20
-else
- ifdef CONFIG_LIBNL_TINY
- DRV_LIBS += -lnl-tiny
- else
- DRV_LIBS += -lnl
- endif
-
- ifdef CONFIG_LIBNL20
- DRV_LIBS += -lnl-genl
- DRV_LIBS += -lnl-route
- DRV_CFLAGS += -DCONFIG_LIBNL20
- endif
-endif
-endif
-endif
-
-##### COMMON VARS
-DRV_BOTH_CFLAGS := $(DRV_CFLAGS) $(DRV_WPA_CFLAGS) $(DRV_AP_CFLAGS)
-DRV_WPA_CFLAGS += $(DRV_CFLAGS)
-DRV_AP_CFLAGS += $(DRV_CFLAGS)
-
-DRV_BOTH_LIBS := $(DRV_LIBS) $(DRV_WPA_LIBS) $(DRV_AP_LIBS)
-DRV_WPA_LIBS += $(DRV_LIBS)
-DRV_AP_LIBS += $(DRV_LIBS)
-
-DRV_BOTH_OBJS := $(DRV_OBJS) $(DRV_WPA_OBJS) $(DRV_AP_OBJS)
-DRV_WPA_OBJS += $(DRV_OBJS)
-DRV_AP_OBJS += $(DRV_OBJS)
-
-DRV_BOTH_LDFLAGS := $(DRV_LDFLAGS) $(DRV_WPA_LDFLAGS) $(DRV_AP_LDFLAGS)
-DRV_WPA_LDFLAGS += $(DRV_LDFLAGS)
-DRV_AP_LDFLAGS += $(DRV_LDFLAGS)
diff --git a/contrib/wpa/src/drivers/drivers.mk b/contrib/wpa/src/drivers/drivers.mk
deleted file mode 100644
index 23fcbb7..0000000
--- a/contrib/wpa/src/drivers/drivers.mk
+++ /dev/null
@@ -1,187 +0,0 @@
-##### CLEAR VARS
-
-DRV_CFLAGS =
-DRV_WPA_CFLAGS =
-DRV_AP_CFLAGS =
-DRV_OBJS =
-DRV_WPA_OBJS =
-DRV_AP_OBJS =
-DRV_LIBS =
-DRV_WPA_LIBS =
-DRV_AP_LIBS =
-
-##### COMMON DRIVERS
-
-ifdef CONFIG_DRIVER_WIRED
-DRV_CFLAGS += -DCONFIG_DRIVER_WIRED
-DRV_OBJS += src/drivers/driver_wired.c
-endif
-
-ifdef CONFIG_DRIVER_NL80211
-DRV_CFLAGS += -DCONFIG_DRIVER_NL80211
-DRV_OBJS += src/drivers/driver_nl80211.c
-DRV_OBJS += src/utils/radiotap.c
-NEED_SME=y
-NEED_AP_MLME=y
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-NEED_RFKILL=y
-
-ifdef CONFIG_LIBNL32
- DRV_LIBS += -lnl-3
- DRV_LIBS += -lnl-genl-3
- DRV_CFLAGS += -DCONFIG_LIBNL20 -I/usr/include/libnl3
-else
- ifdef CONFIG_LIBNL_TINY
- DRV_LIBS += -lnl-tiny
- else
- DRV_LIBS += -lnl
- endif
-
- ifdef CONFIG_LIBNL20
- DRV_LIBS += -lnl-genl
- DRV_CFLAGS += -DCONFIG_LIBNL20
- endif
-endif
-endif
-
-ifdef CONFIG_DRIVER_BSD
-ifndef CONFIG_L2_PACKET
-CONFIG_L2_PACKET=freebsd
-endif
-DRV_CFLAGS += -DCONFIG_DRIVER_BSD
-DRV_OBJS += src/drivers/driver_bsd.c
-CONFIG_L2_FREEBSD=y
-CONFIG_DNET_PCAP=y
-endif
-
-ifdef CONFIG_DRIVER_TEST
-DRV_CFLAGS += -DCONFIG_DRIVER_TEST
-DRV_OBJS += src/drivers/driver_test.c
-NEED_AP_MLME=y
-endif
-
-ifdef CONFIG_DRIVER_NONE
-DRV_CFLAGS += -DCONFIG_DRIVER_NONE
-DRV_OBJS += src/drivers/driver_none.c
-endif
-
-##### PURE AP DRIVERS
-
-ifdef CONFIG_DRIVER_HOSTAP
-DRV_AP_CFLAGS += -DCONFIG_DRIVER_HOSTAP
-DRV_AP_OBJS += src/drivers/driver_hostap.c
-CONFIG_WIRELESS_EXTENSION=y
-NEED_AP_MLME=y
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-endif
-
-ifdef CONFIG_DRIVER_MADWIFI
-DRV_AP_CFLAGS += -DCONFIG_DRIVER_MADWIFI
-DRV_AP_OBJS += src/drivers/driver_madwifi.c
-CONFIG_WIRELESS_EXTENSION=y
-CONFIG_L2_PACKET=linux
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-endif
-
-ifdef CONFIG_DRIVER_ATHEROS
-DRV_AP_CFLAGS += -DCONFIG_DRIVER_ATHEROS
-DRV_AP_OBJS += src/drivers/driver_atheros.c
-CONFIG_L2_PACKET=linux
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-endif
-
-##### PURE CLIENT DRIVERS
-
-ifdef CONFIG_DRIVER_WEXT
-DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
-CONFIG_WIRELESS_EXTENSION=y
-NEED_NETLINK=y
-NEED_LINUX_IOCTL=y
-NEED_RFKILL=y
-endif
-
-ifdef CONFIG_DRIVER_NDIS
-DRV_WPA_CFLAGS += -DCONFIG_DRIVER_NDIS
-DRV_WPA_OBJS += src/drivers/driver_ndis.c
-ifdef CONFIG_NDIS_EVENTS_INTEGRATED
-DRV_WPA_OBJS += src/drivers/driver_ndis_.c
-endif
-ifndef CONFIG_L2_PACKET
-CONFIG_L2_PACKET=pcap
-endif
-CONFIG_WINPCAP=y
-ifdef CONFIG_USE_NDISUIO
-DRV_WPA_CFLAGS += -DCONFIG_USE_NDISUIO
-endif
-endif
-
-ifdef CONFIG_DRIVER_ROBOSWITCH
-DRV_WPA_CFLAGS += -DCONFIG_DRIVER_ROBOSWITCH
-DRV_WPA_OBJS += src/drivers/driver_roboswitch.c
-endif
-
-ifdef CONFIG_WIRELESS_EXTENSION
-DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
-DRV_WPA_OBJS += src/drivers/driver_wext.c
-NEED_RFKILL=y
-endif
-
-ifdef NEED_NETLINK
-DRV_OBJS += src/drivers/netlink.c
-endif
-
-ifdef NEED_LINUX_IOCTL
-DRV_OBJS += src/drivers/linux_ioctl.c
-endif
-
-ifdef NEED_RFKILL
-DRV_OBJS += src/drivers/rfkill.c
-endif
-
-ifdef CONFIG_DRIVER_CUSTOM
-DRV_CFLAGS += -DCONFIG_DRIVER_CUSTOM
-endif
-
-ifdef CONFIG_VLAN_NETLINK
-ifdef CONFIG_FULL_DYNAMIC_VLAN
-ifdef CONFIG_LIBNL32
- DRV_LIBS += -lnl-3
- DRV_LIBS += -lnl-genl-3
- DRV_LIBS += -lnl-route-3
- DRV_CFLAGS += -DCONFIG_LIBNL20
-else
- ifdef CONFIG_LIBNL_TINY
- DRV_LIBS += -lnl-tiny
- else
- DRV_LIBS += -lnl
- endif
-
- ifdef CONFIG_LIBNL20
- DRV_LIBS += -lnl-genl
- DRV_LIBS += -lnl-route
- DRV_CFLAGS += -DCONFIG_LIBNL20
- endif
-endif
-endif
-endif
-
-##### COMMON VARS
-DRV_BOTH_CFLAGS := $(DRV_CFLAGS) $(DRV_WPA_CFLAGS) $(DRV_AP_CFLAGS)
-DRV_WPA_CFLAGS += $(DRV_CFLAGS)
-DRV_AP_CFLAGS += $(DRV_CFLAGS)
-
-DRV_BOTH_LIBS := $(DRV_LIBS) $(DRV_WPA_LIBS) $(DRV_AP_LIBS)
-DRV_WPA_LIBS += $(DRV_LIBS)
-DRV_AP_LIBS += $(DRV_LIBS)
-
-DRV_BOTH_OBJS := $(DRV_OBJS) $(DRV_WPA_OBJS) $(DRV_AP_OBJS)
-DRV_WPA_OBJS += $(DRV_OBJS)
-DRV_AP_OBJS += $(DRV_OBJS)
-
-DRV_BOTH_LDFLAGS := $(DRV_LDFLAGS) $(DRV_WPA_LDFLAGS) $(DRV_AP_LDFLAGS)
-DRV_WPA_LDFLAGS += $(DRV_LDFLAGS)
-DRV_AP_LDFLAGS += $(DRV_LDFLAGS)
diff --git a/contrib/wpa/src/drivers/linux_wext.h b/contrib/wpa/src/drivers/linux_wext.h
deleted file mode 100644
index 55cf955..0000000
--- a/contrib/wpa/src/drivers/linux_wext.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Driver interaction with generic Linux Wireless Extensions
- * Copyright (c) 2003-2011, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef LINUX_WEXT_H
-#define LINUX_WEXT_H
-
-#ifndef ANDROID
-
-/*
- * Avoid including other kernel header to avoid conflicts with C library
- * headers.
- */
-#define _LINUX_TYPES_H
-#define _LINUX_SOCKET_H
-#define _LINUX_IF_H
-
-#include <sys/types.h>
-#include <net/if.h>
-typedef __uint32_t __u32;
-typedef __int32_t __s32;
-typedef __uint16_t __u16;
-typedef __int16_t __s16;
-typedef __uint8_t __u8;
-#ifndef __user
-#define __user
-#endif /* __user */
-
-#endif /* ANDROID */
-
-#include <linux/wireless.h>
-
-#ifndef IW_ENCODE_ALG_PMK
-#define IW_ENCODE_ALG_PMK 4
-#endif
-
-#ifndef IW_ENC_CAPA_4WAY_HANDSHAKE
-#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010
-#endif
-
-#endif /* LINUX_WEXT_H */
diff --git a/contrib/wpa/src/drivers/rfkill.c b/contrib/wpa/src/drivers/rfkill.c
deleted file mode 100644
index 45b26c4..0000000
--- a/contrib/wpa/src/drivers/rfkill.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Linux rfkill helper functions for driver wrappers
- * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-#include <fcntl.h>
-
-#include "utils/common.h"
-#include "utils/eloop.h"
-#include "rfkill.h"
-
-#define RFKILL_EVENT_SIZE_V1 8
-
-struct rfkill_event {
- u32 idx;
- u8 type;
- u8 op;
- u8 soft;
- u8 hard;
-} STRUCT_PACKED;
-
-enum rfkill_operation {
- RFKILL_OP_ADD = 0,
- RFKILL_OP_DEL,
- RFKILL_OP_CHANGE,
- RFKILL_OP_CHANGE_ALL,
-};
-
-enum rfkill_type {
- RFKILL_TYPE_ALL = 0,
- RFKILL_TYPE_WLAN,
- RFKILL_TYPE_BLUETOOTH,
- RFKILL_TYPE_UWB,
- RFKILL_TYPE_WIMAX,
- RFKILL_TYPE_WWAN,
- RFKILL_TYPE_GPS,
- RFKILL_TYPE_FM,
- NUM_RFKILL_TYPES,
-};
-
-
-struct rfkill_data {
- struct rfkill_config *cfg;
- int fd;
- int blocked;
-};
-
-
-static void rfkill_receive(int sock, void *eloop_ctx, void *sock_ctx)
-{
- struct rfkill_data *rfkill = eloop_ctx;
- struct rfkill_event event;
- ssize_t len;
- int new_blocked;
-
- len = read(rfkill->fd, &event, sizeof(event));
- if (len < 0) {
- wpa_printf(MSG_ERROR, "rfkill: Event read failed: %s",
- strerror(errno));
- return;
- }
- if (len != RFKILL_EVENT_SIZE_V1) {
- wpa_printf(MSG_DEBUG, "rfkill: Unexpected event size "
- "%d (expected %d)",
- (int) len, RFKILL_EVENT_SIZE_V1);
- return;
- }
- wpa_printf(MSG_DEBUG, "rfkill: event: idx=%u type=%d "
- "op=%u soft=%u hard=%u",
- event.idx, event.type, event.op, event.soft,
- event.hard);
- if (event.op != RFKILL_OP_CHANGE || event.type != RFKILL_TYPE_WLAN)
- return;
-
- if (event.hard) {
- wpa_printf(MSG_INFO, "rfkill: WLAN hard blocked");
- new_blocked = 1;
- } else if (event.soft) {
- wpa_printf(MSG_INFO, "rfkill: WLAN soft blocked");
- new_blocked = 1;
- } else {
- wpa_printf(MSG_INFO, "rfkill: WLAN unblocked");
- new_blocked = 0;
- }
-
- if (new_blocked != rfkill->blocked) {
- rfkill->blocked = new_blocked;
- if (new_blocked)
- rfkill->cfg->blocked_cb(rfkill->cfg->ctx);
- else
- rfkill->cfg->unblocked_cb(rfkill->cfg->ctx);
- }
-}
-
-
-struct rfkill_data * rfkill_init(struct rfkill_config *cfg)
-{
- struct rfkill_data *rfkill;
- struct rfkill_event event;
- ssize_t len;
-
- rfkill = os_zalloc(sizeof(*rfkill));
- if (rfkill == NULL)
- return NULL;
-
- rfkill->cfg = cfg;
- rfkill->fd = open("/dev/rfkill", O_RDONLY);
- if (rfkill->fd < 0) {
- wpa_printf(MSG_INFO, "rfkill: Cannot open RFKILL control "
- "device");
- goto fail;
- }
-
- if (fcntl(rfkill->fd, F_SETFL, O_NONBLOCK) < 0) {
- wpa_printf(MSG_ERROR, "rfkill: Cannot set non-blocking mode: "
- "%s", strerror(errno));
- goto fail2;
- }
-
- for (;;) {
- len = read(rfkill->fd, &event, sizeof(event));
- if (len < 0) {
- if (errno == EAGAIN)
- break; /* No more entries */
- wpa_printf(MSG_ERROR, "rfkill: Event read failed: %s",
- strerror(errno));
- break;
- }
- if (len != RFKILL_EVENT_SIZE_V1) {
- wpa_printf(MSG_DEBUG, "rfkill: Unexpected event size "
- "%d (expected %d)",
- (int) len, RFKILL_EVENT_SIZE_V1);
- continue;
- }
- wpa_printf(MSG_DEBUG, "rfkill: initial event: idx=%u type=%d "
- "op=%u soft=%u hard=%u",
- event.idx, event.type, event.op, event.soft,
- event.hard);
- if (event.op != RFKILL_OP_ADD ||
- event.type != RFKILL_TYPE_WLAN)
- continue;
- if (event.hard) {
- wpa_printf(MSG_INFO, "rfkill: WLAN hard blocked");
- rfkill->blocked = 1;
- } else if (event.soft) {
- wpa_printf(MSG_INFO, "rfkill: WLAN soft blocked");
- rfkill->blocked = 1;
- }
- }
-
- eloop_register_read_sock(rfkill->fd, rfkill_receive, rfkill, NULL);
-
- return rfkill;
-
-fail2:
- close(rfkill->fd);
-fail:
- os_free(rfkill);
- return NULL;
-}
-
-
-void rfkill_deinit(struct rfkill_data *rfkill)
-{
- if (rfkill == NULL)
- return;
-
- if (rfkill->fd >= 0) {
- eloop_unregister_read_sock(rfkill->fd);
- close(rfkill->fd);
- }
-
- os_free(rfkill->cfg);
- os_free(rfkill);
-}
-
-
-int rfkill_is_blocked(struct rfkill_data *rfkill)
-{
- if (rfkill == NULL)
- return 0;
-
- return rfkill->blocked;
-}
diff --git a/contrib/wpa/src/drivers/rfkill.h b/contrib/wpa/src/drivers/rfkill.h
deleted file mode 100644
index 0412ac3..0000000
--- a/contrib/wpa/src/drivers/rfkill.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Linux rfkill helper functions for driver wrappers
- * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef RFKILL_H
-#define RFKILL_H
-
-struct rfkill_data;
-
-struct rfkill_config {
- void *ctx;
- char ifname[IFNAMSIZ];
- void (*blocked_cb)(void *ctx);
- void (*unblocked_cb)(void *ctx);
-};
-
-struct rfkill_data * rfkill_init(struct rfkill_config *cfg);
-void rfkill_deinit(struct rfkill_data *rfkill);
-int rfkill_is_blocked(struct rfkill_data *rfkill);
-
-#endif /* RFKILL_H */
diff --git a/contrib/wpa/src/eap_common/Makefile b/contrib/wpa/src/eap_common/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/eap_common/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/eap_peer/Makefile b/contrib/wpa/src/eap_peer/Makefile
deleted file mode 100644
index 3651056..0000000
--- a/contrib/wpa/src/eap_peer/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.so *.d
-
-install:
- if ls *.so >/dev/null 2>&1; then \
- install -d $(DESTDIR)$(LIBDIR)/wpa_supplicant && \
- cp *.so $(DESTDIR)$(LIBDIR)/wpa_supplicant \
- ; fi
diff --git a/contrib/wpa/src/eap_server/Makefile b/contrib/wpa/src/eap_server/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/eap_server/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/eapol_auth/Makefile b/contrib/wpa/src/eapol_auth/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/eapol_auth/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/eapol_supp/Makefile b/contrib/wpa/src/eapol_supp/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/eapol_supp/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/l2_packet/Makefile b/contrib/wpa/src/l2_packet/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/l2_packet/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/lib.rules b/contrib/wpa/src/lib.rules
deleted file mode 100644
index b260d25..0000000
--- a/contrib/wpa/src/lib.rules
+++ /dev/null
@@ -1,21 +0,0 @@
-ifndef CC
-CC=gcc
-endif
-
-ifndef CFLAGS
-CFLAGS = -MMD -O2 -Wall -g
-endif
-
-CFLAGS += -I.. -I../utils
-
-
-Q=@
-E=echo
-ifeq ($(V), 1)
-Q=
-E=true
-endif
-
-%.o: %.c
- $(Q)$(CC) -c -o $@ $(CFLAGS) $<
- @$(E) " CC " $<
diff --git a/contrib/wpa/src/p2p/Makefile b/contrib/wpa/src/p2p/Makefile
deleted file mode 100644
index cffba62..0000000
--- a/contrib/wpa/src/p2p/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- for d in $(SUBDIRS); do make -C $$d clean; done
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/radius/Makefile b/contrib/wpa/src/radius/Makefile
deleted file mode 100644
index b199be8..0000000
--- a/contrib/wpa/src/radius/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-all: libradius.a
-
-clean:
- rm -f *~ *.o *.d libradius.a
-
-install:
- @echo Nothing to be made.
-
-
-include ../lib.rules
-
-CFLAGS += -DCONFIG_IPV6
-
-LIB_OBJS= \
- radius.o \
- radius_client.o \
- radius_server.o
-
-libradius.a: $(LIB_OBJS)
- $(AR) crT $@ $?
-
--include $(OBJS:%.o=%.d)
diff --git a/contrib/wpa/src/rsn_supp/Makefile b/contrib/wpa/src/rsn_supp/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/rsn_supp/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/src/tls/Makefile b/contrib/wpa/src/tls/Makefile
deleted file mode 100644
index 27cdfca..0000000
--- a/contrib/wpa/src/tls/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-all: libtls.a
-
-clean:
- rm -f *~ *.o *.d libtls.a
-
-install:
- @echo Nothing to be made.
-
-
-include ../lib.rules
-
-CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
-CFLAGS += -DCONFIG_CRYPTO_INTERNAL
-CFLAGS += -DCONFIG_TLSV11
-CFLAGS += -DCONFIG_TLSV12
-
-LIB_OBJS= \
- asn1.o \
- bignum.o \
- pkcs1.o \
- pkcs5.o \
- pkcs8.o \
- rsa.o \
- tlsv1_client.o \
- tlsv1_client_read.o \
- tlsv1_client_write.o \
- tlsv1_common.o \
- tlsv1_cred.o \
- tlsv1_record.o \
- tlsv1_server.o \
- tlsv1_server_read.o \
- tlsv1_server_write.o \
- x509v3.o
-
-
-libtls.a: $(LIB_OBJS)
- $(AR) crT $@ $?
-
--include $(OBJS:%.o=%.d)
diff --git a/contrib/wpa/src/utils/Makefile b/contrib/wpa/src/utils/Makefile
deleted file mode 100644
index 0f1f191..0000000
--- a/contrib/wpa/src/utils/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-all: libutils.a
-
-clean:
- rm -f *~ *.o *.d libutils.a
-
-install:
- @echo Nothing to be made.
-
-
-include ../lib.rules
-
-#CFLAGS += -DWPA_TRACE
-CFLAGS += -DCONFIG_IPV6
-
-LIB_OBJS= \
- base64.o \
- common.o \
- ip_addr.o \
- radiotap.o \
- trace.o \
- uuid.o \
- wpa_debug.o \
- wpabuf.o
-
-# Pick correct OS wrapper implementation
-LIB_OBJS += os_unix.o
-
-# Pick correct event loop implementation
-LIB_OBJS += eloop.o
-
-# Pick correct edit implementation
-LIB_OBJS += edit.o
-
-#LIB_OBJS += pcsc_funcs.o
-
-libutils.a: $(LIB_OBJS)
- $(AR) crT $@ $?
-
--include $(OBJS:%.o=%.d)
diff --git a/contrib/wpa/src/wps/Makefile b/contrib/wpa/src/wps/Makefile
deleted file mode 100644
index 9c41962..0000000
--- a/contrib/wpa/src/wps/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all:
- @echo Nothing to be made.
-
-clean:
- rm -f *~ *.o *.d
-
-install:
- @echo Nothing to be made.
diff --git a/contrib/wpa/wpa_supplicant/Makefile b/contrib/wpa/wpa_supplicant/Makefile
deleted file mode 100644
index 65fef41..0000000
--- a/contrib/wpa/wpa_supplicant/Makefile
+++ /dev/null
@@ -1,1630 +0,0 @@
-ifndef CC
-CC=gcc
-endif
-
-ifndef CFLAGS
-CFLAGS = -MMD -O2 -Wall -g
-endif
-
-export LIBDIR ?= /usr/local/lib/
-export BINDIR ?= /usr/local/sbin/
-PKG_CONFIG ?= pkg-config
-
-CFLAGS += -I../src
-CFLAGS += -I../src/utils
-
--include .config
-
-BINALL=wpa_supplicant wpa_cli
-
-ifndef CONFIG_NO_WPA_PASSPHRASE
-BINALL += wpa_passphrase
-endif
-
-ALL = $(BINALL)
-ALL += systemd/wpa_supplicant.service
-ALL += systemd/wpa_supplicant@.service
-ALL += systemd/wpa_supplicant-nl80211@.service
-ALL += systemd/wpa_supplicant-wired@.service
-ALL += dbus/fi.epitest.hostap.WPASupplicant.service
-ALL += dbus/fi.w1.wpa_supplicant1.service
-
-
-all: verify_config $(ALL) dynamic_eap_methods
-
-verify_config:
- @if [ ! -r .config ]; then \
- echo 'Building wpa_supplicant requires a configuration file'; \
- echo '(.config). See README for more instructions. You can'; \
- echo 'run "cp defconfig .config" to create an example'; \
- echo 'configuration.'; \
- exit 1; \
- fi
-
-mkconfig:
- @if [ -f .config ]; then \
- echo '.config exists - did not replace it'; \
- exit 1; \
- fi
- echo CONFIG_DRIVER_HOSTAP=y >> .config
- echo CONFIG_DRIVER_WEXT=y >> .config
-
-$(DESTDIR)$(BINDIR)/%: %
- install -D $(<) $(@)
-
-install: $(addprefix $(DESTDIR)$(BINDIR)/,$(BINALL))
- $(MAKE) -C ../src install
-
-ifdef CONFIG_FIPS
-CONFIG_NO_RANDOM_POOL=
-CONFIG_OPENSSL_CMAC=y
-endif
-
-OBJS = config.o
-OBJS += notify.o
-OBJS += bss.o
-OBJS += eap_register.o
-OBJS += ../src/utils/common.o
-OBJS += ../src/utils/wpa_debug.o
-OBJS += ../src/utils/wpabuf.o
-OBJS_p = wpa_passphrase.o
-OBJS_p += ../src/utils/common.o
-OBJS_p += ../src/utils/wpa_debug.o
-OBJS_p += ../src/utils/wpabuf.o
-OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o
-OBJS_c += ../src/utils/wpa_debug.o
-OBJS_c += ../src/utils/common.o
-
-ifndef CONFIG_OS
-ifdef CONFIG_NATIVE_WINDOWS
-CONFIG_OS=win32
-else
-CONFIG_OS=unix
-endif
-endif
-
-ifeq ($(CONFIG_OS), internal)
-CFLAGS += -DOS_NO_C_LIB_DEFINES
-endif
-
-OBJS += ../src/utils/os_$(CONFIG_OS).o
-OBJS_p += ../src/utils/os_$(CONFIG_OS).o
-OBJS_c += ../src/utils/os_$(CONFIG_OS).o
-
-ifdef CONFIG_WPA_TRACE
-CFLAGS += -DWPA_TRACE
-OBJS += ../src/utils/trace.o
-OBJS_p += ../src/utils/trace.o
-OBJS_c += ../src/utils/trace.o
-OBJS_priv += ../src/utils/trace.o
-LDFLAGS += -rdynamic
-CFLAGS += -funwind-tables
-ifdef CONFIG_WPA_TRACE_BFD
-CFLAGS += -DWPA_TRACE_BFD
-LIBS += -lbfd
-LIBS_p += -lbfd
-LIBS_c += -lbfd
-endif
-endif
-
-ifndef CONFIG_ELOOP
-CONFIG_ELOOP=eloop
-endif
-OBJS += ../src/utils/$(CONFIG_ELOOP).o
-OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
-
-ifdef CONFIG_ELOOP_POLL
-CFLAGS += -DCONFIG_ELOOP_POLL
-endif
-
-
-ifdef CONFIG_EAPOL_TEST
-CFLAGS += -Werror -DEAPOL_TEST
-endif
-
-ifdef CONFIG_HT_OVERRIDES
-CFLAGS += -DCONFIG_HT_OVERRIDES
-endif
-
-ifndef CONFIG_BACKEND
-CONFIG_BACKEND=file
-endif
-
-ifeq ($(CONFIG_BACKEND), file)
-OBJS += config_file.o
-ifndef CONFIG_NO_CONFIG_BLOBS
-NEED_BASE64=y
-endif
-CFLAGS += -DCONFIG_BACKEND_FILE
-endif
-
-ifeq ($(CONFIG_BACKEND), winreg)
-OBJS += config_winreg.o
-endif
-
-ifeq ($(CONFIG_BACKEND), none)
-OBJS += config_none.o
-endif
-
-ifdef CONFIG_NO_CONFIG_WRITE
-CFLAGS += -DCONFIG_NO_CONFIG_WRITE
-endif
-
-ifdef CONFIG_NO_CONFIG_BLOBS
-CFLAGS += -DCONFIG_NO_CONFIG_BLOBS
-endif
-
-ifdef CONFIG_NO_SCAN_PROCESSING
-CFLAGS += -DCONFIG_NO_SCAN_PROCESSING
-endif
-
-ifdef CONFIG_IEEE80211W
-CFLAGS += -DCONFIG_IEEE80211W
-NEED_SHA256=y
-NEED_AES_OMAC1=y
-endif
-
-ifdef CONFIG_IEEE80211R
-CFLAGS += -DCONFIG_IEEE80211R
-OBJS += ../src/rsn_supp/wpa_ft.o
-NEED_80211_COMMON=y
-NEED_SHA256=y
-NEED_AES_OMAC1=y
-endif
-
-ifdef CONFIG_SAE
-CFLAGS += -DCONFIG_SAE
-endif
-
-ifdef CONFIG_WNM
-CFLAGS += -DCONFIG_WNM
-OBJS += wnm_sta.o
-endif
-
-ifdef CONFIG_TDLS
-CFLAGS += -DCONFIG_TDLS
-OBJS += ../src/rsn_supp/tdls.o
-NEED_SHA256=y
-NEED_AES_OMAC1=y
-endif
-
-ifdef CONFIG_TDLS_TESTING
-CFLAGS += -DCONFIG_TDLS_TESTING
-endif
-
-ifdef CONFIG_PEERKEY
-CFLAGS += -DCONFIG_PEERKEY
-endif
-
-ifndef CONFIG_NO_WPA
-OBJS += ../src/rsn_supp/wpa.o
-OBJS += ../src/rsn_supp/preauth.o
-OBJS += ../src/rsn_supp/pmksa_cache.o
-OBJS += ../src/rsn_supp/peerkey.o
-OBJS += ../src/rsn_supp/wpa_ie.o
-OBJS += ../src/common/wpa_common.o
-NEED_AES=y
-NEED_SHA1=y
-NEED_MD5=y
-NEED_RC4=y
-else
-CFLAGS += -DCONFIG_NO_WPA -DCONFIG_NO_WPA2
-endif
-
-ifdef CONFIG_IBSS_RSN
-NEED_RSN_AUTHENTICATOR=y
-CFLAGS += -DCONFIG_IBSS_RSN
-OBJS += ibss_rsn.o
-endif
-
-ifdef CONFIG_P2P
-OBJS += p2p_supplicant.o
-OBJS += ../src/p2p/p2p.o
-OBJS += ../src/p2p/p2p_utils.o
-OBJS += ../src/p2p/p2p_parse.o
-OBJS += ../src/p2p/p2p_build.o
-OBJS += ../src/p2p/p2p_go_neg.o
-OBJS += ../src/p2p/p2p_sd.o
-OBJS += ../src/p2p/p2p_pd.o
-OBJS += ../src/p2p/p2p_invitation.o
-OBJS += ../src/p2p/p2p_dev_disc.o
-OBJS += ../src/p2p/p2p_group.o
-OBJS += ../src/ap/p2p_hostapd.o
-CFLAGS += -DCONFIG_P2P
-NEED_GAS=y
-NEED_OFFCHANNEL=y
-NEED_80211_COMMON=y
-CONFIG_WPS=y
-CONFIG_AP=y
-ifdef CONFIG_P2P_STRICT
-CFLAGS += -DCONFIG_P2P_STRICT
-endif
-endif
-
-ifdef CONFIG_WIFI_DISPLAY
-CFLAGS += -DCONFIG_WIFI_DISPLAY
-OBJS += wifi_display.o
-endif
-
-ifdef CONFIG_HS20
-OBJS += hs20_supplicant.o
-CFLAGS += -DCONFIG_HS20
-CONFIG_INTERWORKING=y
-endif
-
-ifdef CONFIG_INTERWORKING
-OBJS += interworking.o
-CFLAGS += -DCONFIG_INTERWORKING
-NEED_GAS=y
-endif
-
-ifdef CONFIG_NO_WPA2
-CFLAGS += -DCONFIG_NO_WPA2
-endif
-
-include ../src/drivers/drivers.mak
-ifdef CONFIG_AP
-OBJS_d += $(DRV_BOTH_OBJS)
-CFLAGS += $(DRV_BOTH_CFLAGS)
-LDFLAGS += $(DRV_BOTH_LDFLAGS)
-LIBS += $(DRV_BOTH_LIBS)
-else
-NEED_AP_MLME=
-OBJS_d += $(DRV_WPA_OBJS)
-CFLAGS += $(DRV_WPA_CFLAGS)
-LDFLAGS += $(DRV_WPA_LDFLAGS)
-LIBS += $(DRV_WPA_LIBS)
-endif
-
-ifndef CONFIG_L2_PACKET
-CONFIG_L2_PACKET=linux
-endif
-
-OBJS_l2 += ../src/l2_packet/l2_packet_$(CONFIG_L2_PACKET).o
-
-ifeq ($(CONFIG_L2_PACKET), pcap)
-ifdef CONFIG_WINPCAP
-CFLAGS += -DCONFIG_WINPCAP
-LIBS += -lwpcap -lpacket
-LIBS_w += -lwpcap
-else
-LIBS += -ldnet -lpcap
-endif
-endif
-
-ifeq ($(CONFIG_L2_PACKET), winpcap)
-LIBS += -lwpcap -lpacket
-LIBS_w += -lwpcap
-endif
-
-ifeq ($(CONFIG_L2_PACKET), freebsd)
-LIBS += -lpcap
-endif
-
-ifdef CONFIG_EAP_TLS
-# EAP-TLS
-ifeq ($(CONFIG_EAP_TLS), dyn)
-CFLAGS += -DEAP_TLS_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_tls.so
-else
-CFLAGS += -DEAP_TLS
-OBJS += ../src/eap_peer/eap_tls.o
-OBJS_h += ../src/eap_server/eap_server_tls.o
-endif
-TLS_FUNCS=y
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_UNAUTH_TLS
-# EAP-UNAUTH-TLS
-CFLAGS += -DEAP_UNAUTH_TLS
-ifndef CONFIG_EAP_UNAUTH_TLS
-OBJS += ../src/eap_peer/eap_tls.o
-OBJS_h += ../src/eap_server/eap_server_tls.o
-TLS_FUNCS=y
-endif
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_PEAP
-# EAP-PEAP
-ifeq ($(CONFIG_EAP_PEAP), dyn)
-CFLAGS += -DEAP_PEAP_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_peap.so
-else
-CFLAGS += -DEAP_PEAP
-OBJS += ../src/eap_peer/eap_peap.o
-OBJS += ../src/eap_common/eap_peap_common.o
-OBJS_h += ../src/eap_server/eap_server_peap.o
-endif
-TLS_FUNCS=y
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_TTLS
-# EAP-TTLS
-ifeq ($(CONFIG_EAP_TTLS), dyn)
-CFLAGS += -DEAP_TTLS_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_ttls.so
-else
-CFLAGS += -DEAP_TTLS
-OBJS += ../src/eap_peer/eap_ttls.o
-OBJS_h += ../src/eap_server/eap_server_ttls.o
-endif
-MS_FUNCS=y
-TLS_FUNCS=y
-CHAP=y
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_MD5
-# EAP-MD5
-ifeq ($(CONFIG_EAP_MD5), dyn)
-CFLAGS += -DEAP_MD5_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_md5.so
-else
-CFLAGS += -DEAP_MD5
-OBJS += ../src/eap_peer/eap_md5.o
-OBJS_h += ../src/eap_server/eap_server_md5.o
-endif
-CHAP=y
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-# backwards compatibility for old spelling
-ifdef CONFIG_MSCHAPV2
-ifndef CONFIG_EAP_MSCHAPV2
-CONFIG_EAP_MSCHAPV2=y
-endif
-endif
-
-ifdef CONFIG_EAP_MSCHAPV2
-# EAP-MSCHAPv2
-ifeq ($(CONFIG_EAP_MSCHAPV2), dyn)
-CFLAGS += -DEAP_MSCHAPv2_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_mschapv2.so
-EAPDYN += ../src/eap_peer/mschapv2.so
-else
-CFLAGS += -DEAP_MSCHAPv2
-OBJS += ../src/eap_peer/eap_mschapv2.o
-OBJS += ../src/eap_peer/mschapv2.o
-OBJS_h += ../src/eap_server/eap_server_mschapv2.o
-endif
-MS_FUNCS=y
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_GTC
-# EAP-GTC
-ifeq ($(CONFIG_EAP_GTC), dyn)
-CFLAGS += -DEAP_GTC_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_gtc.so
-else
-CFLAGS += -DEAP_GTC
-OBJS += ../src/eap_peer/eap_gtc.o
-OBJS_h += ../src/eap_server/eap_server_gtc.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_OTP
-# EAP-OTP
-ifeq ($(CONFIG_EAP_OTP), dyn)
-CFLAGS += -DEAP_OTP_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_otp.so
-else
-CFLAGS += -DEAP_OTP
-OBJS += ../src/eap_peer/eap_otp.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_SIM
-# EAP-SIM
-ifeq ($(CONFIG_EAP_SIM), dyn)
-CFLAGS += -DEAP_SIM_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_sim.so
-else
-CFLAGS += -DEAP_SIM
-OBJS += ../src/eap_peer/eap_sim.o
-OBJS_h += ../src/eap_server/eap_server_sim.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-CONFIG_EAP_SIM_COMMON=y
-NEED_AES_CBC=y
-endif
-
-ifdef CONFIG_EAP_LEAP
-# EAP-LEAP
-ifeq ($(CONFIG_EAP_LEAP), dyn)
-CFLAGS += -DEAP_LEAP_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_leap.so
-else
-CFLAGS += -DEAP_LEAP
-OBJS += ../src/eap_peer/eap_leap.o
-endif
-MS_FUNCS=y
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_PSK
-# EAP-PSK
-ifeq ($(CONFIG_EAP_PSK), dyn)
-CFLAGS += -DEAP_PSK_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_psk.so
-else
-CFLAGS += -DEAP_PSK
-OBJS += ../src/eap_peer/eap_psk.o ../src/eap_common/eap_psk_common.o
-OBJS_h += ../src/eap_server/eap_server_psk.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-NEED_AES=y
-NEED_AES_OMAC1=y
-NEED_AES_ENCBLOCK=y
-NEED_AES_EAX=y
-endif
-
-ifdef CONFIG_EAP_AKA
-# EAP-AKA
-ifeq ($(CONFIG_EAP_AKA), dyn)
-CFLAGS += -DEAP_AKA_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_aka.so
-else
-CFLAGS += -DEAP_AKA
-OBJS += ../src/eap_peer/eap_aka.o
-OBJS_h += ../src/eap_server/eap_server_aka.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-CONFIG_EAP_SIM_COMMON=y
-NEED_AES_CBC=y
-endif
-
-ifdef CONFIG_EAP_AKA_PRIME
-# EAP-AKA'
-ifeq ($(CONFIG_EAP_AKA_PRIME), dyn)
-CFLAGS += -DEAP_AKA_PRIME_DYNAMIC
-else
-CFLAGS += -DEAP_AKA_PRIME
-endif
-NEED_SHA256=y
-endif
-
-ifdef CONFIG_EAP_SIM_COMMON
-OBJS += ../src/eap_common/eap_sim_common.o
-OBJS_h += ../src/eap_server/eap_sim_db.o
-NEED_AES=y
-NEED_FIPS186_2_PRF=y
-endif
-
-ifdef CONFIG_EAP_FAST
-# EAP-FAST
-ifeq ($(CONFIG_EAP_FAST), dyn)
-CFLAGS += -DEAP_FAST_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_fast.so
-EAPDYN += ../src/eap_common/eap_fast_common.o
-else
-CFLAGS += -DEAP_FAST
-OBJS += ../src/eap_peer/eap_fast.o ../src/eap_peer/eap_fast_pac.o
-OBJS += ../src/eap_common/eap_fast_common.o
-OBJS_h += ../src/eap_server/eap_server_fast.o
-endif
-TLS_FUNCS=y
-CONFIG_IEEE8021X_EAPOL=y
-NEED_T_PRF=y
-endif
-
-ifdef CONFIG_EAP_PAX
-# EAP-PAX
-ifeq ($(CONFIG_EAP_PAX), dyn)
-CFLAGS += -DEAP_PAX_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_pax.so
-else
-CFLAGS += -DEAP_PAX
-OBJS += ../src/eap_peer/eap_pax.o ../src/eap_common/eap_pax_common.o
-OBJS_h += ../src/eap_server/eap_server_pax.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_SAKE
-# EAP-SAKE
-ifeq ($(CONFIG_EAP_SAKE), dyn)
-CFLAGS += -DEAP_SAKE_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_sake.so
-else
-CFLAGS += -DEAP_SAKE
-OBJS += ../src/eap_peer/eap_sake.o ../src/eap_common/eap_sake_common.o
-OBJS_h += ../src/eap_server/eap_server_sake.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_GPSK
-# EAP-GPSK
-ifeq ($(CONFIG_EAP_GPSK), dyn)
-CFLAGS += -DEAP_GPSK_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_gpsk.so
-else
-CFLAGS += -DEAP_GPSK
-OBJS += ../src/eap_peer/eap_gpsk.o ../src/eap_common/eap_gpsk_common.o
-OBJS_h += ../src/eap_server/eap_server_gpsk.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-ifdef CONFIG_EAP_GPSK_SHA256
-CFLAGS += -DEAP_GPSK_SHA256
-endif
-NEED_SHA256=y
-NEED_AES_OMAC1=y
-endif
-
-ifdef CONFIG_EAP_PWD
-CFLAGS += -DEAP_PWD
-OBJS += ../src/eap_peer/eap_pwd.o ../src/eap_common/eap_pwd_common.o
-OBJS_h += ../src/eap_server/eap_pwd.o
-CONFIG_IEEE8021X_EAPOL=y
-NEED_SHA256=y
-endif
-
-ifdef CONFIG_WPS
-ifdef CONFIG_WPS2
-CFLAGS += -DCONFIG_WPS2
-endif
-
-# EAP-WSC
-CFLAGS += -DCONFIG_WPS -DEAP_WSC
-OBJS += wps_supplicant.o
-OBJS += ../src/utils/uuid.o
-OBJS += ../src/eap_peer/eap_wsc.o ../src/eap_common/eap_wsc_common.o
-OBJS += ../src/wps/wps.o
-OBJS += ../src/wps/wps_common.o
-OBJS += ../src/wps/wps_attr_parse.o
-OBJS += ../src/wps/wps_attr_build.o
-OBJS += ../src/wps/wps_attr_process.o
-OBJS += ../src/wps/wps_dev_attr.o
-OBJS += ../src/wps/wps_enrollee.o
-OBJS += ../src/wps/wps_registrar.o
-OBJS_h += ../src/eap_server/eap_server_wsc.o
-CONFIG_IEEE8021X_EAPOL=y
-NEED_DH_GROUPS=y
-NEED_SHA256=y
-NEED_BASE64=y
-NEED_80211_COMMON=y
-NEED_AES_CBC=y
-NEED_MODEXP=y
-
-ifdef CONFIG_WPS_NFC
-CFLAGS += -DCONFIG_WPS_NFC
-OBJS += ../src/wps/ndef.o
-NEED_WPS_OOB=y
-endif
-
-ifdef NEED_WPS_OOB
-CFLAGS += -DCONFIG_WPS_OOB
-endif
-
-ifdef CONFIG_WPS_ER
-CONFIG_WPS_UPNP=y
-CFLAGS += -DCONFIG_WPS_ER
-OBJS += ../src/wps/wps_er.o
-OBJS += ../src/wps/wps_er_ssdp.o
-endif
-
-ifdef CONFIG_WPS_UPNP
-CFLAGS += -DCONFIG_WPS_UPNP
-OBJS += ../src/wps/wps_upnp.o
-OBJS += ../src/wps/wps_upnp_ssdp.o
-OBJS += ../src/wps/wps_upnp_web.o
-OBJS += ../src/wps/wps_upnp_event.o
-OBJS += ../src/wps/wps_upnp_ap.o
-OBJS += ../src/wps/upnp_xml.o
-OBJS += ../src/wps/httpread.o
-OBJS += ../src/wps/http_client.o
-OBJS += ../src/wps/http_server.o
-endif
-
-ifdef CONFIG_WPS_STRICT
-CFLAGS += -DCONFIG_WPS_STRICT
-OBJS += ../src/wps/wps_validate.o
-endif
-
-ifdef CONFIG_WPS_TESTING
-CFLAGS += -DCONFIG_WPS_TESTING
-endif
-
-ifdef CONFIG_WPS_REG_DISABLE_OPEN
-CFLAGS += -DCONFIG_WPS_REG_DISABLE_OPEN
-endif
-
-endif
-
-ifdef CONFIG_EAP_IKEV2
-# EAP-IKEv2
-ifeq ($(CONFIG_EAP_IKEV2), dyn)
-CFLAGS += -DEAP_IKEV2_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_ikev2.so ../src/eap_peer/ikev2.o
-EAPDYN += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
-else
-CFLAGS += -DEAP_IKEV2
-OBJS += ../src/eap_peer/eap_ikev2.o ../src/eap_peer/ikev2.o
-OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
-OBJS_h += ../src/eap_server/eap_server_ikev2.o
-OBJS_h += ../src/eap_server/ikev2.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-NEED_DH_GROUPS=y
-NEED_DH_GROUPS_ALL=y
-NEED_MODEXP=y
-NEED_CIPHER=y
-endif
-
-ifdef CONFIG_EAP_VENDOR_TEST
-ifeq ($(CONFIG_EAP_VENDOR_TEST), dyn)
-CFLAGS += -DEAP_VENDOR_TEST_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_vendor_test.so
-else
-CFLAGS += -DEAP_VENDOR_TEST
-OBJS += ../src/eap_peer/eap_vendor_test.o
-OBJS_h += ../src/eap_server/eap_server_vendor_test.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
-endif
-
-ifdef CONFIG_EAP_TNC
-# EAP-TNC
-CFLAGS += -DEAP_TNC
-OBJS += ../src/eap_peer/eap_tnc.o
-OBJS += ../src/eap_peer/tncc.o
-OBJS_h += ../src/eap_server/eap_server_tnc.o
-OBJS_h += ../src/eap_server/tncs.o
-NEED_BASE64=y
-ifndef CONFIG_NATIVE_WINDOWS
-ifndef CONFIG_DRIVER_BSD
-LIBS += -ldl
-endif
-endif
-endif
-
-ifdef CONFIG_IEEE8021X_EAPOL
-# IEEE 802.1X/EAPOL state machines (e.g., for RADIUS authentication)
-CFLAGS += -DIEEE8021X_EAPOL
-OBJS += ../src/eapol_supp/eapol_supp_sm.o
-OBJS += ../src/eap_peer/eap.o ../src/eap_peer/eap_methods.o
-NEED_EAP_COMMON=y
-ifdef CONFIG_DYNAMIC_EAP_METHODS
-CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
-LIBS += -ldl -rdynamic
-endif
-endif
-
-ifdef CONFIG_AP
-NEED_80211_COMMON=y
-NEED_EAP_COMMON=y
-NEED_RSN_AUTHENTICATOR=y
-CFLAGS += -DCONFIG_AP
-OBJS += ap.o
-CFLAGS += -DCONFIG_NO_RADIUS
-CFLAGS += -DCONFIG_NO_ACCOUNTING
-CFLAGS += -DCONFIG_NO_VLAN
-OBJS += ../src/ap/hostapd.o
-OBJS += ../src/ap/wpa_auth_glue.o
-OBJS += ../src/ap/utils.o
-OBJS += ../src/ap/authsrv.o
-OBJS += ../src/ap/ap_config.o
-OBJS += ../src/utils/ip_addr.o
-OBJS += ../src/ap/sta_info.o
-OBJS += ../src/ap/tkip_countermeasures.o
-OBJS += ../src/ap/ap_mlme.o
-OBJS += ../src/ap/ieee802_1x.o
-OBJS += ../src/eapol_auth/eapol_auth_sm.o
-OBJS += ../src/ap/ieee802_11_auth.o
-OBJS += ../src/ap/ieee802_11_shared.o
-OBJS += ../src/ap/drv_callbacks.o
-OBJS += ../src/ap/ap_drv_ops.o
-OBJS += ../src/ap/beacon.o
-OBJS += ../src/ap/eap_user_db.o
-ifdef CONFIG_IEEE80211N
-OBJS += ../src/ap/ieee802_11_ht.o
-endif
-ifdef CONFIG_WNM
-OBJS += ../src/ap/wnm_ap.o
-endif
-ifdef CONFIG_CTRL_IFACE
-OBJS += ../src/ap/ctrl_iface_ap.o
-endif
-
-CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
-OBJS += ../src/eap_server/eap_server.o
-OBJS += ../src/eap_server/eap_server_identity.o
-OBJS += ../src/eap_server/eap_server_methods.o
-
-ifdef CONFIG_IEEE80211N
-CFLAGS += -DCONFIG_IEEE80211N
-endif
-
-ifdef NEED_AP_MLME
-OBJS += ../src/ap/wmm.o
-OBJS += ../src/ap/ap_list.o
-OBJS += ../src/ap/ieee802_11.o
-OBJS += ../src/ap/hw_features.o
-CFLAGS += -DNEED_AP_MLME
-endif
-ifdef CONFIG_WPS
-CFLAGS += -DEAP_SERVER_WSC
-OBJS += ../src/ap/wps_hostapd.o
-OBJS += ../src/eap_server/eap_server_wsc.o
-endif
-ifdef CONFIG_INTERWORKING
-OBJS += ../src/ap/gas_serv.o
-endif
-ifdef CONFIG_HS20
-OBJS += ../src/ap/hs20.o
-endif
-endif
-
-ifdef NEED_RSN_AUTHENTICATOR
-CFLAGS += -DCONFIG_NO_RADIUS
-NEED_AES_WRAP=y
-OBJS += ../src/ap/wpa_auth.o
-OBJS += ../src/ap/wpa_auth_ie.o
-OBJS += ../src/ap/pmksa_cache_auth.o
-ifdef CONFIG_IEEE80211R
-OBJS += ../src/ap/wpa_auth_ft.o
-endif
-ifdef CONFIG_PEERKEY
-OBJS += ../src/ap/peerkey_auth.o
-endif
-endif
-
-ifdef CONFIG_EAP_SERVER
-CFLAGS += -DEAP_SERVER
-OBJS_h += ../src/eap_server/eap_server.o
-OBJS_h += ../src/eap_server/eap_server_identity.o
-OBJS_h += ../src/eap_server/eap_server_methods.o
-endif
-
-ifdef CONFIG_RADIUS_CLIENT
-OBJS_h += ../src/utils/ip_addr.o
-OBJS_h += ../src/radius/radius.o
-OBJS_h += ../src/radius/radius_client.o
-endif
-
-ifdef CONFIG_AUTHENTICATOR
-OBJS_h += ../src/eapol_auth/eapol_auth_sm.o
-OBJS_h += ../src/ap/ieee802_1x.o
-endif
-
-ifdef CONFIG_WPA_AUTHENTICATOR
-OBJS_h += ../src/ap/wpa_auth.o
-OBJS_h += ../src/ap/wpa_auth_ie.o
-OBJS_h += ../src/ap/pmksa_cache_auth.o
-ifdef CONFIG_IEEE80211R
-OBJS_h += ../src/ap/wpa_auth_ft.o
-endif
-ifdef CONFIG_PEERKEY
-OBJS_h += ../src/ap/peerkey_auth.o
-endif
-endif
-
-ifdef CONFIG_PCSC
-# PC/SC interface for smartcards (USIM, GSM SIM)
-CFLAGS += -DPCSC_FUNCS -I/usr/include/PCSC
-OBJS += ../src/utils/pcsc_funcs.o
-# -lpthread may not be needed depending on how pcsc-lite was configured
-ifdef CONFIG_NATIVE_WINDOWS
-#Once MinGW gets support for WinScard, -lwinscard could be used instead of the
-#dynamic symbol loading that is now used in pcsc_funcs.c
-#LIBS += -lwinscard
-else
-LIBS += -lpcsclite -lpthread
-endif
-endif
-
-ifdef CONFIG_SIM_SIMULATOR
-CFLAGS += -DCONFIG_SIM_SIMULATOR
-NEED_MILENAGE=y
-endif
-
-ifdef CONFIG_USIM_SIMULATOR
-CFLAGS += -DCONFIG_USIM_SIMULATOR
-NEED_MILENAGE=y
-endif
-
-ifdef NEED_MILENAGE
-OBJS += ../src/crypto/milenage.o
-NEED_AES_ENCBLOCK=y
-endif
-
-ifdef CONFIG_PKCS12
-CFLAGS += -DPKCS12_FUNCS
-endif
-
-ifdef CONFIG_SMARTCARD
-CFLAGS += -DCONFIG_SMARTCARD
-endif
-
-ifdef MS_FUNCS
-OBJS += ../src/crypto/ms_funcs.o
-NEED_DES=y
-NEED_MD4=y
-endif
-
-ifdef CHAP
-OBJS += ../src/eap_common/chap.o
-endif
-
-ifdef TLS_FUNCS
-NEED_DES=y
-# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, EAP_TTLS, and EAP_FAST)
-OBJS += ../src/eap_peer/eap_tls_common.o
-OBJS_h += ../src/eap_server/eap_server_tls_common.o
-ifndef CONFIG_FIPS
-NEED_TLS_PRF=y
-NEED_SHA1=y
-NEED_MD5=y
-endif
-endif
-
-ifndef CONFIG_TLS
-CONFIG_TLS=openssl
-endif
-
-ifdef CONFIG_TLSV11
-CFLAGS += -DCONFIG_TLSV11
-endif
-
-ifdef CONFIG_TLSV12
-CFLAGS += -DCONFIG_TLSV12
-NEED_SHA256=y
-endif
-
-ifeq ($(CONFIG_TLS), openssl)
-ifdef TLS_FUNCS
-CFLAGS += -DEAP_TLS_OPENSSL
-OBJS += ../src/crypto/tls_openssl.o
-LIBS += -lssl
-endif
-OBJS += ../src/crypto/crypto_openssl.o
-OBJS_p += ../src/crypto/crypto_openssl.o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_openssl.o
-endif
-LIBS += -lcrypto
-LIBS_p += -lcrypto
-ifdef CONFIG_TLS_ADD_DL
-LIBS += -ldl
-LIBS_p += -ldl
-endif
-endif
-
-ifeq ($(CONFIG_TLS), gnutls)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_gnutls.o
-LIBS += -lgnutls -lgpg-error
-endif
-OBJS += ../src/crypto/crypto_gnutls.o
-OBJS_p += ../src/crypto/crypto_gnutls.o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_gnutls.o
-endif
-LIBS += -lgcrypt
-LIBS_p += -lgcrypt
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-
-ifeq ($(CONFIG_TLS), schannel)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_schannel.o
-endif
-OBJS += ../src/crypto/crypto_cryptoapi.o
-OBJS_p += ../src/crypto/crypto_cryptoapi.o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_cryptoapi.o
-endif
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-
-ifeq ($(CONFIG_TLS), nss)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_nss.o
-LIBS += -lssl3
-endif
-OBJS += ../src/crypto/crypto_nss.o
-OBJS_p += ../src/crypto/crypto_nss.o
-ifdef NEED_FIPS186_2_PRF
-OBJS += ../src/crypto/fips_prf_nss.o
-endif
-LIBS += -lnss3
-LIBS_p += -lnss3
-CONFIG_INTERNAL_MD4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-
-ifeq ($(CONFIG_TLS), internal)
-ifndef CONFIG_CRYPTO
-CONFIG_CRYPTO=internal
-endif
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/crypto_internal-rsa.o
-OBJS += ../src/crypto/tls_internal.o
-OBJS += ../src/tls/tlsv1_common.o
-OBJS += ../src/tls/tlsv1_record.o
-OBJS += ../src/tls/tlsv1_cred.o
-OBJS += ../src/tls/tlsv1_client.o
-OBJS += ../src/tls/tlsv1_client_write.o
-OBJS += ../src/tls/tlsv1_client_read.o
-OBJS += ../src/tls/asn1.o
-OBJS += ../src/tls/rsa.o
-OBJS += ../src/tls/x509v3.o
-OBJS += ../src/tls/pkcs1.o
-OBJS += ../src/tls/pkcs5.o
-OBJS += ../src/tls/pkcs8.o
-NEED_SHA256=y
-NEED_BASE64=y
-NEED_TLS_PRF=y
-ifdef CONFIG_TLSV12
-NEED_TLS_PRF_SHA256=y
-endif
-NEED_MODEXP=y
-NEED_CIPHER=y
-CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT
-endif
-ifdef NEED_CIPHER
-NEED_DES=y
-OBJS += ../src/crypto/crypto_internal-cipher.o
-endif
-ifdef NEED_MODEXP
-OBJS += ../src/crypto/crypto_internal-modexp.o
-OBJS += ../src/tls/bignum.o
-endif
-ifeq ($(CONFIG_CRYPTO), libtomcrypt)
-OBJS += ../src/crypto/crypto_libtomcrypt.o
-OBJS_p += ../src/crypto/crypto_libtomcrypt.o
-LIBS += -ltomcrypt -ltfm
-LIBS_p += -ltomcrypt -ltfm
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-ifeq ($(CONFIG_CRYPTO), internal)
-OBJS += ../src/crypto/crypto_internal.o
-OBJS_p += ../src/crypto/crypto_internal.o
-NEED_AES_ENC=y
-CFLAGS += -DCONFIG_CRYPTO_INTERNAL
-ifdef CONFIG_INTERNAL_LIBTOMMATH
-CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
-ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
-CFLAGS += -DLTM_FAST
-endif
-else
-LIBS += -ltommath
-LIBS_p += -ltommath
-endif
-CONFIG_INTERNAL_AES=y
-CONFIG_INTERNAL_DES=y
-CONFIG_INTERNAL_SHA1=y
-CONFIG_INTERNAL_MD4=y
-CONFIG_INTERNAL_MD5=y
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-CONFIG_INTERNAL_DH_GROUP5=y
-endif
-ifeq ($(CONFIG_CRYPTO), cryptoapi)
-OBJS += ../src/crypto/crypto_cryptoapi.o
-OBJS_p += ../src/crypto/crypto_cryptoapi.o
-CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-endif
-endif
-
-ifeq ($(CONFIG_TLS), none)
-ifdef TLS_FUNCS
-OBJS += ../src/crypto/tls_none.o
-CFLAGS += -DEAP_TLS_NONE
-CONFIG_INTERNAL_AES=y
-CONFIG_INTERNAL_SHA1=y
-CONFIG_INTERNAL_MD5=y
-endif
-OBJS += ../src/crypto/crypto_none.o
-OBJS_p += ../src/crypto/crypto_none.o
-CONFIG_INTERNAL_SHA256=y
-CONFIG_INTERNAL_RC4=y
-endif
-
-ifdef TLS_FUNCS
-ifdef CONFIG_SMARTCARD
-ifndef CONFIG_NATIVE_WINDOWS
-ifneq ($(CONFIG_L2_PACKET), freebsd)
-LIBS += -ldl
-endif
-endif
-endif
-endif
-
-ifndef TLS_FUNCS
-OBJS += ../src/crypto/tls_none.o
-ifeq ($(CONFIG_TLS), internal)
-CONFIG_INTERNAL_AES=y
-CONFIG_INTERNAL_SHA1=y
-CONFIG_INTERNAL_MD5=y
-CONFIG_INTERNAL_RC4=y
-endif
-endif
-
-AESOBJS = # none so far (see below)
-ifdef CONFIG_INTERNAL_AES
-AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-dec.o
-endif
-
-AESOBJS += ../src/crypto/aes-unwrap.o
-ifdef NEED_AES_EAX
-AESOBJS += ../src/crypto/aes-eax.o
-NEED_AES_CTR=y
-endif
-ifdef NEED_AES_CTR
-AESOBJS += ../src/crypto/aes-ctr.o
-endif
-ifdef NEED_AES_ENCBLOCK
-AESOBJS += ../src/crypto/aes-encblock.o
-endif
-ifdef NEED_AES_OMAC1
-NEED_AES_ENC=y
-ifdef CONFIG_OPENSSL_CMAC
-CFLAGS += -DCONFIG_OPENSSL_CMAC
-else
-AESOBJS += ../src/crypto/aes-omac1.o
-endif
-endif
-ifdef NEED_AES_WRAP
-NEED_AES_ENC=y
-AESOBJS += ../src/crypto/aes-wrap.o
-endif
-ifdef NEED_AES_CBC
-NEED_AES_ENC=y
-AESOBJS += ../src/crypto/aes-cbc.o
-endif
-ifdef NEED_AES_ENC
-ifdef CONFIG_INTERNAL_AES
-AESOBJS += ../src/crypto/aes-internal-enc.o
-endif
-endif
-ifdef NEED_AES
-OBJS += $(AESOBJS)
-endif
-
-ifdef NEED_SHA1
-ifneq ($(CONFIG_TLS), openssl)
-SHA1OBJS += ../src/crypto/sha1.o
-endif
-SHA1OBJS += ../src/crypto/sha1-prf.o
-ifdef CONFIG_INTERNAL_SHA1
-SHA1OBJS += ../src/crypto/sha1-internal.o
-ifdef NEED_FIPS186_2_PRF
-SHA1OBJS += ../src/crypto/fips_prf_internal.o
-endif
-endif
-ifdef CONFIG_NO_WPA_PASSPHRASE
-CFLAGS += -DCONFIG_NO_PBKDF2
-else
-ifneq ($(CONFIG_TLS), openssl)
-SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
-endif
-endif
-ifdef NEED_T_PRF
-SHA1OBJS += ../src/crypto/sha1-tprf.o
-endif
-ifdef NEED_TLS_PRF
-SHA1OBJS += ../src/crypto/sha1-tlsprf.o
-endif
-endif
-
-ifndef CONFIG_FIPS
-MD5OBJS += ../src/crypto/md5.o
-endif
-ifdef NEED_MD5
-ifdef CONFIG_INTERNAL_MD5
-MD5OBJS += ../src/crypto/md5-internal.o
-endif
-OBJS += $(MD5OBJS)
-OBJS_p += $(MD5OBJS)
-endif
-
-ifdef NEED_MD4
-ifdef CONFIG_INTERNAL_MD4
-OBJS += ../src/crypto/md4-internal.o
-endif
-endif
-
-DESOBJS = # none needed when not internal
-ifdef NEED_DES
-ifdef CONFIG_INTERNAL_DES
-DESOBJS += ../src/crypto/des-internal.o
-endif
-endif
-
-ifdef NEED_RC4
-ifdef CONFIG_INTERNAL_RC4
-OBJS += ../src/crypto/rc4.o
-endif
-endif
-
-SHA256OBJS = # none by default
-ifdef NEED_SHA256
-CFLAGS += -DCONFIG_SHA256
-ifneq ($(CONFIG_TLS), openssl)
-SHA256OBJS += ../src/crypto/sha256.o
-endif
-SHA256OBJS += ../src/crypto/sha256-prf.o
-ifdef CONFIG_INTERNAL_SHA256
-SHA256OBJS += ../src/crypto/sha256-internal.o
-endif
-ifdef NEED_TLS_PRF_SHA256
-SHA256OBJS += ../src/crypto/sha256-tlsprf.o
-endif
-OBJS += $(SHA256OBJS)
-endif
-
-ifdef NEED_DH_GROUPS
-OBJS += ../src/crypto/dh_groups.o
-endif
-ifdef NEED_DH_GROUPS_ALL
-CFLAGS += -DALL_DH_GROUPS
-endif
-ifdef CONFIG_INTERNAL_DH_GROUP5
-ifdef NEED_DH_GROUPS
-OBJS += ../src/crypto/dh_group5.o
-endif
-endif
-
-ifdef CONFIG_NO_RANDOM_POOL
-CFLAGS += -DCONFIG_NO_RANDOM_POOL
-else
-OBJS += ../src/crypto/random.o
-endif
-
-ifdef CONFIG_CTRL_IFACE
-ifeq ($(CONFIG_CTRL_IFACE), y)
-ifdef CONFIG_NATIVE_WINDOWS
-CONFIG_CTRL_IFACE=named_pipe
-else
-CONFIG_CTRL_IFACE=unix
-endif
-endif
-CFLAGS += -DCONFIG_CTRL_IFACE
-ifeq ($(CONFIG_CTRL_IFACE), unix)
-CFLAGS += -DCONFIG_CTRL_IFACE_UNIX
-endif
-ifeq ($(CONFIG_CTRL_IFACE), udp)
-CFLAGS += -DCONFIG_CTRL_IFACE_UDP
-endif
-ifeq ($(CONFIG_CTRL_IFACE), named_pipe)
-CFLAGS += -DCONFIG_CTRL_IFACE_NAMED_PIPE
-endif
-ifeq ($(CONFIG_CTRL_IFACE), udp-remote)
-CONFIG_CTRL_IFACE=udp
-CFLAGS += -DCONFIG_CTRL_IFACE_UDP
-CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
-endif
-OBJS += ctrl_iface.o ctrl_iface_$(CONFIG_CTRL_IFACE).o
-endif
-
-ifdef CONFIG_CTRL_IFACE_DBUS
-DBUS=y
-DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS -DDBUS_API_SUBJECT_TO_CHANGE
-DBUS_OBJS += dbus/dbus_old.o dbus/dbus_old_handlers.o
-ifdef CONFIG_WPS
-DBUS_OBJS += dbus/dbus_old_handlers_wps.o
-endif
-DBUS_OBJS += dbus/dbus_dict_helpers.o
-ifndef DBUS_LIBS
-DBUS_LIBS := $(shell $(PKG_CONFIG) --libs dbus-1)
-endif
-ifndef DBUS_INCLUDE
-DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1)
-endif
-DBUS_CFLAGS += $(DBUS_INCLUDE)
-endif
-
-ifdef CONFIG_CTRL_IFACE_DBUS_NEW
-DBUS=y
-DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_NEW
-DBUS_OBJS ?= dbus/dbus_dict_helpers.o
-DBUS_OBJS += dbus/dbus_new_helpers.o
-DBUS_OBJS += dbus/dbus_new.o dbus/dbus_new_handlers.o
-ifdef CONFIG_WPS
-DBUS_OBJS += dbus/dbus_new_handlers_wps.o
-endif
-ifdef CONFIG_P2P
-DBUS_OBJS += dbus/dbus_new_handlers_p2p.o
-endif
-ifndef DBUS_LIBS
-DBUS_LIBS := $(shell $(PKG_CONFIG) --libs dbus-1)
-endif
-ifndef DBUS_INCLUDE
-DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1)
-endif
-ifdef CONFIG_CTRL_IFACE_DBUS_INTRO
-DBUS_OBJS += dbus/dbus_new_introspect.o
-DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_INTRO
-endif
-DBUS_CFLAGS += $(DBUS_INCLUDE)
-endif
-
-ifdef DBUS
-DBUS_CFLAGS += -DCONFIG_DBUS
-DBUS_OBJS += dbus/dbus_common.o
-endif
-
-OBJS += $(DBUS_OBJS)
-CFLAGS += $(DBUS_CFLAGS)
-LIBS += $(DBUS_LIBS)
-
-ifdef CONFIG_READLINE
-OBJS_c += ../src/utils/edit_readline.o
-LIBS_c += -lncurses -lreadline
-else
-ifdef CONFIG_WPA_CLI_EDIT
-OBJS_c += ../src/utils/edit.o
-else
-OBJS_c += ../src/utils/edit_simple.o
-endif
-endif
-
-ifdef CONFIG_NATIVE_WINDOWS
-CFLAGS += -DCONFIG_NATIVE_WINDOWS
-LIBS += -lws2_32 -lgdi32 -lcrypt32
-LIBS_c += -lws2_32
-LIBS_p += -lws2_32 -lgdi32
-ifeq ($(CONFIG_CRYPTO), cryptoapi)
-LIBS_p += -lcrypt32
-endif
-endif
-
-ifdef CONFIG_NO_STDOUT_DEBUG
-CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
-ifndef CONFIG_CTRL_IFACE
-CFLAGS += -DCONFIG_NO_WPA_MSG
-endif
-endif
-
-ifdef CONFIG_IPV6
-# for eapol_test only
-CFLAGS += -DCONFIG_IPV6
-endif
-
-ifdef NEED_BASE64
-OBJS += ../src/utils/base64.o
-endif
-
-ifdef NEED_SME
-NEED_80211_COMMON=y
-OBJS += sme.o
-CFLAGS += -DCONFIG_SME
-endif
-
-ifdef NEED_80211_COMMON
-OBJS += ../src/common/ieee802_11_common.o
-endif
-
-ifdef NEED_EAP_COMMON
-OBJS += ../src/eap_common/eap_common.o
-endif
-
-ifndef CONFIG_MAIN
-CONFIG_MAIN=main
-endif
-
-ifdef CONFIG_DEBUG_SYSLOG
-CFLAGS += -DCONFIG_DEBUG_SYSLOG
-ifdef CONFIG_DEBUG_SYSLOG_FACILITY
-CFLAGS += -DLOG_HOSTAPD="$(CONFIG_DEBUG_SYSLOG_FACILITY)"
-endif
-endif
-
-ifdef CONFIG_DEBUG_LINUX_TRACING
-CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
-endif
-
-ifdef CONFIG_DEBUG_FILE
-CFLAGS += -DCONFIG_DEBUG_FILE
-endif
-
-ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
-CFLAGS += -DCONFIG_DELAYED_MIC_ERROR_REPORT
-endif
-
-ifdef CONFIG_FIPS
-CFLAGS += -DCONFIG_FIPS
-ifneq ($(CONFIG_TLS), openssl)
-$(error CONFIG_FIPS=y requires CONFIG_TLS=openssl)
-endif
-endif
-
-OBJS += $(SHA1OBJS) $(DESOBJS)
-
-OBJS_p += $(SHA1OBJS)
-OBJS_p += $(SHA256OBJS)
-
-ifdef CONFIG_BGSCAN_SIMPLE
-CFLAGS += -DCONFIG_BGSCAN_SIMPLE
-OBJS += bgscan_simple.o
-NEED_BGSCAN=y
-endif
-
-ifdef CONFIG_BGSCAN_LEARN
-CFLAGS += -DCONFIG_BGSCAN_LEARN
-OBJS += bgscan_learn.o
-NEED_BGSCAN=y
-endif
-
-ifdef NEED_BGSCAN
-CFLAGS += -DCONFIG_BGSCAN
-OBJS += bgscan.o
-endif
-
-ifdef CONFIG_AUTOSCAN_EXPONENTIAL
-CFLAGS += -DCONFIG_AUTOSCAN_EXPONENTIAL
-OBJS += autoscan_exponential.o
-NEED_AUTOSCAN=y
-endif
-
-ifdef CONFIG_AUTOSCAN_PERIODIC
-CFLAGS += -DCONFIG_AUTOSCAN_PERIODIC
-OBJS += autoscan_periodic.o
-NEED_AUTOSCAN=y
-endif
-
-ifdef NEED_AUTOSCAN
-CFLAGS += -DCONFIG_AUTOSCAN
-OBJS += autoscan.o
-endif
-
-ifdef CONFIG_EXT_PASSWORD_TEST
-OBJS += ../src/utils/ext_password_test.o
-CFLAGS += -DCONFIG_EXT_PASSWORD_TEST
-NEED_EXT_PASSWORD=y
-endif
-
-ifdef NEED_EXT_PASSWORD
-OBJS += ../src/utils/ext_password.o
-CFLAGS += -DCONFIG_EXT_PASSWORD
-endif
-
-ifdef NEED_GAS
-OBJS += ../src/common/gas.o
-OBJS += gas_query.o
-CFLAGS += -DCONFIG_GAS
-NEED_OFFCHANNEL=y
-endif
-
-ifdef NEED_OFFCHANNEL
-OBJS += offchannel.o
-CFLAGS += -DCONFIG_OFFCHANNEL
-endif
-
-OBJS += ../src/drivers/driver_common.o
-
-OBJS_wpa_rm := ctrl_iface.o ctrl_iface_unix.o
-OBJS_wpa := $(filter-out $(OBJS_wpa_rm),$(OBJS)) $(OBJS_h) tests/test_wpa.o
-ifdef CONFIG_AUTHENTICATOR
-OBJS_wpa += tests/link_test.o
-endif
-OBJS_wpa += $(OBJS_l2)
-OBJS += wpa_supplicant.o events.o blacklist.o wpas_glue.o scan.o
-OBJS_t := $(OBJS) $(OBJS_l2) eapol_test.o
-OBJS_t += ../src/radius/radius_client.o
-OBJS_t += ../src/radius/radius.o
-ifndef CONFIG_AP
-OBJS_t += ../src/utils/ip_addr.o
-endif
-OBJS_t2 := $(OBJS) $(OBJS_l2) preauth_test.o
-
-OBJS_nfc := $(OBJS) $(OBJS_l2) nfc_pw_token.o
-OBJS_nfc += $(OBJS_d) ../src/drivers/drivers.o
-
-OBJS += $(CONFIG_MAIN).o
-
-ifdef CONFIG_PRIVSEP
-OBJS_priv += $(OBJS_d) ../src/drivers/drivers.o
-OBJS_priv += $(OBJS_l2)
-OBJS_priv += ../src/utils/os_$(CONFIG_OS).o
-OBJS_priv += ../src/utils/$(CONFIG_ELOOP).o
-OBJS_priv += ../src/utils/common.o
-OBJS_priv += ../src/utils/wpa_debug.o
-OBJS_priv += ../src/utils/wpabuf.o
-OBJS_priv += wpa_priv.o
-ifdef CONFIG_DRIVER_NL80211
-OBJS_priv += ../src/common/ieee802_11_common.o
-endif
-ifdef CONFIG_DRIVER_TEST
-OBJS_priv += $(SHA1OBJS)
-OBJS_priv += $(MD5OBJS)
-ifeq ($(CONFIG_TLS), openssl)
-OBJS_priv += ../src/crypto/crypto_openssl.o
-endif
-ifeq ($(CONFIG_TLS), gnutls)
-OBJS_priv += ../src/crypto/crypto_gnutls.o
-endif
-ifeq ($(CONFIG_TLS), nss)
-OBJS_priv += ../src/crypto/crypto_nss.o
-endif
-ifeq ($(CONFIG_TLS), internal)
-ifeq ($(CONFIG_CRYPTO), libtomcrypt)
-OBJS_priv += ../src/crypto/crypto_libtomcrypt.o
-else
-OBJS_priv += ../src/crypto/crypto_internal.o
-endif
-endif
-endif # CONFIG_DRIVER_TEST
-OBJS += ../src/l2_packet/l2_packet_privsep.o
-OBJS += ../src/drivers/driver_privsep.o
-EXTRA_progs += wpa_priv
-else
-OBJS += $(OBJS_d) ../src/drivers/drivers.o
-OBJS += $(OBJS_l2)
-endif
-
-ifdef CONFIG_NDIS_EVENTS_INTEGRATED
-CFLAGS += -DCONFIG_NDIS_EVENTS_INTEGRATED
-OBJS += ../src/drivers/ndis_events.o
-EXTRALIBS += -loleaut32 -lole32 -luuid
-ifdef PLATFORMSDKLIB
-EXTRALIBS += $(PLATFORMSDKLIB)/WbemUuid.Lib
-else
-EXTRALIBS += WbemUuid.Lib
-endif
-endif
-
-ifndef LDO
-LDO=$(CC)
-endif
-
-Q=@
-E=echo
-ifeq ($(V), 1)
-Q=
-E=true
-endif
-
-dynamic_eap_methods: $(EAPDYN)
-
-../src/drivers/build.wpa_supplicant:
- @if [ -f ../src/drivers/build.hostapd ]; then \
- $(MAKE) -C ../src/drivers clean; \
- fi
- @touch ../src/drivers/build.wpa_supplicant
-
-BCHECK=../src/drivers/build.wpa_supplicant
-
-wpa_priv: $(BCHECK) $(OBJS_priv)
- $(Q)$(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS)
- @$(E) " LD " $@
-
-$(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
-
-wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
- $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
- @$(E) " LD " $@
-
-eapol_test: $(OBJS_t)
- $(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS)
- @$(E) " LD " $@
-
-preauth_test: $(OBJS_t2)
- $(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS)
- @$(E) " LD " $@
-
-wpa_passphrase: $(OBJS_p)
- $(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p)
- @$(E) " LD " $@
-
-wpa_cli: $(OBJS_c)
- $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
- @$(E) " LD " $@
-
-link_test: $(OBJS) $(OBJS_h) tests/link_test.o
- $(Q)$(LDO) $(LDFLAGS) -o link_test $(OBJS) $(OBJS_h) tests/link_test.o $(LIBS)
- @$(E) " LD " $@
-
-test_wpa: $(OBJS_wpa) $(OBJS_h)
- $(Q)$(LDO) $(LDFLAGS) -o test_wpa $(OBJS_wpa) $(LIBS)
- @$(E) " LD " $@
-
-nfc_pw_token: $(OBJS_nfc)
- $(Q)$(LDO) $(LDFLAGS) -o nfc_pw_token $(OBJS_nfc) $(LIBS)
- @$(E) " LD " $@
-
-win_if_list: win_if_list.c
- $(Q)$(LDO) $(LDFLAGS) -o $@ win_if_list.c $(CFLAGS) $(LIBS_w)
- @$(E) " LD " $@
-
-eap_psk.so: ../src/eap_peer/eap_psk.c ../src/eap_common/eap_psk_common.c
- $(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
- -Deap_peer_psk_register=eap_peer_method_dynamic_init
-
-eap_pax.so: ../src/eap_peer/eap_pax.c ../src/eap_common/eap_pax_common.c
- $(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
- -Deap_peer_pax_register=eap_peer_method_dynamic_init
-
-eap_sake.so: ../src/eap_peer/eap_sake.c ../src/eap_common/eap_sake_common.c
- $(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
- -Deap_peer_sake_register=eap_peer_method_dynamic_init
-
-eap_wsc.so: ../src/eap_peer/eap_wsc.c ../src/eap_common/eap_wsc_common.c ../src/wps/wps.c
- $(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
- -Deap_peer_wsc_register=eap_peer_method_dynamic_init
-
-eap_ikev2.so: ../src/eap_peer/eap_ikev2.c ../src/eap_peer/ikev2.c ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.c
- $(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
- -Deap_peer_ikev2_register=eap_peer_method_dynamic_init
-
-%.so: %.c
- $(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $< \
- -D$(*F:eap_%=eap_peer_%)_register=eap_peer_method_dynamic_init
-
-%.o: %.c
- $(Q)$(CC) -c -o $@ $(CFLAGS) $<
- @$(E) " CC " $<
-
-%.service: %.service.in
- sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
-
-%@.service: %.service.arg.in
- sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
-
-wpa_supplicant.exe: wpa_supplicant
- mv -f $< $@
-wpa_cli.exe: wpa_cli
- mv -f $< $@
-wpa_passphrase.exe: wpa_passphrase
- mv -f $< $@
-win_if_list.exe: win_if_list
- mv -f $< $@
-eapol_test.exe: eapol_test
- mv -f $< $@
-
-WINALL=wpa_supplicant.exe wpa_cli.exe wpa_passphrase.exe win_if_list.exe
-
-windows-bin: $(WINALL)
- $(STRIP) $(WINALL)
-
-wpa_gui:
- @echo "wpa_gui has been removed - see wpa_gui-qt4 for replacement"
-
-wpa_gui-qt4/Makefile:
- qmake -o wpa_gui-qt4/Makefile wpa_gui-qt4/wpa_gui.pro
-
-wpa_gui-qt4/lang/wpa_gui_de.qm: wpa_gui-qt4/lang/wpa_gui_de.ts
- lrelease wpa_gui-qt4/wpa_gui.pro
-
-wpa_gui-qt4: wpa_gui-qt4/Makefile wpa_gui-qt4/lang/wpa_gui_de.qm
- $(MAKE) -C wpa_gui-qt4
-
-TEST_EAP_SIM_COMMON_OBJS = $(SHA1OBJS) $(MD5OBJS) \
- ../src/utils/common.o ../src/utils/os_unix.o \
- ../src/utils/wpa_debug.o $(AESOBJS) \
- tests/test_eap_sim_common.o
-test-eap_sim_common: $(TEST_EAP_SIM_COMMON_OBJS)
- $(LDO) $(LDFLAGS) -o $@ $(TEST_EAP_SIM_COMMON_OBJS) $(LIBS)
- ./test-eap_sim_common
- rm test-eap_sim_common
-
-tests: test-eap_sim_common
-
-FIPSDIR=/usr/local/ssl/fips-2.0
-FIPSLD=$(FIPSDIR)/bin/fipsld
-fips:
- $(MAKE) CC=$(FIPSLD) FIPSLD_CC="$(CC)"
-
-clean:
- $(MAKE) -C ../src clean
- $(MAKE) -C dbus clean
- rm -f core *~ *.o *.d eap_*.so $(ALL) $(WINALL) eapol_test preauth_test
- rm -f wpa_priv
- rm -f nfc_pw_token
-
--include $(OBJS:%.o=%.d)
diff --git a/contrib/wpa/wpa_supplicant/dbus/.gitignore b/contrib/wpa/wpa_supplicant/dbus/.gitignore
deleted file mode 100644
index 6db2468..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-libwpadbus.a
diff --git a/contrib/wpa/wpa_supplicant/dbus/Makefile b/contrib/wpa/wpa_supplicant/dbus/Makefile
deleted file mode 100644
index d64c65c..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/Makefile
+++ /dev/null
@@ -1,73 +0,0 @@
-all: libwpadbus.a
-
-clean:
- rm -f *~ *.o *.d
- rm -f libwpadbus.a
-
-install:
- @echo Nothing to be made.
-
-ifndef CC
-CC=gcc
-endif
-
-ifndef CFLAGS
-CFLAGS = -MMD -O2 -Wall -g
-endif
-
-PKG_CONFIG ?= pkg-config
-CFLAGS += -I../../src -I../../src/utils
-
-
-Q=@
-E=echo
-ifeq ($(V), 1)
-Q=
-E=true
-endif
-
-%.o: %.c
- $(Q)$(CC) -c -o $@ $(CFLAGS) $<
- @$(E) " CC " $<
-
-
-ifdef CONFIG_WPS
-CFLAGS += -DCONFIG_WPS
-endif
-
-CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_NEW
-CFLAGS += -DCONFIG_CTRL_IFACE_DBUS
-
-ifndef DBUS_LIBS
-DBUS_LIBS := $(shell $(PKG_CONFIG) --libs dbus-1)
-endif
-ifndef DBUS_INCLUDE
-DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1)
-endif
-ifdef CONFIG_CTRL_IFACE_DBUS_INTRO
-CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_INTRO
-DBUS_INCLUDE += $(shell xml2-config --cflags)
-DBUS_LIBS += $(shell xml2-config --libs)
-endif
-
-CFLAGS += $(DBUS_INCLUDE)
-
-LIB_OBJS= \
- dbus_common.o \
- dbus_old.o \
- dbus_old_handlers.o \
- dbus_new.o \
- dbus_new_handlers.o \
- dbus_new_helpers.o \
- dbus_new_introspect.o \
- dbus_dict_helpers.o
-
-ifdef CONFIG_WPS
-LIB_OBJS += dbus_old_handlers_wps.o
-LIB_OBJS += dbus_new_handlers_wps.o
-endif
-
-libwpadbus.a: $(LIB_OBJS)
- $(AR) crT $@ $?
-
--include $(OBJS:%.o=%.d)
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus-wpa_supplicant.conf b/contrib/wpa/wpa_supplicant/dbus/dbus-wpa_supplicant.conf
deleted file mode 100644
index c091234..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus-wpa_supplicant.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE busconfig PUBLIC
- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <policy user="root">
- <allow own="fi.epitest.hostap.WPASupplicant"/>
-
- <allow send_destination="fi.epitest.hostap.WPASupplicant"/>
- <allow send_interface="fi.epitest.hostap.WPASupplicant"/>
-
- <allow own="fi.w1.wpa_supplicant1"/>
-
- <allow send_destination="fi.w1.wpa_supplicant1"/>
- <allow send_interface="fi.w1.wpa_supplicant1"/>
- <allow receive_sender="fi.w1.wpa_supplicant1" receive_type="signal"/>
- </policy>
- <policy context="default">
- <deny own="fi.epitest.hostap.WPASupplicant"/>
- <deny send_destination="fi.epitest.hostap.WPASupplicant"/>
- <deny send_interface="fi.epitest.hostap.WPASupplicant"/>
-
- <deny own="fi.w1.wpa_supplicant1"/>
- <deny send_destination="fi.w1.wpa_supplicant1"/>
- <deny send_interface="fi.w1.wpa_supplicant1"/>
- <deny receive_sender="fi.w1.wpa_supplicant1" receive_type="signal"/>
- </policy>
-</busconfig>
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_common.c b/contrib/wpa/wpa_supplicant/dbus/dbus_common.c
deleted file mode 100644
index 5d0e31e..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_common.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * wpa_supplicant D-Bus control interface - common functionality
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
- * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "utils/includes.h"
-#include <dbus/dbus.h>
-
-#include "utils/common.h"
-#include "utils/eloop.h"
-#include "dbus_common.h"
-#include "dbus_common_i.h"
-#include "dbus_new.h"
-#include "dbus_old.h"
-
-
-#ifndef SIGPOLL
-#ifdef SIGIO
-/*
- * If we do not have SIGPOLL, try to use SIGIO instead. This is needed for
- * FreeBSD.
- */
-#define SIGPOLL SIGIO
-#endif
-#endif
-
-
-static void dispatch_data(DBusConnection *con)
-{
- while (dbus_connection_get_dispatch_status(con) ==
- DBUS_DISPATCH_DATA_REMAINS)
- dbus_connection_dispatch(con);
-}
-
-
-/**
- * dispatch_initial_dbus_messages - Dispatch initial dbus messages after
- * claiming bus name
- * @eloop_ctx: the DBusConnection to dispatch on
- * @timeout_ctx: unused
- *
- * If clients are quick to notice that service claimed its bus name,
- * there may have been messages that came in before initialization was
- * all finished. Dispatch those here.
- */
-static void dispatch_initial_dbus_messages(void *eloop_ctx, void *timeout_ctx)
-{
- DBusConnection *con = eloop_ctx;
- dispatch_data(con);
-}
-
-
-static void process_watch(struct wpas_dbus_priv *priv,
- DBusWatch *watch, eloop_event_type type)
-{
- dbus_connection_ref(priv->con);
-
- priv->should_dispatch = 0;
-
- if (type == EVENT_TYPE_READ)
- dbus_watch_handle(watch, DBUS_WATCH_READABLE);
- else if (type == EVENT_TYPE_WRITE)
- dbus_watch_handle(watch, DBUS_WATCH_WRITABLE);
- else if (type == EVENT_TYPE_EXCEPTION)
- dbus_watch_handle(watch, DBUS_WATCH_ERROR);
-
- if (priv->should_dispatch) {
- dispatch_data(priv->con);
- priv->should_dispatch = 0;
- }
-
- dbus_connection_unref(priv->con);
-}
-
-
-static void process_watch_exception(int sock, void *eloop_ctx, void *sock_ctx)
-{
- process_watch(eloop_ctx, sock_ctx, EVENT_TYPE_EXCEPTION);
-}
-
-
-static void process_watch_read(int sock, void *eloop_ctx, void *sock_ctx)
-{
- process_watch(eloop_ctx, sock_ctx, EVENT_TYPE_READ);
-}
-
-
-static void process_watch_write(int sock, void *eloop_ctx, void *sock_ctx)
-{
- process_watch(eloop_ctx, sock_ctx, EVENT_TYPE_WRITE);
-}
-
-
-static dbus_bool_t add_watch(DBusWatch *watch, void *data)
-{
- struct wpas_dbus_priv *priv = data;
- unsigned int flags;
- int fd;
-
- if (!dbus_watch_get_enabled(watch))
- return TRUE;
-
- flags = dbus_watch_get_flags(watch);
- fd = dbus_watch_get_unix_fd(watch);
-
- eloop_register_sock(fd, EVENT_TYPE_EXCEPTION, process_watch_exception,
- priv, watch);
-
- if (flags & DBUS_WATCH_READABLE) {
- eloop_register_sock(fd, EVENT_TYPE_READ, process_watch_read,
- priv, watch);
- }
- if (flags & DBUS_WATCH_WRITABLE) {
- eloop_register_sock(fd, EVENT_TYPE_WRITE, process_watch_write,
- priv, watch);
- }
-
- dbus_watch_set_data(watch, priv, NULL);
-
- return TRUE;
-}
-
-
-static void remove_watch(DBusWatch *watch, void *data)
-{
- unsigned int flags;
- int fd;
-
- flags = dbus_watch_get_flags(watch);
- fd = dbus_watch_get_unix_fd(watch);
-
- eloop_unregister_sock(fd, EVENT_TYPE_EXCEPTION);
-
- if (flags & DBUS_WATCH_READABLE)
- eloop_unregister_sock(fd, EVENT_TYPE_READ);
- if (flags & DBUS_WATCH_WRITABLE)
- eloop_unregister_sock(fd, EVENT_TYPE_WRITE);
-
- dbus_watch_set_data(watch, NULL, NULL);
-}
-
-
-static void watch_toggled(DBusWatch *watch, void *data)
-{
- if (dbus_watch_get_enabled(watch))
- add_watch(watch, data);
- else
- remove_watch(watch, data);
-}
-
-
-static void process_timeout(void *eloop_ctx, void *sock_ctx)
-{
- DBusTimeout *timeout = sock_ctx;
- dbus_timeout_handle(timeout);
-}
-
-
-static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data)
-{
- struct wpas_dbus_priv *priv = data;
- if (!dbus_timeout_get_enabled(timeout))
- return TRUE;
-
- eloop_register_timeout(0, dbus_timeout_get_interval(timeout) * 1000,
- process_timeout, priv, timeout);
-
- dbus_timeout_set_data(timeout, priv, NULL);
-
- return TRUE;
-}
-
-
-static void remove_timeout(DBusTimeout *timeout, void *data)
-{
- struct wpas_dbus_priv *priv = data;
- eloop_cancel_timeout(process_timeout, priv, timeout);
- dbus_timeout_set_data(timeout, NULL, NULL);
-}
-
-
-static void timeout_toggled(DBusTimeout *timeout, void *data)
-{
- if (dbus_timeout_get_enabled(timeout))
- add_timeout(timeout, data);
- else
- remove_timeout(timeout, data);
-}
-
-
-static void process_wakeup_main(int sig, void *signal_ctx)
-{
- struct wpas_dbus_priv *priv = signal_ctx;
-
- if (sig != SIGPOLL || !priv->con)
- return;
-
- if (dbus_connection_get_dispatch_status(priv->con) !=
- DBUS_DISPATCH_DATA_REMAINS)
- return;
-
- /* Only dispatch once - we do not want to starve other events */
- dbus_connection_ref(priv->con);
- dbus_connection_dispatch(priv->con);
- dbus_connection_unref(priv->con);
-}
-
-
-/**
- * wakeup_main - Attempt to wake our mainloop up
- * @data: dbus control interface private data
- *
- * Try to wake up the main eloop so it will process
- * dbus events that may have happened.
- */
-static void wakeup_main(void *data)
-{
- struct wpas_dbus_priv *priv = data;
-
- /* Use SIGPOLL to break out of the eloop select() */
- raise(SIGPOLL);
- priv->should_dispatch = 1;
-}
-
-
-/**
- * integrate_with_eloop - Register our mainloop integration with dbus
- * @connection: connection to the system message bus
- * @priv: a dbus control interface data structure
- * Returns: 0 on success, -1 on failure
- */
-static int integrate_with_eloop(struct wpas_dbus_priv *priv)
-{
- if (!dbus_connection_set_watch_functions(priv->con, add_watch,
- remove_watch, watch_toggled,
- priv, NULL) ||
- !dbus_connection_set_timeout_functions(priv->con, add_timeout,
- remove_timeout,
- timeout_toggled, priv,
- NULL)) {
- wpa_printf(MSG_ERROR, "dbus: Failed to set callback "
- "functions");
- return -1;
- }
-
- if (eloop_register_signal(SIGPOLL, process_wakeup_main, priv))
- return -1;
- dbus_connection_set_wakeup_main_function(priv->con, wakeup_main,
- priv, NULL);
-
- return 0;
-}
-
-
-static int wpas_dbus_init_common(struct wpas_dbus_priv *priv)
-{
- DBusError error;
- int ret = 0;
-
- /* Get a reference to the system bus */
- dbus_error_init(&error);
- priv->con = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
- if (!priv->con) {
- wpa_printf(MSG_ERROR, "dbus: Could not acquire the system "
- "bus: %s - %s", error.name, error.message);
- ret = -1;
- }
- dbus_error_free(&error);
-
- return ret;
-}
-
-
-static int wpas_dbus_init_common_finish(struct wpas_dbus_priv *priv)
-{
- /* Tell dbus about our mainloop integration functions */
- integrate_with_eloop(priv);
-
- /*
- * Dispatch initial DBus messages that may have come in since the bus
- * name was claimed above. Happens when clients are quick to notice the
- * service.
- *
- * FIXME: is there a better solution to this problem?
- */
- eloop_register_timeout(0, 50, dispatch_initial_dbus_messages,
- priv->con, NULL);
-
- return 0;
-}
-
-
-static void wpas_dbus_deinit_common(struct wpas_dbus_priv *priv)
-{
- if (priv->con) {
- eloop_cancel_timeout(dispatch_initial_dbus_messages,
- priv->con, NULL);
- dbus_connection_set_watch_functions(priv->con, NULL, NULL,
- NULL, NULL, NULL);
- dbus_connection_set_timeout_functions(priv->con, NULL, NULL,
- NULL, NULL, NULL);
- dbus_connection_unref(priv->con);
- }
-
- os_free(priv);
-}
-
-
-struct wpas_dbus_priv * wpas_dbus_init(struct wpa_global *global)
-{
- struct wpas_dbus_priv *priv;
-
- priv = os_zalloc(sizeof(*priv));
- if (priv == NULL)
- return NULL;
- priv->global = global;
-
- if (wpas_dbus_init_common(priv) < 0) {
- wpas_dbus_deinit(priv);
- return NULL;
- }
-
-#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
- if (wpas_dbus_ctrl_iface_init(priv) < 0) {
- wpas_dbus_deinit(priv);
- return NULL;
- }
-#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
-
-#ifdef CONFIG_CTRL_IFACE_DBUS
- if (wpa_supplicant_dbus_ctrl_iface_init(priv) < 0) {
- wpas_dbus_deinit(priv);
- return NULL;
- }
-#endif /* CONFIG_CTRL_IFACE_DBUS */
-
- if (wpas_dbus_init_common_finish(priv) < 0) {
- wpas_dbus_deinit(priv);
- return NULL;
- }
-
- return priv;
-}
-
-
-void wpas_dbus_deinit(struct wpas_dbus_priv *priv)
-{
- if (priv == NULL)
- return;
-
-#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
- wpas_dbus_ctrl_iface_deinit(priv);
-#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
-
-#ifdef CONFIG_CTRL_IFACE_DBUS
- /* TODO: is any deinit needed? */
-#endif /* CONFIG_CTRL_IFACE_DBUS */
-
- wpas_dbus_deinit_common(priv);
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_common.h b/contrib/wpa/wpa_supplicant/dbus/dbus_common.h
deleted file mode 100644
index aea7db7..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_common.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * wpa_supplicant D-Bus control interface - common definitions
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
- * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef DBUS_COMMON_H
-#define DBUS_COMMON_H
-
-struct wpas_dbus_priv;
-struct wpa_global;
-
-struct wpas_dbus_priv * wpas_dbus_init(struct wpa_global *global);
-void wpas_dbus_deinit(struct wpas_dbus_priv *priv);
-
-#endif /* DBUS_COMMON_H */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_common_i.h b/contrib/wpa/wpa_supplicant/dbus/dbus_common_i.h
deleted file mode 100644
index a551ccd..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_common_i.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * wpa_supplicant D-Bus control interface - internal definitions
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
- * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef DBUS_COMMON_I_H
-#define DBUS_COMMON_I_H
-
-#include <dbus/dbus.h>
-
-struct wpas_dbus_priv {
- DBusConnection *con;
- int should_dispatch;
- struct wpa_global *global;
- u32 next_objid;
- int dbus_new_initialized;
-
-#if defined(CONFIG_CTRL_IFACE_DBUS_NEW) && defined(CONFIG_AP)
- int dbus_noc_refcnt;
-#endif /* CONFIG_CTRL_IFACE_DBUS_NEW && CONFIG_AP */
-};
-
-#endif /* DBUS_COMMON_I_H */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.c b/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.c
deleted file mode 100644
index 61a9430..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.c
+++ /dev/null
@@ -1,1104 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-#include <dbus/dbus.h>
-
-#include "common.h"
-#include "wpabuf.h"
-#include "dbus_dict_helpers.h"
-
-
-/**
- * Start a dict in a dbus message. Should be paired with a call to
- * wpa_dbus_dict_close_write().
- *
- * @param iter A valid dbus message iterator
- * @param iter_dict (out) A dict iterator to pass to further dict functions
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
- DBusMessageIter *iter_dict)
-{
- dbus_bool_t result;
-
- if (!iter || !iter_dict)
- return FALSE;
-
- result = dbus_message_iter_open_container(
- iter,
- DBUS_TYPE_ARRAY,
- DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
- DBUS_TYPE_STRING_AS_STRING
- DBUS_TYPE_VARIANT_AS_STRING
- DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
- iter_dict);
- return result;
-}
-
-
-/**
- * End a dict element in a dbus message. Should be paired with
- * a call to wpa_dbus_dict_open_write().
- *
- * @param iter valid dbus message iterator, same as passed to
- * wpa_dbus_dict_open_write()
- * @param iter_dict a dbus dict iterator returned from
- * wpa_dbus_dict_open_write()
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
- DBusMessageIter *iter_dict)
-{
- if (!iter || !iter_dict)
- return FALSE;
-
- return dbus_message_iter_close_container(iter, iter_dict);
-}
-
-
-const char * wpa_dbus_type_as_string(const int type)
-{
- switch(type) {
- case DBUS_TYPE_BYTE:
- return DBUS_TYPE_BYTE_AS_STRING;
- case DBUS_TYPE_BOOLEAN:
- return DBUS_TYPE_BOOLEAN_AS_STRING;
- case DBUS_TYPE_INT16:
- return DBUS_TYPE_INT16_AS_STRING;
- case DBUS_TYPE_UINT16:
- return DBUS_TYPE_UINT16_AS_STRING;
- case DBUS_TYPE_INT32:
- return DBUS_TYPE_INT32_AS_STRING;
- case DBUS_TYPE_UINT32:
- return DBUS_TYPE_UINT32_AS_STRING;
- case DBUS_TYPE_INT64:
- return DBUS_TYPE_INT64_AS_STRING;
- case DBUS_TYPE_UINT64:
- return DBUS_TYPE_UINT64_AS_STRING;
- case DBUS_TYPE_DOUBLE:
- return DBUS_TYPE_DOUBLE_AS_STRING;
- case DBUS_TYPE_STRING:
- return DBUS_TYPE_STRING_AS_STRING;
- case DBUS_TYPE_OBJECT_PATH:
- return DBUS_TYPE_OBJECT_PATH_AS_STRING;
- case DBUS_TYPE_ARRAY:
- return DBUS_TYPE_ARRAY_AS_STRING;
- default:
- return NULL;
- }
-}
-
-
-static dbus_bool_t _wpa_dbus_add_dict_entry_start(
- DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry,
- const char *key, const int value_type)
-{
- if (!dbus_message_iter_open_container(iter_dict,
- DBUS_TYPE_DICT_ENTRY, NULL,
- iter_dict_entry))
- return FALSE;
-
- if (!dbus_message_iter_append_basic(iter_dict_entry, DBUS_TYPE_STRING,
- &key))
- return FALSE;
-
- return TRUE;
-}
-
-
-static dbus_bool_t _wpa_dbus_add_dict_entry_end(
- DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val)
-{
- if (!dbus_message_iter_close_container(iter_dict_entry, iter_dict_val))
- return FALSE;
- if (!dbus_message_iter_close_container(iter_dict, iter_dict_entry))
- return FALSE;
-
- return TRUE;
-}
-
-
-static dbus_bool_t _wpa_dbus_add_dict_entry_basic(DBusMessageIter *iter_dict,
- const char *key,
- const int value_type,
- const void *value)
-{
- DBusMessageIter iter_dict_entry, iter_dict_val;
- const char *type_as_string = NULL;
-
- if (key == NULL)
- return FALSE;
-
- type_as_string = wpa_dbus_type_as_string(value_type);
- if (!type_as_string)
- return FALSE;
-
- if (!_wpa_dbus_add_dict_entry_start(iter_dict, &iter_dict_entry,
- key, value_type))
- return FALSE;
-
- if (!dbus_message_iter_open_container(&iter_dict_entry,
- DBUS_TYPE_VARIANT,
- type_as_string, &iter_dict_val))
- return FALSE;
-
- if (!dbus_message_iter_append_basic(&iter_dict_val, value_type, value))
- return FALSE;
-
- if (!_wpa_dbus_add_dict_entry_end(iter_dict, &iter_dict_entry,
- &iter_dict_val))
- return FALSE;
-
- return TRUE;
-}
-
-
-static dbus_bool_t _wpa_dbus_add_dict_entry_byte_array(
- DBusMessageIter *iter_dict, const char *key,
- const char *value, const dbus_uint32_t value_len)
-{
- DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
- dbus_uint32_t i;
-
- if (!_wpa_dbus_add_dict_entry_start(iter_dict, &iter_dict_entry,
- key, DBUS_TYPE_ARRAY))
- return FALSE;
-
- if (!dbus_message_iter_open_container(&iter_dict_entry,
- DBUS_TYPE_VARIANT,
- DBUS_TYPE_ARRAY_AS_STRING
- DBUS_TYPE_BYTE_AS_STRING,
- &iter_dict_val))
- return FALSE;
-
- if (!dbus_message_iter_open_container(&iter_dict_val, DBUS_TYPE_ARRAY,
- DBUS_TYPE_BYTE_AS_STRING,
- &iter_array))
- return FALSE;
-
- for (i = 0; i < value_len; i++) {
- if (!dbus_message_iter_append_basic(&iter_array,
- DBUS_TYPE_BYTE,
- &(value[i])))
- return FALSE;
- }
-
- if (!dbus_message_iter_close_container(&iter_dict_val, &iter_array))
- return FALSE;
-
- if (!_wpa_dbus_add_dict_entry_end(iter_dict, &iter_dict_entry,
- &iter_dict_val))
- return FALSE;
-
- return TRUE;
-}
-
-
-/**
- * Add a string entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The string value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
- const char *key, const char *value)
-{
- if (!value)
- return FALSE;
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_STRING,
- &value);
-}
-
-
-/**
- * Add a byte entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The byte value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_byte(DBusMessageIter *iter_dict,
- const char *key, const char value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_BYTE,
- &value);
-}
-
-
-/**
- * Add a boolean entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The boolean value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_bool(DBusMessageIter *iter_dict,
- const char *key, const dbus_bool_t value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key,
- DBUS_TYPE_BOOLEAN, &value);
-}
-
-
-/**
- * Add a 16-bit signed integer entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The 16-bit signed integer value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_int16(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_int16_t value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT16,
- &value);
-}
-
-
-/**
- * Add a 16-bit unsigned integer entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The 16-bit unsigned integer value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_uint16(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_uint16_t value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT16,
- &value);
-}
-
-
-/**
- * Add a 32-bit signed integer to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The 32-bit signed integer value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_int32(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_int32_t value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT32,
- &value);
-}
-
-
-/**
- * Add a 32-bit unsigned integer entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The 32-bit unsigned integer value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_uint32(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_uint32_t value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT32,
- &value);
-}
-
-
-/**
- * Add a 64-bit integer entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The 64-bit integer value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_int64(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_int64_t value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT64,
- &value);
-}
-
-
-/**
- * Add a 64-bit unsigned integer entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The 64-bit unsigned integer value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_uint64(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_uint64_t value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT64,
- &value);
-}
-
-
-/**
- * Add a double-precision floating point entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The double-precision floating point value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
- const char *key, const double value)
-{
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_DOUBLE,
- &value);
-}
-
-
-/**
- * Add a DBus object path entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The DBus object path value
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_object_path(DBusMessageIter *iter_dict,
- const char *key,
- const char *value)
-{
- if (!value)
- return FALSE;
- return _wpa_dbus_add_dict_entry_basic(iter_dict, key,
- DBUS_TYPE_OBJECT_PATH, &value);
-}
-
-
-/**
- * Add a byte array entry to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param value The byte array
- * @param value_len The length of the byte array, in bytes
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
- const char *key,
- const char *value,
- const dbus_uint32_t value_len)
-{
- if (!key)
- return FALSE;
- if (!value && (value_len != 0))
- return FALSE;
- return _wpa_dbus_add_dict_entry_byte_array(iter_dict, key, value,
- value_len);
-}
-
-
-/**
- * Begin an array entry in the dict
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param type The type of the contained data
- * @param iter_dict_entry A private DBusMessageIter provided by the caller to
- * be passed to wpa_dbus_dict_end_string_array()
- * @param iter_dict_val A private DBusMessageIter provided by the caller to
- * be passed to wpa_dbus_dict_end_string_array()
- * @param iter_array On return, the DBusMessageIter to be passed to
- * wpa_dbus_dict_string_array_add_element()
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_begin_array(DBusMessageIter *iter_dict,
- const char *key, const char *type,
- DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val,
- DBusMessageIter *iter_array)
-{
- char array_type[10];
- int err;
-
- err = os_snprintf(array_type, sizeof(array_type),
- DBUS_TYPE_ARRAY_AS_STRING "%s",
- type);
- if (err < 0 || err > (int) sizeof(array_type))
- return FALSE;
-
- if (!iter_dict || !iter_dict_entry || !iter_dict_val || !iter_array)
- return FALSE;
-
- if (!_wpa_dbus_add_dict_entry_start(iter_dict, iter_dict_entry,
- key, DBUS_TYPE_ARRAY))
- return FALSE;
-
- if (!dbus_message_iter_open_container(iter_dict_entry,
- DBUS_TYPE_VARIANT,
- array_type,
- iter_dict_val))
- return FALSE;
-
- if (!dbus_message_iter_open_container(iter_dict_val, DBUS_TYPE_ARRAY,
- type, iter_array))
- return FALSE;
-
- return TRUE;
-}
-
-
-dbus_bool_t wpa_dbus_dict_begin_string_array(DBusMessageIter *iter_dict,
- const char *key,
- DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val,
- DBusMessageIter *iter_array)
-{
- return wpa_dbus_dict_begin_array(
- iter_dict, key,
- DBUS_TYPE_STRING_AS_STRING,
- iter_dict_entry, iter_dict_val, iter_array);
-}
-
-
-/**
- * Add a single string element to a string array dict entry
- *
- * @param iter_array A valid DBusMessageIter returned from
- * wpa_dbus_dict_begin_string_array()'s
- * iter_array parameter
- * @param elem The string element to be added to the dict entry's string array
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_string_array_add_element(DBusMessageIter *iter_array,
- const char *elem)
-{
- if (!iter_array || !elem)
- return FALSE;
-
- return dbus_message_iter_append_basic(iter_array, DBUS_TYPE_STRING,
- &elem);
-}
-
-
-/**
- * Add a single byte array element to a string array dict entry
- *
- * @param iter_array A valid DBusMessageIter returned from
- * wpa_dbus_dict_begin_array()'s iter_array
- * parameter -- note that wpa_dbus_dict_begin_array()
- * must have been called with "ay" as the type
- * @param value The data to be added to the dict entry's array
- * @param value_len The length of the data
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_bin_array_add_element(DBusMessageIter *iter_array,
- const u8 *value,
- size_t value_len)
-{
- DBusMessageIter iter_bytes;
- size_t i;
-
- if (!iter_array || !value)
- return FALSE;
-
- if (!dbus_message_iter_open_container(iter_array, DBUS_TYPE_ARRAY,
- DBUS_TYPE_BYTE_AS_STRING,
- &iter_bytes))
- return FALSE;
-
- for (i = 0; i < value_len; i++) {
- if (!dbus_message_iter_append_basic(&iter_bytes,
- DBUS_TYPE_BYTE,
- &(value[i])))
- return FALSE;
- }
-
- if (!dbus_message_iter_close_container(iter_array, &iter_bytes))
- return FALSE;
-
- return TRUE;
-}
-
-
-/**
- * End an array dict entry
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param iter_dict_entry A private DBusMessageIter returned from
- * wpa_dbus_dict_begin_string_array() or
- * wpa_dbus_dict_begin_array()
- * @param iter_dict_val A private DBusMessageIter returned from
- * wpa_dbus_dict_begin_string_array() or
- * wpa_dbus_dict_begin_array()
- * @param iter_array A DBusMessageIter returned from
- * wpa_dbus_dict_begin_string_array() or
- * wpa_dbus_dict_begin_array()
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_end_array(DBusMessageIter *iter_dict,
- DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val,
- DBusMessageIter *iter_array)
-{
- if (!iter_dict || !iter_dict_entry || !iter_dict_val || !iter_array)
- return FALSE;
-
- if (!dbus_message_iter_close_container(iter_dict_val, iter_array))
- return FALSE;
-
- if (!_wpa_dbus_add_dict_entry_end(iter_dict, iter_dict_entry,
- iter_dict_val))
- return FALSE;
-
- return TRUE;
-}
-
-
-/**
- * Convenience function to add an entire string array to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param items The array of strings
- * @param num_items The number of strings in the array
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
- const char *key,
- const char **items,
- const dbus_uint32_t num_items)
-{
- DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
- dbus_uint32_t i;
-
- if (!key)
- return FALSE;
- if (!items && (num_items != 0))
- return FALSE;
-
- if (!wpa_dbus_dict_begin_string_array(iter_dict, key,
- &iter_dict_entry, &iter_dict_val,
- &iter_array))
- return FALSE;
-
- for (i = 0; i < num_items; i++) {
- if (!wpa_dbus_dict_string_array_add_element(&iter_array,
- items[i]))
- return FALSE;
- }
-
- if (!wpa_dbus_dict_end_string_array(iter_dict, &iter_dict_entry,
- &iter_dict_val, &iter_array))
- return FALSE;
-
- return TRUE;
-}
-
-
-/**
- * Convenience function to add an wpabuf binary array to the dict.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_write()
- * @param key The key of the dict item
- * @param items The array of wpabuf structures
- * @param num_items The number of strings in the array
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_append_wpabuf_array(DBusMessageIter *iter_dict,
- const char *key,
- const struct wpabuf **items,
- const dbus_uint32_t num_items)
-{
- DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
- dbus_uint32_t i;
-
- if (!key)
- return FALSE;
- if (!items && (num_items != 0))
- return FALSE;
-
- if (!wpa_dbus_dict_begin_array(iter_dict, key,
- DBUS_TYPE_ARRAY_AS_STRING
- DBUS_TYPE_BYTE_AS_STRING,
- &iter_dict_entry, &iter_dict_val,
- &iter_array))
- return FALSE;
-
- for (i = 0; i < num_items; i++) {
- if (!wpa_dbus_dict_bin_array_add_element(&iter_array,
- wpabuf_head(items[i]),
- wpabuf_len(items[i])))
- return FALSE;
- }
-
- if (!wpa_dbus_dict_end_array(iter_dict, &iter_dict_entry,
- &iter_dict_val, &iter_array))
- return FALSE;
-
- return TRUE;
-}
-
-
-/*****************************************************/
-/* Stuff for reading dicts */
-/*****************************************************/
-
-/**
- * Start reading from a dbus dict.
- *
- * @param iter A valid DBusMessageIter pointing to the start of the dict
- * @param iter_dict (out) A DBusMessageIter to be passed to
- * wpa_dbus_dict_read_next_entry()
- * @error on failure a descriptive error
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
- DBusMessageIter *iter_dict,
- DBusError *error)
-{
- if (!iter || !iter_dict) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "[internal] missing message iterators");
- return FALSE;
- }
-
- if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(iter) != DBUS_TYPE_DICT_ENTRY) {
- dbus_set_error_const(error, DBUS_ERROR_INVALID_ARGS,
- "unexpected message argument types");
- return FALSE;
- }
-
- dbus_message_iter_recurse(iter, iter_dict);
- return TRUE;
-}
-
-
-#define BYTE_ARRAY_CHUNK_SIZE 34
-#define BYTE_ARRAY_ITEM_SIZE (sizeof(char))
-
-static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
- DBusMessageIter *iter, struct wpa_dbus_dict_entry *entry)
-{
- dbus_uint32_t count = 0;
- dbus_bool_t success = FALSE;
- char *buffer, *nbuffer;
-
- entry->bytearray_value = NULL;
- entry->array_type = DBUS_TYPE_BYTE;
-
- buffer = os_calloc(BYTE_ARRAY_CHUNK_SIZE, BYTE_ARRAY_ITEM_SIZE);
- if (!buffer)
- return FALSE;
-
- entry->bytearray_value = buffer;
- entry->array_len = 0;
- while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) {
- char byte;
-
- if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
- nbuffer = os_realloc_array(
- buffer, count + BYTE_ARRAY_CHUNK_SIZE,
- BYTE_ARRAY_ITEM_SIZE);
- if (nbuffer == NULL) {
- os_free(buffer);
- wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_"
- "entry_get_byte_array out of "
- "memory trying to retrieve the "
- "string array");
- goto done;
- }
- buffer = nbuffer;
- }
- entry->bytearray_value = buffer;
-
- dbus_message_iter_get_basic(iter, &byte);
- entry->bytearray_value[count] = byte;
- entry->array_len = ++count;
- dbus_message_iter_next(iter);
- }
-
- /* Zero-length arrays are valid. */
- if (entry->array_len == 0) {
- os_free(entry->bytearray_value);
- entry->bytearray_value = NULL;
- }
-
- success = TRUE;
-
-done:
- return success;
-}
-
-
-#define STR_ARRAY_CHUNK_SIZE 8
-#define STR_ARRAY_ITEM_SIZE (sizeof(char *))
-
-static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
- DBusMessageIter *iter, int array_type,
- struct wpa_dbus_dict_entry *entry)
-{
- dbus_uint32_t count = 0;
- dbus_bool_t success = FALSE;
- char **buffer, **nbuffer;
-
- entry->strarray_value = NULL;
- entry->array_type = DBUS_TYPE_STRING;
-
- buffer = os_calloc(STR_ARRAY_CHUNK_SIZE, STR_ARRAY_ITEM_SIZE);
- if (buffer == NULL)
- return FALSE;
-
- entry->strarray_value = buffer;
- entry->array_len = 0;
- while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRING) {
- const char *value;
- char *str;
-
- if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
- nbuffer = os_realloc_array(
- buffer, count + STR_ARRAY_CHUNK_SIZE,
- STR_ARRAY_ITEM_SIZE);
- if (nbuffer == NULL) {
- os_free(buffer);
- wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_"
- "entry_get_string_array out of "
- "memory trying to retrieve the "
- "string array");
- goto done;
- }
- buffer = nbuffer;
- }
- entry->strarray_value = buffer;
-
- dbus_message_iter_get_basic(iter, &value);
- str = os_strdup(value);
- if (str == NULL) {
- wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_entry_get_"
- "string_array out of memory trying to "
- "duplicate the string array");
- goto done;
- }
- entry->strarray_value[count] = str;
- entry->array_len = ++count;
- dbus_message_iter_next(iter);
- }
-
- /* Zero-length arrays are valid. */
- if (entry->array_len == 0) {
- os_free(entry->strarray_value);
- entry->strarray_value = NULL;
- }
-
- success = TRUE;
-
-done:
- return success;
-}
-
-
-#define BIN_ARRAY_CHUNK_SIZE 10
-#define BIN_ARRAY_ITEM_SIZE (sizeof(struct wpabuf *))
-
-static dbus_bool_t _wpa_dbus_dict_entry_get_binarray(
- DBusMessageIter *iter, struct wpa_dbus_dict_entry *entry)
-{
- struct wpa_dbus_dict_entry tmpentry;
- size_t buflen = 0;
- int i;
-
- if (dbus_message_iter_get_element_type(iter) != DBUS_TYPE_BYTE)
- return FALSE;
-
- entry->array_type = WPAS_DBUS_TYPE_BINARRAY;
- entry->array_len = 0;
- entry->binarray_value = NULL;
-
- while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
- DBusMessageIter iter_array;
-
- if (entry->array_len == buflen) {
- struct wpabuf **newbuf;
-
- buflen += BIN_ARRAY_CHUNK_SIZE;
-
- newbuf = os_realloc_array(entry->binarray_value,
- buflen, BIN_ARRAY_ITEM_SIZE);
- if (!newbuf)
- goto cleanup;
- entry->binarray_value = newbuf;
- }
-
- dbus_message_iter_recurse(iter, &iter_array);
- if (_wpa_dbus_dict_entry_get_byte_array(&iter_array, &tmpentry)
- == FALSE)
- goto cleanup;
-
- entry->binarray_value[entry->array_len] =
- wpabuf_alloc_ext_data((u8 *) tmpentry.bytearray_value,
- tmpentry.array_len);
- if (entry->binarray_value[entry->array_len] == NULL) {
- wpa_dbus_dict_entry_clear(&tmpentry);
- goto cleanup;
- }
- entry->array_len++;
- dbus_message_iter_next(iter);
- }
-
- return TRUE;
-
- cleanup:
- for (i = 0; i < (int) entry->array_len; i++)
- wpabuf_free(entry->binarray_value[i]);
- os_free(entry->binarray_value);
- entry->array_len = 0;
- entry->binarray_value = NULL;
- return FALSE;
-}
-
-
-static dbus_bool_t _wpa_dbus_dict_entry_get_array(
- DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry)
-{
- int array_type = dbus_message_iter_get_element_type(iter_dict_val);
- dbus_bool_t success = FALSE;
- DBusMessageIter iter_array;
-
- if (!entry)
- return FALSE;
-
- dbus_message_iter_recurse(iter_dict_val, &iter_array);
-
- switch (array_type) {
- case DBUS_TYPE_BYTE:
- success = _wpa_dbus_dict_entry_get_byte_array(&iter_array,
- entry);
- break;
- case DBUS_TYPE_STRING:
- success = _wpa_dbus_dict_entry_get_string_array(&iter_array,
- array_type,
- entry);
- break;
- case DBUS_TYPE_ARRAY:
- success = _wpa_dbus_dict_entry_get_binarray(&iter_array, entry);
- default:
- break;
- }
-
- return success;
-}
-
-
-static dbus_bool_t _wpa_dbus_dict_fill_value_from_variant(
- struct wpa_dbus_dict_entry *entry, DBusMessageIter *iter)
-{
- const char *v;
-
- switch (entry->type) {
- case DBUS_TYPE_OBJECT_PATH:
- case DBUS_TYPE_STRING:
- dbus_message_iter_get_basic(iter, &v);
- entry->str_value = os_strdup(v);
- if (entry->str_value == NULL)
- return FALSE;
- break;
- case DBUS_TYPE_BOOLEAN:
- dbus_message_iter_get_basic(iter, &entry->bool_value);
- break;
- case DBUS_TYPE_BYTE:
- dbus_message_iter_get_basic(iter, &entry->byte_value);
- break;
- case DBUS_TYPE_INT16:
- dbus_message_iter_get_basic(iter, &entry->int16_value);
- break;
- case DBUS_TYPE_UINT16:
- dbus_message_iter_get_basic(iter, &entry->uint16_value);
- break;
- case DBUS_TYPE_INT32:
- dbus_message_iter_get_basic(iter, &entry->int32_value);
- break;
- case DBUS_TYPE_UINT32:
- dbus_message_iter_get_basic(iter, &entry->uint32_value);
- break;
- case DBUS_TYPE_INT64:
- dbus_message_iter_get_basic(iter, &entry->int64_value);
- break;
- case DBUS_TYPE_UINT64:
- dbus_message_iter_get_basic(iter, &entry->uint64_value);
- break;
- case DBUS_TYPE_DOUBLE:
- dbus_message_iter_get_basic(iter, &entry->double_value);
- break;
- case DBUS_TYPE_ARRAY:
- return _wpa_dbus_dict_entry_get_array(iter, entry);
- default:
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/**
- * Read the current key/value entry from the dict. Entries are dynamically
- * allocated when needed and must be freed after use with the
- * wpa_dbus_dict_entry_clear() function.
- *
- * The returned entry object will be filled with the type and value of the next
- * entry in the dict, or the type will be DBUS_TYPE_INVALID if an error
- * occurred.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_read()
- * @param entry A valid dict entry object into which the dict key and value
- * will be placed
- * @return TRUE on success, FALSE on failure
- *
- */
-dbus_bool_t wpa_dbus_dict_get_entry(DBusMessageIter *iter_dict,
- struct wpa_dbus_dict_entry * entry)
-{
- DBusMessageIter iter_dict_entry, iter_dict_val;
- int type;
- const char *key;
-
- if (!iter_dict || !entry)
- goto error;
-
- if (dbus_message_iter_get_arg_type(iter_dict) != DBUS_TYPE_DICT_ENTRY)
- goto error;
-
- dbus_message_iter_recurse(iter_dict, &iter_dict_entry);
- dbus_message_iter_get_basic(&iter_dict_entry, &key);
- entry->key = key;
-
- if (!dbus_message_iter_next(&iter_dict_entry))
- goto error;
- type = dbus_message_iter_get_arg_type(&iter_dict_entry);
- if (type != DBUS_TYPE_VARIANT)
- goto error;
-
- dbus_message_iter_recurse(&iter_dict_entry, &iter_dict_val);
- entry->type = dbus_message_iter_get_arg_type(&iter_dict_val);
- if (!_wpa_dbus_dict_fill_value_from_variant(entry, &iter_dict_val))
- goto error;
-
- dbus_message_iter_next(iter_dict);
- return TRUE;
-
-error:
- if (entry) {
- wpa_dbus_dict_entry_clear(entry);
- entry->type = DBUS_TYPE_INVALID;
- entry->array_type = DBUS_TYPE_INVALID;
- }
-
- return FALSE;
-}
-
-
-/**
- * Return whether or not there are additional dictionary entries.
- *
- * @param iter_dict A valid DBusMessageIter returned from
- * wpa_dbus_dict_open_read()
- * @return TRUE if more dict entries exists, FALSE if no more dict entries
- * exist
- */
-dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict)
-{
- if (!iter_dict)
- return FALSE;
- return dbus_message_iter_get_arg_type(iter_dict) ==
- DBUS_TYPE_DICT_ENTRY;
-}
-
-
-/**
- * Free any memory used by the entry object.
- *
- * @param entry The entry object
- */
-void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry)
-{
- unsigned int i;
-
- if (!entry)
- return;
- switch (entry->type) {
- case DBUS_TYPE_OBJECT_PATH:
- case DBUS_TYPE_STRING:
- os_free(entry->str_value);
- break;
- case DBUS_TYPE_ARRAY:
- switch (entry->array_type) {
- case DBUS_TYPE_BYTE:
- os_free(entry->bytearray_value);
- break;
- case DBUS_TYPE_STRING:
- for (i = 0; i < entry->array_len; i++)
- os_free(entry->strarray_value[i]);
- os_free(entry->strarray_value);
- break;
- case WPAS_DBUS_TYPE_BINARRAY:
- for (i = 0; i < entry->array_len; i++)
- wpabuf_free(entry->binarray_value[i]);
- os_free(entry->binarray_value);
- break;
- }
- break;
- }
-
- os_memset(entry, 0, sizeof(struct wpa_dbus_dict_entry));
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.h b/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.h
deleted file mode 100644
index 9666349..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_dict_helpers.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef DBUS_DICT_HELPERS_H
-#define DBUS_DICT_HELPERS_H
-
-#include "wpabuf.h"
-
-/*
- * Adding a dict to a DBusMessage
- */
-
-dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
- DBusMessageIter *iter_dict);
-
-dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
- DBusMessageIter *iter_dict);
-
-const char * wpa_dbus_type_as_string(const int type);
-
-dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
- const char *key, const char *value);
-
-dbus_bool_t wpa_dbus_dict_append_byte(DBusMessageIter *iter_dict,
- const char *key, const char value);
-
-dbus_bool_t wpa_dbus_dict_append_bool(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_bool_t value);
-
-dbus_bool_t wpa_dbus_dict_append_int16(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_int16_t value);
-
-dbus_bool_t wpa_dbus_dict_append_uint16(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_uint16_t value);
-
-dbus_bool_t wpa_dbus_dict_append_int32(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_int32_t value);
-
-dbus_bool_t wpa_dbus_dict_append_uint32(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_uint32_t value);
-
-dbus_bool_t wpa_dbus_dict_append_int64(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_int64_t value);
-
-dbus_bool_t wpa_dbus_dict_append_uint64(DBusMessageIter *iter_dict,
- const char *key,
- const dbus_uint64_t value);
-
-dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
- const char *key,
- const double value);
-
-dbus_bool_t wpa_dbus_dict_append_object_path(DBusMessageIter *iter_dict,
- const char *key,
- const char *value);
-
-dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
- const char *key,
- const char *value,
- const dbus_uint32_t value_len);
-
-/* Manual construction and addition of array elements */
-dbus_bool_t wpa_dbus_dict_begin_array(DBusMessageIter *iter_dict,
- const char *key, const char *type,
- DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val,
- DBusMessageIter *iter_array);
-
-dbus_bool_t wpa_dbus_dict_begin_string_array(DBusMessageIter *iter_dict,
- const char *key,
- DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val,
- DBusMessageIter *iter_array);
-
-dbus_bool_t wpa_dbus_dict_string_array_add_element(DBusMessageIter *iter_array,
- const char *elem);
-
-dbus_bool_t wpa_dbus_dict_bin_array_add_element(DBusMessageIter *iter_array,
- const u8 *value,
- size_t value_len);
-
-dbus_bool_t wpa_dbus_dict_end_array(DBusMessageIter *iter_dict,
- DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val,
- DBusMessageIter *iter_array);
-
-static inline dbus_bool_t
-wpa_dbus_dict_end_string_array(DBusMessageIter *iter_dict,
- DBusMessageIter *iter_dict_entry,
- DBusMessageIter *iter_dict_val,
- DBusMessageIter *iter_array)
-{
- return wpa_dbus_dict_end_array(iter_dict, iter_dict_entry,
- iter_dict_val, iter_array);
-}
-
-/* Convenience function to add a whole string list */
-dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
- const char *key,
- const char **items,
- const dbus_uint32_t num_items);
-
-dbus_bool_t wpa_dbus_dict_append_wpabuf_array(DBusMessageIter *iter_dict,
- const char *key,
- const struct wpabuf **items,
- const dbus_uint32_t num_items);
-
-/*
- * Reading a dict from a DBusMessage
- */
-
-#define WPAS_DBUS_TYPE_BINARRAY (DBUS_NUMBER_OF_TYPES + 100)
-
-struct wpa_dbus_dict_entry {
- int type; /** the dbus type of the dict entry's value */
- int array_type; /** the dbus type of the array elements if the dict
- entry value contains an array, or the special
- WPAS_DBUS_TYPE_BINARRAY */
- const char *key; /** key of the dict entry */
-
- /** Possible values of the property */
- union {
- char *str_value;
- char byte_value;
- dbus_bool_t bool_value;
- dbus_int16_t int16_value;
- dbus_uint16_t uint16_value;
- dbus_int32_t int32_value;
- dbus_uint32_t uint32_value;
- dbus_int64_t int64_value;
- dbus_uint64_t uint64_value;
- double double_value;
- char *bytearray_value;
- char **strarray_value;
- struct wpabuf **binarray_value;
- };
- dbus_uint32_t array_len; /** length of the array if the dict entry's
- value contains an array */
-};
-
-dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
- DBusMessageIter *iter_dict,
- DBusError *error);
-
-dbus_bool_t wpa_dbus_dict_get_entry(DBusMessageIter *iter_dict,
- struct wpa_dbus_dict_entry *entry);
-
-dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict);
-
-void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry);
-
-#endif /* DBUS_DICT_HELPERS_H */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new.c b/contrib/wpa/wpa_supplicant/dbus/dbus_new.c
deleted file mode 100644
index 8bc6618..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new.c
+++ /dev/null
@@ -1,3710 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
- * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-
-#include "common.h"
-#include "common/ieee802_11_defs.h"
-#include "wps/wps.h"
-#include "../config.h"
-#include "../wpa_supplicant_i.h"
-#include "../bss.h"
-#include "../wpas_glue.h"
-#include "dbus_new_helpers.h"
-#include "dbus_dict_helpers.h"
-#include "dbus_new.h"
-#include "dbus_new_handlers.h"
-#include "dbus_common_i.h"
-#include "dbus_new_handlers_p2p.h"
-#include "p2p/p2p.h"
-
-#ifdef CONFIG_AP /* until needed by something else */
-
-/*
- * NameOwnerChanged handling
- *
- * Some services we provide allow an application to register for
- * a signal that it needs. While it can also unregister, we must
- * be prepared for the case where the application simply crashes
- * and thus doesn't clean up properly. The way to handle this in
- * DBus is to register for the NameOwnerChanged signal which will
- * signal an owner change to NULL if the peer closes the socket
- * for whatever reason.
- *
- * Handle this signal via a filter function whenever necessary.
- * The code below also handles refcounting in case in the future
- * there will be multiple instances of this subscription scheme.
- */
-static const char wpas_dbus_noc_filter_str[] =
- "interface=org.freedesktop.DBus,member=NameOwnerChanged";
-
-
-static DBusHandlerResult noc_filter(DBusConnection *conn,
- DBusMessage *message, void *data)
-{
- struct wpas_dbus_priv *priv = data;
-
- if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_SIGNAL)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS,
- "NameOwnerChanged")) {
- const char *name;
- const char *prev_owner;
- const char *new_owner;
- DBusError derr;
- struct wpa_supplicant *wpa_s;
-
- dbus_error_init(&derr);
-
- if (!dbus_message_get_args(message, &derr,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &prev_owner,
- DBUS_TYPE_STRING, &new_owner,
- DBUS_TYPE_INVALID)) {
- /* Ignore this error */
- dbus_error_free(&derr);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- for (wpa_s = priv->global->ifaces; wpa_s; wpa_s = wpa_s->next)
- {
- if (wpa_s->preq_notify_peer != NULL &&
- os_strcmp(name, wpa_s->preq_notify_peer) == 0 &&
- (new_owner == NULL || os_strlen(new_owner) == 0)) {
- /* probe request owner disconnected */
- os_free(wpa_s->preq_notify_peer);
- wpa_s->preq_notify_peer = NULL;
- wpas_dbus_unsubscribe_noc(priv);
- }
- }
- }
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-void wpas_dbus_subscribe_noc(struct wpas_dbus_priv *priv)
-{
- priv->dbus_noc_refcnt++;
- if (priv->dbus_noc_refcnt > 1)
- return;
-
- if (!dbus_connection_add_filter(priv->con, noc_filter, priv, NULL)) {
- wpa_printf(MSG_ERROR, "dbus: failed to add filter");
- return;
- }
-
- dbus_bus_add_match(priv->con, wpas_dbus_noc_filter_str, NULL);
-}
-
-
-void wpas_dbus_unsubscribe_noc(struct wpas_dbus_priv *priv)
-{
- priv->dbus_noc_refcnt--;
- if (priv->dbus_noc_refcnt > 0)
- return;
-
- dbus_bus_remove_match(priv->con, wpas_dbus_noc_filter_str, NULL);
- dbus_connection_remove_filter(priv->con, noc_filter, priv);
-}
-
-#endif /* CONFIG_AP */
-
-
-/**
- * wpas_dbus_signal_interface - Send a interface related event signal
- * @wpa_s: %wpa_supplicant network interface data
- * @sig_name: signal name - InterfaceAdded or InterfaceRemoved
- * @properties: Whether to add second argument with object properties
- *
- * Notify listeners about event related with interface
- */
-static void wpas_dbus_signal_interface(struct wpa_supplicant *wpa_s,
- const char *sig_name, int properties)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(WPAS_DBUS_NEW_PATH,
- WPAS_DBUS_NEW_INTERFACE, sig_name);
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &wpa_s->dbus_new_path))
- goto err;
-
- if (properties) {
- if (!wpa_dbus_get_object_properties(
- iface, wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE, &iter))
- goto err;
- }
-
- dbus_connection_send(iface->con, msg, NULL);
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_interface_added - Send a interface created signal
- * @wpa_s: %wpa_supplicant network interface data
- *
- * Notify listeners about creating new interface
- */
-static void wpas_dbus_signal_interface_added(struct wpa_supplicant *wpa_s)
-{
- wpas_dbus_signal_interface(wpa_s, "InterfaceAdded", TRUE);
-}
-
-
-/**
- * wpas_dbus_signal_interface_removed - Send a interface removed signal
- * @wpa_s: %wpa_supplicant network interface data
- *
- * Notify listeners about removing interface
- */
-static void wpas_dbus_signal_interface_removed(struct wpa_supplicant *wpa_s)
-{
- wpas_dbus_signal_interface(wpa_s, "InterfaceRemoved", FALSE);
-
-}
-
-
-/**
- * wpas_dbus_signal_scan_done - send scan done signal
- * @wpa_s: %wpa_supplicant network interface data
- * @success: indicates if scanning succeed or failed
- *
- * Notify listeners about finishing a scan
- */
-void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- dbus_bool_t succ;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- "ScanDone");
- if (msg == NULL)
- return;
-
- succ = success ? TRUE : FALSE;
- if (dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &succ,
- DBUS_TYPE_INVALID))
- dbus_connection_send(iface->con, msg, NULL);
- else
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_blob - Send a BSS related event signal
- * @wpa_s: %wpa_supplicant network interface data
- * @bss_obj_path: BSS object path
- * @sig_name: signal name - BSSAdded or BSSRemoved
- * @properties: Whether to add second argument with object properties
- *
- * Notify listeners about event related with BSS
- */
-static void wpas_dbus_signal_bss(struct wpa_supplicant *wpa_s,
- const char *bss_obj_path,
- const char *sig_name, int properties)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- sig_name);
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &bss_obj_path))
- goto err;
-
- if (properties) {
- if (!wpa_dbus_get_object_properties(iface, bss_obj_path,
- WPAS_DBUS_NEW_IFACE_BSS,
- &iter))
- goto err;
- }
-
- dbus_connection_send(iface->con, msg, NULL);
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_bss_added - Send a BSS added signal
- * @wpa_s: %wpa_supplicant network interface data
- * @bss_obj_path: new BSS object path
- *
- * Notify listeners about adding new BSS
- */
-static void wpas_dbus_signal_bss_added(struct wpa_supplicant *wpa_s,
- const char *bss_obj_path)
-{
- wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSAdded", TRUE);
-}
-
-
-/**
- * wpas_dbus_signal_bss_removed - Send a BSS removed signal
- * @wpa_s: %wpa_supplicant network interface data
- * @bss_obj_path: BSS object path
- *
- * Notify listeners about removing BSS
- */
-static void wpas_dbus_signal_bss_removed(struct wpa_supplicant *wpa_s,
- const char *bss_obj_path)
-{
- wpas_dbus_signal_bss(wpa_s, bss_obj_path, "BSSRemoved", FALSE);
-}
-
-
-/**
- * wpas_dbus_signal_blob - Send a blob related event signal
- * @wpa_s: %wpa_supplicant network interface data
- * @name: blob name
- * @sig_name: signal name - BlobAdded or BlobRemoved
- *
- * Notify listeners about event related with blob
- */
-static void wpas_dbus_signal_blob(struct wpa_supplicant *wpa_s,
- const char *name, const char *sig_name)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- sig_name);
- if (msg == NULL)
- return;
-
- if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INVALID))
- dbus_connection_send(iface->con, msg, NULL);
- else
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_blob_added - Send a blob added signal
- * @wpa_s: %wpa_supplicant network interface data
- * @name: blob name
- *
- * Notify listeners about adding a new blob
- */
-void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
- const char *name)
-{
- wpas_dbus_signal_blob(wpa_s, name, "BlobAdded");
-}
-
-
-/**
- * wpas_dbus_signal_blob_removed - Send a blob removed signal
- * @wpa_s: %wpa_supplicant network interface data
- * @name: blob name
- *
- * Notify listeners about removing blob
- */
-void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
- const char *name)
-{
- wpas_dbus_signal_blob(wpa_s, name, "BlobRemoved");
-}
-
-
-/**
- * wpas_dbus_signal_network - Send a network related event signal
- * @wpa_s: %wpa_supplicant network interface data
- * @id: new network id
- * @sig_name: signal name - NetworkAdded, NetworkRemoved or NetworkSelected
- * @properties: determines if add second argument with object properties
- *
- * Notify listeners about event related with configured network
- */
-static void wpas_dbus_signal_network(struct wpa_supplicant *wpa_s,
- int id, const char *sig_name,
- int properties)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
- char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
- wpa_s->dbus_new_path, id);
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- sig_name);
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- path = net_obj_path;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path))
- goto err;
-
- if (properties) {
- if (!wpa_dbus_get_object_properties(
- iface, net_obj_path, WPAS_DBUS_NEW_IFACE_NETWORK,
- &iter))
- goto err;
- }
-
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_network_added - Send a network added signal
- * @wpa_s: %wpa_supplicant network interface data
- * @id: new network id
- *
- * Notify listeners about adding new network
- */
-static void wpas_dbus_signal_network_added(struct wpa_supplicant *wpa_s,
- int id)
-{
- wpas_dbus_signal_network(wpa_s, id, "NetworkAdded", TRUE);
-}
-
-
-/**
- * wpas_dbus_signal_network_removed - Send a network removed signal
- * @wpa_s: %wpa_supplicant network interface data
- * @id: network id
- *
- * Notify listeners about removing a network
- */
-static void wpas_dbus_signal_network_removed(struct wpa_supplicant *wpa_s,
- int id)
-{
- wpas_dbus_signal_network(wpa_s, id, "NetworkRemoved", FALSE);
-}
-
-
-/**
- * wpas_dbus_signal_network_selected - Send a network selected signal
- * @wpa_s: %wpa_supplicant network interface data
- * @id: network id
- *
- * Notify listeners about selecting a network
- */
-void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id)
-{
- wpas_dbus_signal_network(wpa_s, id, "NetworkSelected", FALSE);
-}
-
-
-/**
- * wpas_dbus_signal_network_request - Indicate that additional information
- * (EAP password, etc.) is required to complete the association to this SSID
- * @wpa_s: %wpa_supplicant network interface data
- * @rtype: The specific additional information required
- * @default_text: Optional description of required information
- *
- * Request additional information or passwords to complete an association
- * request.
- */
-void wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid,
- enum wpa_ctrl_req_type rtype,
- const char *default_txt)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
- char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
- const char *field, *txt = NULL, *net_ptr;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- field = wpa_supplicant_ctrl_req_to_string(rtype, default_txt, &txt);
- if (field == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- "NetworkRequest");
- if (msg == NULL)
- return;
-
- os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
- wpa_s->dbus_new_path, ssid->id);
- net_ptr = &net_obj_path[0];
-
- dbus_message_iter_init_append(msg, &iter);
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &net_ptr))
- goto err;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &field))
- goto err;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &txt))
- goto err;
-
- dbus_connection_send(iface->con, msg, NULL);
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_network_enabled_changed - Signals Enabled property changes
- * @wpa_s: %wpa_supplicant network interface data
- * @ssid: configured network which Enabled property has changed
- *
- * Sends PropertyChanged signals containing new value of Enabled property
- * for specified network
- */
-void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
-
- char path[WPAS_DBUS_OBJECT_PATH_MAX];
- os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
- wpa_s->dbus_new_path, ssid->id);
-
- wpa_dbus_mark_property_changed(wpa_s->global->dbus, path,
- WPAS_DBUS_NEW_IFACE_NETWORK, "Enabled");
-}
-
-
-#ifdef CONFIG_WPS
-
-/**
- * wpas_dbus_signal_wps_event_success - Signals Success WPS event
- * @wpa_s: %wpa_supplicant network interface data
- *
- * Sends Event dbus signal with name "success" and empty dict as arguments
- */
-void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s)
-{
-
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char *key = "success";
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_WPS, "Event");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
- !wpa_dbus_dict_open_write(&iter, &dict_iter) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- else
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_wps_event_fail - Signals Fail WPS event
- * @wpa_s: %wpa_supplicant network interface data
- *
- * Sends Event dbus signal with name "fail" and dictionary containing
- * "msg field with fail message number (int32) as arguments
- */
-void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
- struct wps_event_fail *fail)
-{
-
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char *key = "fail";
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_WPS, "Event");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
- !wpa_dbus_dict_open_write(&iter, &dict_iter) ||
- !wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- else
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_wps_event_m2d - Signals M2D WPS event
- * @wpa_s: %wpa_supplicant network interface data
- *
- * Sends Event dbus signal with name "m2d" and dictionary containing
- * fields of wps_event_m2d structure.
- */
-void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
- struct wps_event_m2d *m2d)
-{
-
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char *key = "m2d";
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_WPS, "Event");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
- !wpa_dbus_dict_open_write(&iter, &dict_iter) ||
- !wpa_dbus_dict_append_uint16(&dict_iter, "config_methods",
- m2d->config_methods) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "manufacturer",
- (const char *) m2d->manufacturer,
- m2d->manufacturer_len) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "model_name",
- (const char *) m2d->model_name,
- m2d->model_name_len) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "model_number",
- (const char *) m2d->model_number,
- m2d->model_number_len) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "serial_number",
- (const char *)
- m2d->serial_number,
- m2d->serial_number_len) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "dev_name",
- (const char *) m2d->dev_name,
- m2d->dev_name_len) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "primary_dev_type",
- (const char *)
- m2d->primary_dev_type, 8) ||
- !wpa_dbus_dict_append_uint16(&dict_iter, "config_error",
- m2d->config_error) ||
- !wpa_dbus_dict_append_uint16(&dict_iter, "dev_password_id",
- m2d->dev_password_id) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- else
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_wps_cred - Signals new credentials
- * @wpa_s: %wpa_supplicant network interface data
- *
- * Sends signal with credentials in directory argument
- */
-void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred)
-{
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char *auth_type[6]; /* we have six possible authorization types */
- int at_num = 0;
- char *encr_type[4]; /* we have four possible encryption types */
- int et_num = 0;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_WPS,
- "Credentials");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto nomem;
-
- if (cred->auth_type & WPS_AUTH_OPEN)
- auth_type[at_num++] = "open";
- if (cred->auth_type & WPS_AUTH_WPAPSK)
- auth_type[at_num++] = "wpa-psk";
- if (cred->auth_type & WPS_AUTH_SHARED)
- auth_type[at_num++] = "shared";
- if (cred->auth_type & WPS_AUTH_WPA)
- auth_type[at_num++] = "wpa-eap";
- if (cred->auth_type & WPS_AUTH_WPA2)
- auth_type[at_num++] = "wpa2-eap";
- if (cred->auth_type & WPS_AUTH_WPA2PSK)
- auth_type[at_num++] =
- "wpa2-psk";
-
- if (cred->encr_type & WPS_ENCR_NONE)
- encr_type[et_num++] = "none";
- if (cred->encr_type & WPS_ENCR_WEP)
- encr_type[et_num++] = "wep";
- if (cred->encr_type & WPS_ENCR_TKIP)
- encr_type[et_num++] = "tkip";
- if (cred->encr_type & WPS_ENCR_AES)
- encr_type[et_num++] = "aes";
-
- if (wpa_s->current_ssid) {
- if (!wpa_dbus_dict_append_byte_array(
- &dict_iter, "BSSID",
- (const char *) wpa_s->current_ssid->bssid,
- ETH_ALEN))
- goto nomem;
- }
-
- if (!wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
- (const char *) cred->ssid,
- cred->ssid_len) ||
- !wpa_dbus_dict_append_string_array(&dict_iter, "AuthType",
- (const char **) auth_type,
- at_num) ||
- !wpa_dbus_dict_append_string_array(&dict_iter, "EncrType",
- (const char **) encr_type,
- et_num) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "Key",
- (const char *) cred->key,
- cred->key_len) ||
- !wpa_dbus_dict_append_uint32(&dict_iter, "KeyIndex",
- cred->key_idx) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto nomem;
-
- dbus_connection_send(iface->con, msg, NULL);
-
-nomem:
- dbus_message_unref(msg);
-}
-
-#endif /* CONFIG_WPS */
-
-void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
- int depth, const char *subject,
- const char *cert_hash,
- const struct wpabuf *cert)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- "Certification");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto nomem;
-
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "depth", depth) ||
- !wpa_dbus_dict_append_string(&dict_iter, "subject", subject))
- goto nomem;
-
- if (cert_hash &&
- !wpa_dbus_dict_append_string(&dict_iter, "cert_hash", cert_hash))
- goto nomem;
-
- if (cert &&
- !wpa_dbus_dict_append_byte_array(&dict_iter, "cert",
- wpabuf_head(cert),
- wpabuf_len(cert)))
- goto nomem;
-
- if (!wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto nomem;
-
- dbus_connection_send(iface->con, msg, NULL);
-
-nomem:
- dbus_message_unref(msg);
-}
-
-
-void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
- const char *status, const char *parameter)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- "EAP");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &status)
- ||
- !dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
- &parameter))
- goto nomem;
-
- dbus_connection_send(iface->con, msg, NULL);
-
-nomem:
- dbus_message_unref(msg);
-}
-
-
-#ifdef CONFIG_P2P
-
-/**
- * wpas_dbus_signal_p2p_group_removed - Signals P2P group was removed
- * @wpa_s: %wpa_supplicant network interface data
- * @role: role of this device (client or GO)
- * Sends signal with i/f name and role as string arguments
- */
-void wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
- const char *role)
-{
-
- DBusMessage *msg;
- DBusMessageIter iter;
- struct wpas_dbus_priv *iface = wpa_s->global->dbus;
- char *ifname = wpa_s->ifname;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "GroupFinished");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &ifname)) {
- wpa_printf(MSG_ERROR, "dbus: Failed to construct GroupFinished"
- "signal -not enough memory for ifname ");
- goto err;
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &role))
- wpa_printf(MSG_ERROR, "dbus: Failed to construct GroupFinished"
- "signal -not enough memory for role ");
- else
- dbus_connection_send(iface->con, msg, NULL);
-
-err:
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_p2p_provision_discovery - Signals various PD events
- *
- * @dev_addr - who sent the request or responded to our request.
- * @request - Will be 1 if request, 0 for response.
- * @status - valid only in case of response
- * @config_methods - wps config methods
- * @generated_pin - pin to be displayed in case of WPS_CONFIG_DISPLAY method
- *
- * Sends following provision discovery related events:
- * ProvisionDiscoveryRequestDisplayPin
- * ProvisionDiscoveryResponseDisplayPin
- * ProvisionDiscoveryRequestEnterPin
- * ProvisionDiscoveryResponseEnterPin
- * ProvisionDiscoveryPBCRequest
- * ProvisionDiscoveryPBCResponse
- *
- * TODO::
- * ProvisionDiscoveryFailure (timeout case)
- */
-void wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr, int request,
- enum p2p_prov_disc_status status,
- u16 config_methods,
- unsigned int generated_pin)
-{
- DBusMessage *msg;
- DBusMessageIter iter;
- struct wpas_dbus_priv *iface;
- char *_signal;
- int add_pin = 0;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
- int error_ret = 1;
- char pin[9], *p_pin = NULL;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- if (request || !status) {
- if (config_methods & WPS_CONFIG_DISPLAY)
- _signal = request ?
- "ProvisionDiscoveryRequestDisplayPin" :
- "ProvisionDiscoveryResponseEnterPin";
- else if (config_methods & WPS_CONFIG_KEYPAD)
- _signal = request ?
- "ProvisionDiscoveryRequestEnterPin" :
- "ProvisionDiscoveryResponseDisplayPin";
- else if (config_methods & WPS_CONFIG_PUSHBUTTON)
- _signal = request ? "ProvisionDiscoveryPBCRequest" :
- "ProvisionDiscoveryPBCResponse";
- else
- return; /* Unknown or un-supported method */
- } else if (!request && status)
- /* Explicit check for failure response */
- _signal = "ProvisionDiscoveryFailure";
-
- add_pin = ((request && (config_methods & WPS_CONFIG_DISPLAY)) ||
- (!request && !status &&
- (config_methods & WPS_CONFIG_KEYPAD)));
-
- if (add_pin) {
- os_snprintf(pin, sizeof(pin), "%08d", generated_pin);
- p_pin = pin;
- }
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE, _signal);
- if (msg == NULL)
- return;
-
- /* Check if this is a known peer */
- if (!p2p_peer_known(wpa_s->global->p2p, dev_addr))
- goto error;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
- COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(dev_addr));
-
- path = peer_obj_path;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter,
- DBUS_TYPE_OBJECT_PATH,
- &path))
- goto error;
-
- if (!request && status)
- /* Attach status to ProvisionDiscoveryFailure */
- error_ret = !dbus_message_iter_append_basic(&iter,
- DBUS_TYPE_INT32,
- &status);
- else
- error_ret = (add_pin &&
- !dbus_message_iter_append_basic(&iter,
- DBUS_TYPE_STRING,
- &p_pin));
-
-error:
- if (!error_ret)
- dbus_connection_send(iface->con, msg, NULL);
- else
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
-
- dbus_message_unref(msg);
-}
-
-
-void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
- const u8 *src, u16 dev_passwd_id)
-{
- DBusMessage *msg;
- DBusMessageIter iter;
- struct wpas_dbus_priv *iface;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(src));
- path = peer_obj_path;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "GONegotiationRequest");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path) ||
- !dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16,
- &dev_passwd_id))
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- else
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
-}
-
-
-static int wpas_dbus_get_group_obj_path(struct wpa_supplicant *wpa_s,
- const struct wpa_ssid *ssid,
- char *group_obj_path)
-{
- char group_name[3];
-
- if (os_memcmp(ssid->ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN))
- return -1;
-
- os_memcpy(group_name, ssid->ssid + P2P_WILDCARD_SSID_LEN, 2);
- group_name[2] = '\0';
-
- os_snprintf(group_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_GROUPS_PART "/%s",
- wpa_s->dbus_new_path, group_name);
-
- return 0;
-}
-
-
-/**
- * wpas_dbus_signal_p2p_group_started - Signals P2P group has
- * started. Emitted when a group is successfully started
- * irrespective of the role (client/GO) of the current device
- *
- * @wpa_s: %wpa_supplicant network interface data
- * @ssid: SSID object
- * @client: this device is P2P client
- * @network_id: network id of the group started, use instead of ssid->id
- * to account for persistent groups
- */
-void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
- const struct wpa_ssid *ssid,
- int client, int network_id)
-{
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char group_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
- iface = wpa_s->parent->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- if (wpas_dbus_get_group_obj_path(wpa_s, ssid, group_obj_path) < 0)
- return;
-
- /* New interface has been created for this group */
- msg = dbus_message_new_signal(wpa_s->parent->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "GroupStarted");
-
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto nomem;
-
- /*
- * In case the device supports creating a separate interface the
- * DBus client will need to know the object path for the interface
- * object this group was created on, so include it here.
- */
- if (!wpa_dbus_dict_append_object_path(&dict_iter,
- "interface_object",
- wpa_s->dbus_new_path))
- goto nomem;
-
- if (!wpa_dbus_dict_append_string(&dict_iter, "role",
- client ? "client" : "GO"))
- goto nomem;
-
- if (!wpa_dbus_dict_append_object_path(&dict_iter, "group_object",
- group_obj_path) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto nomem;
-
- dbus_connection_send(iface->con, msg, NULL);
-
-nomem:
- dbus_message_unref(msg);
-}
-
-
-/**
- *
- * Method to emit GONeogtiation Success or Failure signals based
- * on status.
- * @status: Status of the GO neg request. 0 for success, other for errors.
- */
-void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
- struct p2p_go_neg_results *res)
-{
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- DBusMessageIter iter_dict_entry, iter_dict_val, iter_dict_array;
- struct wpas_dbus_priv *iface;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
- dbus_int32_t freqs[P2P_MAX_CHANNELS];
- dbus_int32_t *f_array = freqs;
-
-
- iface = wpa_s->global->dbus;
-
- os_memset(freqs, 0, sizeof(freqs));
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(res->peer_device_addr));
- path = peer_obj_path;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- res->status ? "GONegotiationFailure" :
- "GONegotiationSuccess");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto err;
- if (!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object",
- path) ||
- !wpa_dbus_dict_append_int32(&dict_iter, "status", res->status))
- goto err;
-
- if (!res->status) {
- int i = 0;
- int freq_list_num = 0;
-
- if (res->role_go) {
- if (!wpa_dbus_dict_append_byte_array(
- &dict_iter, "passphrase",
- (const char *) res->passphrase,
- sizeof(res->passphrase)))
- goto err;
- }
-
- if (!wpa_dbus_dict_append_string(&dict_iter, "role_go",
- res->role_go ? "GO" :
- "client") ||
- !wpa_dbus_dict_append_int32(&dict_iter, "frequency",
- res->freq) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "ssid",
- (const char *) res->ssid,
- res->ssid_len) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter,
- "peer_device_addr",
- (const char *)
- res->peer_device_addr,
- ETH_ALEN) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter,
- "peer_interface_addr",
- (const char *)
- res->peer_interface_addr,
- ETH_ALEN) ||
- !wpa_dbus_dict_append_string(&dict_iter, "wps_method",
- p2p_wps_method_text(
- res->wps_method)))
- goto err;
-
- for (i = 0; i < P2P_MAX_CHANNELS; i++) {
- if (res->freq_list[i]) {
- freqs[i] = res->freq_list[i];
- freq_list_num++;
- }
- }
-
- if (!wpa_dbus_dict_begin_array(&dict_iter,
- "frequency_list",
- DBUS_TYPE_INT32_AS_STRING,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_dict_array))
- goto err;
-
- if (!dbus_message_iter_append_fixed_array(&iter_dict_array,
- DBUS_TYPE_INT32,
- &f_array,
- freq_list_num))
- goto err;
-
- if (!wpa_dbus_dict_end_array(&dict_iter,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_dict_array))
- goto err;
-
- if (!wpa_dbus_dict_append_int32(&dict_iter, "persistent_group",
- res->persistent_group) ||
- !wpa_dbus_dict_append_uint32(&dict_iter,
- "peer_config_timeout",
- res->peer_config_timeout))
- goto err;
- }
-
- if (!wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto err;
-
- dbus_connection_send(iface->con, msg, NULL);
-err:
- dbus_message_unref(msg);
-}
-
-
-/**
- *
- * Method to emit Invitation Result signal based on status and
- * bssid
- * @status: Status of the Invite request. 0 for success, other
- * for errors
- * @bssid : Basic Service Set Identifier
- */
-void wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s,
- int status, const u8 *bssid)
-{
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
-
- wpa_printf(MSG_INFO, "%s\n", __func__);
-
- iface = wpa_s->global->dbus;
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "InvitationResult");
-
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto nomem;
-
- if (!wpa_dbus_dict_append_int32(&dict_iter, "status", status))
- goto nomem;
- if (bssid) {
- if (!wpa_dbus_dict_append_byte_array(&dict_iter, "BSSID",
- (const char *) bssid,
- ETH_ALEN))
- goto nomem;
- }
- if (!wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto nomem;
-
- dbus_connection_send(iface->con, msg, NULL);
-
-nomem:
- dbus_message_unref(msg);
-}
-
-
-/**
- *
- * Method to emit a signal for a peer joining the group.
- * The signal will carry path to the group member object
- * constructed using p2p i/f addr used for connecting.
- *
- * @wpa_s: %wpa_supplicant network interface data
- * @member_addr: addr (p2p i/f) of the peer joining the group
- */
-void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
- const u8 *member)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
- char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- if (!wpa_s->dbus_groupobj_path)
- return;
-
- os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/"
- COMPACT_MACSTR,
- wpa_s->dbus_groupobj_path, MAC2STR(member));
-
- msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path,
- WPAS_DBUS_NEW_IFACE_P2P_GROUP,
- "PeerJoined");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- path = groupmember_obj_path;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path))
- goto err;
-
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- *
- * Method to emit a signal for a peer disconnecting the group.
- * The signal will carry path to the group member object
- * constructed using p2p i/f addr used for connecting.
- *
- * @wpa_s: %wpa_supplicant network interface data
- * @member_addr: addr (p2p i/f) of the peer joining the group
- */
-void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
- const u8 *member)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
- char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- if (!wpa_s->dbus_groupobj_path)
- return;
-
- os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/"
- COMPACT_MACSTR,
- wpa_s->dbus_groupobj_path, MAC2STR(member));
-
- msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path,
- WPAS_DBUS_NEW_IFACE_P2P_GROUP,
- "PeerDisconnected");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- path = groupmember_obj_path;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path))
- goto err;
-
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct PeerDisconnected "
- "signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- *
- * Method to emit a signal for a service discovery request.
- * The signal will carry station address, frequency, dialog token,
- * update indicator and it tlvs
- *
- * @wpa_s: %wpa_supplicant network interface data
- * @sa: station addr (p2p i/f) of the peer
- * @dialog_token: service discovery request dialog token
- * @update_indic: service discovery request update indicator
- * @tlvs: service discovery request genrated byte array of tlvs
- * @tlvs_len: service discovery request tlvs length
- */
-void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s,
- int freq, const u8 *sa, u8 dialog_token,
- u16 update_indic, const u8 *tlvs,
- size_t tlvs_len)
-{
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "ServiceDiscoveryRequest");
- if (msg == NULL)
- return;
-
- /* Check if this is a known peer */
- if (!p2p_peer_known(wpa_s->global->p2p, sa))
- goto error;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
- COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa));
-
- path = peer_obj_path;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto error;
-
-
- if (!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object",
- path) ||
- !wpa_dbus_dict_append_int32(&dict_iter, "frequency", freq) ||
- !wpa_dbus_dict_append_int32(&dict_iter, "dialog_token",
- dialog_token) ||
- !wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator",
- update_indic) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs",
- (const char *) tlvs,
- tlvs_len) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto error;
-
- dbus_connection_send(iface->con, msg, NULL);
- dbus_message_unref(msg);
- return;
-error:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- *
- * Method to emit a signal for a service discovery response.
- * The signal will carry station address, update indicator and it
- * tlvs
- *
- * @wpa_s: %wpa_supplicant network interface data
- * @sa: station addr (p2p i/f) of the peer
- * @update_indic: service discovery request update indicator
- * @tlvs: service discovery request genrated byte array of tlvs
- * @tlvs_len: service discovery request tlvs length
- */
-void wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
- const u8 *sa, u16 update_indic,
- const u8 *tlvs, size_t tlvs_len)
-{
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "ServiceDiscoveryResponse");
- if (msg == NULL)
- return;
-
- /* Check if this is a known peer */
- if (!p2p_peer_known(wpa_s->global->p2p, sa))
- goto error;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
- COMPACT_MACSTR, wpa_s->dbus_new_path, MAC2STR(sa));
-
- path = peer_obj_path;
-
- dbus_message_iter_init_append(msg, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto error;
-
- if (!wpa_dbus_dict_append_object_path(&dict_iter, "peer_object",
- path) ||
- !wpa_dbus_dict_append_uint16(&dict_iter, "update_indicator",
- update_indic) ||
- !wpa_dbus_dict_append_byte_array(&dict_iter, "tlvs",
- (const char *) tlvs,
- tlvs_len) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto error;
-
-
- dbus_connection_send(iface->con, msg, NULL);
- dbus_message_unref(msg);
- return;
-error:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-/**
- * wpas_dbus_signal_persistent_group - Send a persistent group related
- * event signal
- * @wpa_s: %wpa_supplicant network interface data
- * @id: new persistent group id
- * @sig_name: signal name - PersistentGroupAdded, PersistentGroupRemoved
- * @properties: determines if add second argument with object properties
- *
- * Notify listeners about an event related to persistent groups.
- */
-static void wpas_dbus_signal_persistent_group(struct wpa_supplicant *wpa_s,
- int id, const char *sig_name,
- int properties)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
- char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
- wpa_s->dbus_new_path, id);
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- sig_name);
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- path = pgrp_obj_path;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path))
- goto err;
-
- if (properties) {
- if (!wpa_dbus_get_object_properties(
- iface, pgrp_obj_path,
- WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, &iter))
- goto err;
- }
-
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_persistent_group_added - Send a persistent_group
- * added signal
- * @wpa_s: %wpa_supplicant network interface data
- * @id: new persistent group id
- *
- * Notify listeners about addition of a new persistent group.
- */
-static void wpas_dbus_signal_persistent_group_added(
- struct wpa_supplicant *wpa_s, int id)
-{
- wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupAdded",
- TRUE);
-}
-
-
-/**
- * wpas_dbus_signal_persistent_group_removed - Send a persistent_group
- * removed signal
- * @wpa_s: %wpa_supplicant network interface data
- * @id: persistent group id
- *
- * Notify listeners about removal of a persistent group.
- */
-static void wpas_dbus_signal_persistent_group_removed(
- struct wpa_supplicant *wpa_s, int id)
-{
- wpas_dbus_signal_persistent_group(wpa_s, id, "PersistentGroupRemoved",
- FALSE);
-}
-
-
-/**
- * wpas_dbus_signal_p2p_wps_failed - Signals WpsFailed event
- * @wpa_s: %wpa_supplicant network interface data
- *
- * Sends Event dbus signal with name "fail" and dictionary containing
- * "msg" field with fail message number (int32) as arguments
- */
-void wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
- struct wps_event_fail *fail)
-{
-
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *iface;
- char *key = "fail";
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "WpsFailed");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
- !wpa_dbus_dict_open_write(&iter, &dict_iter) ||
- !wpa_dbus_dict_append_int32(&dict_iter, "msg", fail->msg) ||
- !wpa_dbus_dict_append_int16(&dict_iter, "config_error",
- fail->config_error) ||
- !wpa_dbus_dict_close_write(&iter, &dict_iter))
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- else
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
-}
-
-#endif /*CONFIG_P2P*/
-
-
-/**
- * wpas_dbus_signal_prop_changed - Signals change of property
- * @wpa_s: %wpa_supplicant network interface data
- * @property: indicates which property has changed
- *
- * Sends PropertyChanged signals with path, interface and arguments
- * depending on which property has changed.
- */
-void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
- enum wpas_dbus_prop property)
-{
- char *prop;
- dbus_bool_t flush;
-
- if (wpa_s->dbus_new_path == NULL)
- return; /* Skip signal since D-Bus setup is not yet ready */
-
- flush = FALSE;
- switch (property) {
- case WPAS_DBUS_PROP_AP_SCAN:
- prop = "ApScan";
- break;
- case WPAS_DBUS_PROP_SCANNING:
- prop = "Scanning";
- break;
- case WPAS_DBUS_PROP_STATE:
- prop = "State";
- break;
- case WPAS_DBUS_PROP_CURRENT_BSS:
- prop = "CurrentBSS";
- break;
- case WPAS_DBUS_PROP_CURRENT_NETWORK:
- prop = "CurrentNetwork";
- break;
- case WPAS_DBUS_PROP_BSSS:
- prop = "BSSs";
- break;
- case WPAS_DBUS_PROP_CURRENT_AUTH_MODE:
- prop = "CurrentAuthMode";
- break;
- case WPAS_DBUS_PROP_DISCONNECT_REASON:
- prop = "DisconnectReason";
- flush = TRUE;
- break;
- default:
- wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
- __func__, property);
- return;
- }
-
- wpa_dbus_mark_property_changed(wpa_s->global->dbus,
- wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE, prop);
- if (flush) {
- wpa_dbus_flush_object_changed_properties(
- wpa_s->global->dbus->con, wpa_s->dbus_new_path);
- }
-}
-
-
-/**
- * wpas_dbus_bss_signal_prop_changed - Signals change of BSS property
- * @wpa_s: %wpa_supplicant network interface data
- * @property: indicates which property has changed
- * @id: unique BSS identifier
- *
- * Sends PropertyChanged signals with path, interface, and arguments depending
- * on which property has changed.
- */
-void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
- enum wpas_dbus_bss_prop property,
- unsigned int id)
-{
- char path[WPAS_DBUS_OBJECT_PATH_MAX];
- char *prop;
-
- switch (property) {
- case WPAS_DBUS_BSS_PROP_SIGNAL:
- prop = "Signal";
- break;
- case WPAS_DBUS_BSS_PROP_FREQ:
- prop = "Frequency";
- break;
- case WPAS_DBUS_BSS_PROP_MODE:
- prop = "Mode";
- break;
- case WPAS_DBUS_BSS_PROP_PRIVACY:
- prop = "Privacy";
- break;
- case WPAS_DBUS_BSS_PROP_RATES:
- prop = "Rates";
- break;
- case WPAS_DBUS_BSS_PROP_WPA:
- prop = "WPA";
- break;
- case WPAS_DBUS_BSS_PROP_RSN:
- prop = "RSN";
- break;
- case WPAS_DBUS_BSS_PROP_IES:
- prop = "IEs";
- break;
- default:
- wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
- __func__, property);
- return;
- }
-
- os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
- wpa_s->dbus_new_path, id);
-
- wpa_dbus_mark_property_changed(wpa_s->global->dbus, path,
- WPAS_DBUS_NEW_IFACE_BSS, prop);
-}
-
-
-/**
- * wpas_dbus_signal_debug_level_changed - Signals change of debug param
- * @global: wpa_global structure
- *
- * Sends PropertyChanged signals informing that debug level has changed.
- */
-void wpas_dbus_signal_debug_level_changed(struct wpa_global *global)
-{
- wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH,
- WPAS_DBUS_NEW_INTERFACE,
- "DebugLevel");
-}
-
-
-/**
- * wpas_dbus_signal_debug_timestamp_changed - Signals change of debug param
- * @global: wpa_global structure
- *
- * Sends PropertyChanged signals informing that debug timestamp has changed.
- */
-void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global)
-{
- wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH,
- WPAS_DBUS_NEW_INTERFACE,
- "DebugTimestamp");
-}
-
-
-/**
- * wpas_dbus_signal_debug_show_keys_changed - Signals change of debug param
- * @global: wpa_global structure
- *
- * Sends PropertyChanged signals informing that debug show_keys has changed.
- */
-void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global)
-{
- wpa_dbus_mark_property_changed(global->dbus, WPAS_DBUS_NEW_PATH,
- WPAS_DBUS_NEW_INTERFACE,
- "DebugShowKeys");
-}
-
-
-static void wpas_dbus_register(struct wpa_dbus_object_desc *obj_desc,
- void *priv,
- WPADBusArgumentFreeFunction priv_free,
- const struct wpa_dbus_method_desc *methods,
- const struct wpa_dbus_property_desc *properties,
- const struct wpa_dbus_signal_desc *signals)
-{
- int n;
-
- obj_desc->user_data = priv;
- obj_desc->user_data_free_func = priv_free;
- obj_desc->methods = methods;
- obj_desc->properties = properties;
- obj_desc->signals = signals;
-
- for (n = 0; properties && properties->dbus_property; properties++)
- n++;
-
- obj_desc->prop_changed_flags = os_zalloc(n);
- if (!obj_desc->prop_changed_flags)
- wpa_printf(MSG_DEBUG, "dbus: %s: can't register handlers",
- __func__);
-}
-
-
-static const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = {
- { "CreateInterface", WPAS_DBUS_NEW_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_create_interface,
- {
- { "args", "a{sv}", ARG_IN },
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "RemoveInterface", WPAS_DBUS_NEW_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_remove_interface,
- {
- { "path", "o", ARG_IN },
- END_ARGS
- }
- },
- { "GetInterface", WPAS_DBUS_NEW_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_get_interface,
- {
- { "ifname", "s", ARG_IN },
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
-#ifdef CONFIG_AUTOSCAN
- { "AutoScan", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_autoscan,
- {
- { "arg", "s", ARG_IN },
- END_ARGS
- }
- },
-#endif /* CONFIG_AUTOSCAN */
- { NULL, NULL, NULL, { END_ARGS } }
-};
-
-static const struct wpa_dbus_property_desc wpas_dbus_global_properties[] = {
- { "DebugLevel", WPAS_DBUS_NEW_INTERFACE, "s",
- wpas_dbus_getter_debug_level,
- wpas_dbus_setter_debug_level
- },
- { "DebugTimestamp", WPAS_DBUS_NEW_INTERFACE, "b",
- wpas_dbus_getter_debug_timestamp,
- wpas_dbus_setter_debug_timestamp
- },
- { "DebugShowKeys", WPAS_DBUS_NEW_INTERFACE, "b",
- wpas_dbus_getter_debug_show_keys,
- wpas_dbus_setter_debug_show_keys
- },
- { "Interfaces", WPAS_DBUS_NEW_INTERFACE, "ao",
- wpas_dbus_getter_interfaces,
- NULL
- },
- { "EapMethods", WPAS_DBUS_NEW_INTERFACE, "as",
- wpas_dbus_getter_eap_methods,
- NULL
- },
- { "Capabilities", WPAS_DBUS_NEW_INTERFACE, "as",
- wpas_dbus_getter_global_capabilities,
- NULL
- },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-static const struct wpa_dbus_signal_desc wpas_dbus_global_signals[] = {
- { "InterfaceAdded", WPAS_DBUS_NEW_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "InterfaceRemoved", WPAS_DBUS_NEW_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "NetworkRequest", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- { "field", "s", ARG_OUT },
- { "text", "s", ARG_OUT },
- END_ARGS
- }
- },
- /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
- { "PropertiesChanged", WPAS_DBUS_NEW_INTERFACE,
- {
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { NULL, NULL, { END_ARGS } }
-};
-
-
-/**
- * wpas_dbus_ctrl_iface_init - Initialize dbus control interface
- * @global: Pointer to global data from wpa_supplicant_init()
- * Returns: 0 on success or -1 on failure
- *
- * Initialize the dbus control interface for wpa_supplicantand and start
- * receiving commands from external programs over the bus.
- */
-int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv)
-{
- struct wpa_dbus_object_desc *obj_desc;
- int ret;
-
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create object description");
- return -1;
- }
-
- wpas_dbus_register(obj_desc, priv->global, NULL,
- wpas_dbus_global_methods,
- wpas_dbus_global_properties,
- wpas_dbus_global_signals);
-
- wpa_printf(MSG_DEBUG, "dbus: Register D-Bus object '%s'",
- WPAS_DBUS_NEW_PATH);
- ret = wpa_dbus_ctrl_iface_init(priv, WPAS_DBUS_NEW_PATH,
- WPAS_DBUS_NEW_SERVICE,
- obj_desc);
- if (ret < 0)
- free_dbus_object_desc(obj_desc);
- else
- priv->dbus_new_initialized = 1;
-
- return ret;
-}
-
-
-/**
- * wpas_dbus_ctrl_iface_deinit - Deinitialize dbus ctrl interface for
- * wpa_supplicant
- * @iface: Pointer to dbus private data from wpas_dbus_init()
- *
- * Deinitialize the dbus control interface that was initialized with
- * wpas_dbus_ctrl_iface_init().
- */
-void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface)
-{
- if (!iface->dbus_new_initialized)
- return;
- wpa_printf(MSG_DEBUG, "dbus: Unregister D-Bus object '%s'",
- WPAS_DBUS_NEW_PATH);
- dbus_connection_unregister_object_path(iface->con,
- WPAS_DBUS_NEW_PATH);
-}
-
-
-static void wpa_dbus_free(void *ptr)
-{
- os_free(ptr);
-}
-
-
-static const struct wpa_dbus_property_desc wpas_dbus_network_properties[] = {
- { "Properties", WPAS_DBUS_NEW_IFACE_NETWORK, "a{sv}",
- wpas_dbus_getter_network_properties,
- wpas_dbus_setter_network_properties
- },
- { "Enabled", WPAS_DBUS_NEW_IFACE_NETWORK, "b",
- wpas_dbus_getter_enabled,
- wpas_dbus_setter_enabled
- },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-
-static const struct wpa_dbus_signal_desc wpas_dbus_network_signals[] = {
- /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
- { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_NETWORK,
- {
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { NULL, NULL, { END_ARGS } }
-};
-
-
-/**
- * wpas_dbus_register_network - Register a configured network with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @ssid: network configuration data
- * Returns: 0 on success, -1 on failure
- *
- * Registers network representing object with dbus
- */
-int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- struct wpas_dbus_priv *ctrl_iface;
- struct wpa_dbus_object_desc *obj_desc;
- struct network_handler_args *arg;
- char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
-#ifdef CONFIG_P2P
- /*
- * If it is a persistent group register it as such.
- * This is to handle cases where an interface is being initialized
- * with a list of networks read from config.
- */
- if (network_is_persistent_group(ssid))
- return wpas_dbus_register_persistent_group(wpa_s, ssid);
-#endif /* CONFIG_P2P */
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
- wpa_s->dbus_new_path, ssid->id);
-
- wpa_printf(MSG_DEBUG, "dbus: Register network object '%s'",
- net_obj_path);
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create object description");
- goto err;
- }
-
- /* allocate memory for handlers arguments */
- arg = os_zalloc(sizeof(struct network_handler_args));
- if (!arg) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create arguments for method");
- goto err;
- }
-
- arg->wpa_s = wpa_s;
- arg->ssid = ssid;
-
- wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
- wpas_dbus_network_properties,
- wpas_dbus_network_signals);
-
- if (wpa_dbus_register_object_per_iface(ctrl_iface, net_obj_path,
- wpa_s->ifname, obj_desc))
- goto err;
-
- wpas_dbus_signal_network_added(wpa_s, ssid->id);
-
- return 0;
-
-err:
- free_dbus_object_desc(obj_desc);
- return -1;
-}
-
-
-/**
- * wpas_dbus_unregister_network - Unregister a configured network from dbus
- * @wpa_s: wpa_supplicant interface structure
- * @nid: network id
- * Returns: 0 on success, -1 on failure
- *
- * Unregisters network representing object from dbus
- */
-int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid)
-{
- struct wpas_dbus_priv *ctrl_iface;
- char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
- int ret;
-#ifdef CONFIG_P2P
- struct wpa_ssid *ssid;
-
- ssid = wpa_config_get_network(wpa_s->conf, nid);
-
- /* If it is a persistent group unregister it as such */
- if (ssid && network_is_persistent_group(ssid))
- return wpas_dbus_unregister_persistent_group(wpa_s, nid);
-#endif /* CONFIG_P2P */
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s->global == NULL || wpa_s->dbus_new_path == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
- wpa_s->dbus_new_path, nid);
-
- wpa_printf(MSG_DEBUG, "dbus: Unregister network object '%s'",
- net_obj_path);
- ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, net_obj_path);
-
- if (!ret)
- wpas_dbus_signal_network_removed(wpa_s, nid);
-
- return ret;
-}
-
-
-static const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = {
- { "SSID", WPAS_DBUS_NEW_IFACE_BSS, "ay",
- wpas_dbus_getter_bss_ssid,
- NULL
- },
- { "BSSID", WPAS_DBUS_NEW_IFACE_BSS, "ay",
- wpas_dbus_getter_bss_bssid,
- NULL
- },
- { "Privacy", WPAS_DBUS_NEW_IFACE_BSS, "b",
- wpas_dbus_getter_bss_privacy,
- NULL
- },
- { "Mode", WPAS_DBUS_NEW_IFACE_BSS, "s",
- wpas_dbus_getter_bss_mode,
- NULL
- },
- { "Signal", WPAS_DBUS_NEW_IFACE_BSS, "n",
- wpas_dbus_getter_bss_signal,
- NULL
- },
- { "Frequency", WPAS_DBUS_NEW_IFACE_BSS, "q",
- wpas_dbus_getter_bss_frequency,
- NULL
- },
- { "Rates", WPAS_DBUS_NEW_IFACE_BSS, "au",
- wpas_dbus_getter_bss_rates,
- NULL
- },
- { "WPA", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
- wpas_dbus_getter_bss_wpa,
- NULL
- },
- { "RSN", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
- wpas_dbus_getter_bss_rsn,
- NULL
- },
- { "WPS", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
- wpas_dbus_getter_bss_wps,
- NULL
- },
- { "IEs", WPAS_DBUS_NEW_IFACE_BSS, "ay",
- wpas_dbus_getter_bss_ies,
- NULL
- },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-
-static const struct wpa_dbus_signal_desc wpas_dbus_bss_signals[] = {
- /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
- { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_BSS,
- {
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { NULL, NULL, { END_ARGS } }
-};
-
-
-/**
- * wpas_dbus_unregister_bss - Unregister a scanned BSS from dbus
- * @wpa_s: wpa_supplicant interface structure
- * @bssid: scanned network bssid
- * @id: unique BSS identifier
- * Returns: 0 on success, -1 on failure
- *
- * Unregisters BSS representing object from dbus
- */
-int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
- u8 bssid[ETH_ALEN], unsigned int id)
-{
- struct wpas_dbus_priv *ctrl_iface;
- char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
- wpa_s->dbus_new_path, id);
-
- wpa_printf(MSG_DEBUG, "dbus: Unregister BSS object '%s'",
- bss_obj_path);
- if (wpa_dbus_unregister_object_per_iface(ctrl_iface, bss_obj_path)) {
- wpa_printf(MSG_ERROR, "dbus: Cannot unregister BSS object %s",
- bss_obj_path);
- return -1;
- }
-
- wpas_dbus_signal_bss_removed(wpa_s, bss_obj_path);
- wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS);
-
- return 0;
-}
-
-
-/**
- * wpas_dbus_register_bss - Register a scanned BSS with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @bssid: scanned network bssid
- * @id: unique BSS identifier
- * Returns: 0 on success, -1 on failure
- *
- * Registers BSS representing object with dbus
- */
-int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
- u8 bssid[ETH_ALEN], unsigned int id)
-{
- struct wpas_dbus_priv *ctrl_iface;
- struct wpa_dbus_object_desc *obj_desc;
- char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
- struct bss_handler_args *arg;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
- wpa_s->dbus_new_path, id);
-
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create object description");
- goto err;
- }
-
- arg = os_zalloc(sizeof(struct bss_handler_args));
- if (!arg) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create arguments for handler");
- goto err;
- }
- arg->wpa_s = wpa_s;
- arg->id = id;
-
- wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
- wpas_dbus_bss_properties,
- wpas_dbus_bss_signals);
-
- wpa_printf(MSG_DEBUG, "dbus: Register BSS object '%s'",
- bss_obj_path);
- if (wpa_dbus_register_object_per_iface(ctrl_iface, bss_obj_path,
- wpa_s->ifname, obj_desc)) {
- wpa_printf(MSG_ERROR,
- "Cannot register BSSID dbus object %s.",
- bss_obj_path);
- goto err;
- }
-
- wpas_dbus_signal_bss_added(wpa_s, bss_obj_path);
- wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSSS);
-
- return 0;
-
-err:
- free_dbus_object_desc(obj_desc);
- return -1;
-}
-
-
-static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
- { "Scan", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_scan,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "Disconnect", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_disconnect,
- {
- END_ARGS
- }
- },
- { "AddNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_add_network,
- {
- { "args", "a{sv}", ARG_IN },
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "Reassociate", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_reassociate,
- {
- END_ARGS
- }
- },
- { "RemoveNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_remove_network,
- {
- { "path", "o", ARG_IN },
- END_ARGS
- }
- },
- { "RemoveAllNetworks", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_remove_all_networks,
- {
- END_ARGS
- }
- },
- { "SelectNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_select_network,
- {
- { "path", "o", ARG_IN },
- END_ARGS
- }
- },
- { "NetworkReply", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_network_reply,
- {
- { "path", "o", ARG_IN },
- { "field", "s", ARG_IN },
- { "value", "s", ARG_IN },
- END_ARGS
- }
- },
- { "AddBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_add_blob,
- {
- { "name", "s", ARG_IN },
- { "data", "ay", ARG_IN },
- END_ARGS
- }
- },
- { "GetBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_get_blob,
- {
- { "name", "s", ARG_IN },
- { "data", "ay", ARG_OUT },
- END_ARGS
- }
- },
- { "RemoveBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_remove_blob,
- {
- { "name", "s", ARG_IN },
- END_ARGS
- }
- },
-#ifdef CONFIG_WPS
- { "Start", WPAS_DBUS_NEW_IFACE_WPS,
- (WPADBusMethodHandler) &wpas_dbus_handler_wps_start,
- {
- { "args", "a{sv}", ARG_IN },
- { "output", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
-#endif /* CONFIG_WPS */
-#ifdef CONFIG_P2P
- { "Find", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_find,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "StopFind", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_stop_find,
- {
- END_ARGS
- }
- },
- { "Listen", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_listen,
- {
- { "timeout", "i", ARG_IN },
- END_ARGS
- }
- },
- { "ExtendedListen", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_extendedlisten,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "PresenceRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_presence_request,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_prov_disc_req,
- {
- { "peer", "o", ARG_IN },
- { "config_method", "s", ARG_IN },
- END_ARGS
- }
- },
- { "Connect", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_connect,
- {
- { "args", "a{sv}", ARG_IN },
- { "generated_pin", "s", ARG_OUT },
- END_ARGS
- }
- },
- { "GroupAdd", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_group_add,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "Invite", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_invite,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "Disconnect", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_disconnect,
- {
- END_ARGS
- }
- },
- { "RejectPeer", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_rejectpeer,
- {
- { "peer", "o", ARG_IN },
- END_ARGS
- }
- },
- { "Flush", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_flush,
- {
- END_ARGS
- }
- },
- { "AddService", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_add_service,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "DeleteService", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_delete_service,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "FlushService", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_flush_service,
- {
- END_ARGS
- }
- },
- { "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_sd_req,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_sd_res,
- {
- { "args", "a{sv}", ARG_IN },
- END_ARGS
- }
- },
- { "ServiceDiscoveryCancelRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_sd_cancel_req,
- {
- { "args", "t", ARG_IN },
- END_ARGS
- }
- },
- { "ServiceUpdate", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_service_update,
- {
- END_ARGS
- }
- },
- { "ServiceDiscoveryExternal", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_serv_disc_external,
- {
- { "arg", "i", ARG_IN },
- END_ARGS
- }
- },
- { "ServiceDiscoveryExternal", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)wpas_dbus_handler_p2p_serv_disc_external,
- {
- { "arg", "i", ARG_IN },
- END_ARGS
- }
- },
- { "AddPersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler) wpas_dbus_handler_add_persistent_group,
- {
- { "args", "a{sv}", ARG_IN },
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "RemovePersistentGroup", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler) wpas_dbus_handler_remove_persistent_group,
- {
- { "path", "o", ARG_IN },
- END_ARGS
- }
- },
- { "RemoveAllPersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- (WPADBusMethodHandler)
- wpas_dbus_handler_remove_all_persistent_groups,
- {
- END_ARGS
- }
- },
-#endif /* CONFIG_P2P */
- { "FlushBSS", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) &wpas_dbus_handler_flush_bss,
- {
- { "age", "u", ARG_IN },
- END_ARGS
- }
- },
-#ifdef CONFIG_AP
- { "SubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) wpas_dbus_handler_subscribe_preq,
- {
- END_ARGS
- }
- },
- { "UnsubscribeProbeReq", WPAS_DBUS_NEW_IFACE_INTERFACE,
- (WPADBusMethodHandler) wpas_dbus_handler_unsubscribe_preq,
- {
- END_ARGS
- }
- },
-#endif /* CONFIG_AP */
- { NULL, NULL, NULL, { END_ARGS } }
-};
-
-static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
- { "Capabilities", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{sv}",
- wpas_dbus_getter_capabilities,
- NULL
- },
- { "State", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
- wpas_dbus_getter_state,
- NULL
- },
- { "Scanning", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
- wpas_dbus_getter_scanning,
- NULL
- },
- { "ApScan", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
- wpas_dbus_getter_ap_scan,
- wpas_dbus_setter_ap_scan
- },
- { "BSSExpireAge", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
- wpas_dbus_getter_bss_expire_age,
- wpas_dbus_setter_bss_expire_age
- },
- { "BSSExpireCount", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
- wpas_dbus_getter_bss_expire_count,
- wpas_dbus_setter_bss_expire_count
- },
- { "Country", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
- wpas_dbus_getter_country,
- wpas_dbus_setter_country
- },
- { "Ifname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
- wpas_dbus_getter_ifname,
- NULL
- },
- { "Driver", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
- wpas_dbus_getter_driver,
- NULL
- },
- { "BridgeIfname", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
- wpas_dbus_getter_bridge_ifname,
- NULL
- },
- { "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
- wpas_dbus_getter_current_bss,
- NULL
- },
- { "CurrentNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
- wpas_dbus_getter_current_network,
- NULL
- },
- { "CurrentAuthMode", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
- wpas_dbus_getter_current_auth_mode,
- NULL
- },
- { "Blobs", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{say}",
- wpas_dbus_getter_blobs,
- NULL
- },
- { "BSSs", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao",
- wpas_dbus_getter_bsss,
- NULL
- },
- { "Networks", WPAS_DBUS_NEW_IFACE_INTERFACE, "ao",
- wpas_dbus_getter_networks,
- NULL
- },
- { "FastReauth", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
- wpas_dbus_getter_fast_reauth,
- wpas_dbus_setter_fast_reauth
- },
- { "ScanInterval", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
- wpas_dbus_getter_scan_interval,
- wpas_dbus_setter_scan_interval
- },
-#ifdef CONFIG_WPS
- { "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b",
- wpas_dbus_getter_process_credentials,
- wpas_dbus_setter_process_credentials
- },
-#endif /* CONFIG_WPS */
-#ifdef CONFIG_P2P
- { "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
- wpas_dbus_getter_p2p_device_config,
- wpas_dbus_setter_p2p_device_config
- },
- { "Peers", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao",
- wpas_dbus_getter_p2p_peers,
- NULL
- },
- { "Role", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "s",
- wpas_dbus_getter_p2p_role,
- NULL
- },
- { "Group", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o",
- wpas_dbus_getter_p2p_group,
- NULL
- },
- { "PeerGO", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "o",
- wpas_dbus_getter_p2p_peergo,
- NULL
- },
- { "PersistentGroups", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "ao",
- wpas_dbus_getter_persistent_groups,
- NULL
- },
-#endif /* CONFIG_P2P */
- { "DisconnectReason", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
- wpas_dbus_getter_disconnect_reason,
- NULL
- },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
- { "ScanDone", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "success", "b", ARG_OUT },
- END_ARGS
- }
- },
- { "BSSAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "BSSRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "BlobAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "name", "s", ARG_OUT },
- END_ARGS
- }
- },
- { "BlobRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "name", "s", ARG_OUT },
- END_ARGS
- }
- },
- { "NetworkAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "NetworkRemoved", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "NetworkSelected", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
- { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
-#ifdef CONFIG_WPS
- { "Event", WPAS_DBUS_NEW_IFACE_WPS,
- {
- { "name", "s", ARG_OUT },
- { "args", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "Credentials", WPAS_DBUS_NEW_IFACE_WPS,
- {
- { "credentials", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- /* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
- { "PropertiesChanged", WPAS_DBUS_NEW_IFACE_WPS,
- {
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
-#endif /* CONFIG_WPS */
-#ifdef CONFIG_P2P
- { "P2PStateChanged", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "states", "a{ss}", ARG_OUT },
- END_ARGS
- }
- },
- { "DeviceFound", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "path", "o", ARG_OUT },
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "DeviceLost", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryRequestDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "peer_object", "o", ARG_OUT },
- { "pin", "s", ARG_OUT },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryResponseDisplayPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "peer_object", "o", ARG_OUT },
- { "pin", "s", ARG_OUT },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryRequestEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "peer_object", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryResponseEnterPin", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "peer_object", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryPBCRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "peer_object", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryPBCResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "peer_object", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "ProvisionDiscoveryFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "peer_object", "o", ARG_OUT },
- { "status", "i", ARG_OUT },
- END_ARGS
- }
- },
- { "GroupStarted", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "GONegotiationSuccess", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- END_ARGS
- }
- },
- { "GONegotiationFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "status", "i", ARG_OUT },
- END_ARGS
- }
- },
- { "GONegotiationRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "path", "o", ARG_OUT },
- { "dev_passwd_id", "i", ARG_OUT },
- END_ARGS
- }
- },
- { "InvitationResult", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "invite_result", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "GroupFinished", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "ifname", "s", ARG_OUT },
- { "role", "s", ARG_OUT },
- END_ARGS
- }
- },
- { "ServiceDiscoveryRequest", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "sd_request", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "ServiceDiscoveryResponse", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "sd_response", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "PersistentGroupAdded", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "path", "o", ARG_OUT },
- { "properties", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "PersistentGroupRemoved", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "path", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "WpsFailed", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- {
- { "name", "s", ARG_OUT },
- { "args", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
-#endif /* CONFIG_P2P */
-#ifdef CONFIG_AP
- { "ProbeRequest", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "args", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
-#endif /* CONFIG_AP */
- { "Certification", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "certification", "a{sv}", ARG_OUT },
- END_ARGS
- }
- },
- { "EAP", WPAS_DBUS_NEW_IFACE_INTERFACE,
- {
- { "status", "s", ARG_OUT },
- { "parameter", "s", ARG_OUT },
- END_ARGS
- }
- },
- { NULL, NULL, { END_ARGS } }
-};
-
-
-int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
-{
-
- struct wpa_dbus_object_desc *obj_desc = NULL;
- struct wpas_dbus_priv *ctrl_iface = wpa_s->global->dbus;
- int next;
-
- /* Do nothing if the control interface is not turned on */
- if (ctrl_iface == NULL)
- return 0;
-
- /* Create and set the interface's object path */
- wpa_s->dbus_new_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- if (wpa_s->dbus_new_path == NULL)
- return -1;
- next = ctrl_iface->next_objid++;
- os_snprintf(wpa_s->dbus_new_path, WPAS_DBUS_OBJECT_PATH_MAX,
- WPAS_DBUS_NEW_PATH_INTERFACES "/%u",
- next);
-
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create object description");
- goto err;
- }
-
- wpas_dbus_register(obj_desc, wpa_s, NULL, wpas_dbus_interface_methods,
- wpas_dbus_interface_properties,
- wpas_dbus_interface_signals);
-
- wpa_printf(MSG_DEBUG, "dbus: Register interface object '%s'",
- wpa_s->dbus_new_path);
- if (wpa_dbus_register_object_per_iface(ctrl_iface,
- wpa_s->dbus_new_path,
- wpa_s->ifname, obj_desc))
- goto err;
-
- wpas_dbus_signal_interface_added(wpa_s);
-
- return 0;
-
-err:
- os_free(wpa_s->dbus_new_path);
- wpa_s->dbus_new_path = NULL;
- free_dbus_object_desc(obj_desc);
- return -1;
-}
-
-
-int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
-{
- struct wpas_dbus_priv *ctrl_iface;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- wpa_printf(MSG_DEBUG, "dbus: Unregister interface object '%s'",
- wpa_s->dbus_new_path);
-
-#ifdef CONFIG_AP
- if (wpa_s->preq_notify_peer) {
- wpas_dbus_unsubscribe_noc(ctrl_iface);
- os_free(wpa_s->preq_notify_peer);
- wpa_s->preq_notify_peer = NULL;
- }
-#endif /* CONFIG_AP */
-
- if (wpa_dbus_unregister_object_per_iface(ctrl_iface,
- wpa_s->dbus_new_path))
- return -1;
-
- wpas_dbus_signal_interface_removed(wpa_s);
-
- os_free(wpa_s->dbus_new_path);
- wpa_s->dbus_new_path = NULL;
-
- return 0;
-}
-
-#ifdef CONFIG_P2P
-
-static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
- { "DeviceName", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
- wpas_dbus_getter_p2p_peer_device_name,
- NULL
- },
- { "PrimaryDeviceType", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
- wpas_dbus_getter_p2p_peer_primary_device_type,
- NULL
- },
- { "config_method", WPAS_DBUS_NEW_IFACE_P2P_PEER, "q",
- wpas_dbus_getter_p2p_peer_config_method,
- NULL
- },
- { "level", WPAS_DBUS_NEW_IFACE_P2P_PEER, "i",
- wpas_dbus_getter_p2p_peer_level,
- NULL
- },
- { "devicecapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y",
- wpas_dbus_getter_p2p_peer_device_capability,
- NULL
- },
- { "groupcapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y",
- wpas_dbus_getter_p2p_peer_group_capability,
- NULL
- },
- { "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay",
- wpas_dbus_getter_p2p_peer_secondary_device_types,
- NULL
- },
- { "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay",
- wpas_dbus_getter_p2p_peer_vendor_extension,
- NULL
- },
- { "IEs", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
- wpas_dbus_getter_p2p_peer_ies,
- NULL
- },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-static const struct wpa_dbus_signal_desc wpas_dbus_p2p_peer_signals[] = {
-
- { NULL, NULL, { END_ARGS } }
-};
-
-/**
- * wpas_dbus_signal_peer - Send a peer related event signal
- * @wpa_s: %wpa_supplicant network interface data
- * @dev: peer device object
- * @interface: name of the interface emitting this signal.
- * In case of peer objects, it would be emitted by either
- * the "interface object" or by "peer objects"
- * @sig_name: signal name - DeviceFound
- *
- * Notify listeners about event related with newly found p2p peer device
- */
-static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr, const char *interface,
- const char *sig_name)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *msg;
- DBusMessageIter iter;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
-
- iface = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(dev_addr));
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path, interface,
- sig_name);
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &iter);
- path = peer_obj_path;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
- &path))
- goto err;
-
- dbus_connection_send(iface->con, msg, NULL);
-
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
- dbus_message_unref(msg);
-}
-
-
-/**
- * wpas_dbus_signal_peer_found - Send a peer found signal
- * @wpa_s: %wpa_supplicant network interface data
- * @dev: peer device object
- *
- * Notify listeners about find a p2p peer device found
- */
-void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr)
-{
- wpas_dbus_signal_peer(wpa_s, dev_addr,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "DeviceFound");
-}
-
-/**
- * wpas_dbus_signal_peer_lost - Send a peer lost signal
- * @wpa_s: %wpa_supplicant network interface data
- * @dev: peer device object
- *
- * Notify listeners about lost a p2p peer device
- */
-void wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr)
-{
- wpas_dbus_signal_peer(wpa_s, dev_addr,
- WPAS_DBUS_NEW_IFACE_P2PDEVICE,
- "DeviceLost");
-}
-
-/**
- * wpas_dbus_register_peer - Register a discovered peer object with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @ssid: network configuration data
- * Returns: 0 on success, -1 on failure
- *
- * Registers network representing object with dbus
- */
-int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr)
-{
- struct wpas_dbus_priv *ctrl_iface;
- struct wpa_dbus_object_desc *obj_desc;
- struct peer_handler_args *arg;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return 0;
-
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(dev_addr));
-
- wpa_printf(MSG_INFO, "dbus: Register peer object '%s'",
- peer_obj_path);
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create object description");
- goto err;
- }
-
- /* allocate memory for handlers arguments */
- arg = os_zalloc(sizeof(struct peer_handler_args));
- if (!arg) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create arguments for method");
- goto err;
- }
-
- arg->wpa_s = wpa_s;
- os_memcpy(arg->p2p_device_addr, dev_addr, ETH_ALEN);
-
- wpas_dbus_register(obj_desc, arg, wpa_dbus_free,
- NULL,
- wpas_dbus_p2p_peer_properties,
- wpas_dbus_p2p_peer_signals);
-
- if (wpa_dbus_register_object_per_iface(ctrl_iface, peer_obj_path,
- wpa_s->ifname, obj_desc))
- goto err;
-
- return 0;
-
-err:
- free_dbus_object_desc(obj_desc);
- return -1;
-}
-
-/**
- * wpas_dbus_unregister_peer - Unregister a peer object with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @dev_addr: p2p device addr
- * Returns: 0 on success, -1 on failure
- *
- * Registers network representing object with dbus
- */
-int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr)
-{
- struct wpas_dbus_priv *ctrl_iface;
- char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
- int ret;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL ||
- wpa_s->dbus_new_path == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(dev_addr));
-
- wpa_printf(MSG_INFO, "dbus: Unregister peer object '%s'",
- peer_obj_path);
- ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, peer_obj_path);
-
- return ret;
-}
-
-
-static const struct wpa_dbus_property_desc wpas_dbus_p2p_group_properties[] = {
- { "Members", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ao",
- wpas_dbus_getter_p2p_group_members,
- NULL
- },
- { "Group", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "o",
- wpas_dbus_getter_p2p_group,
- NULL
- },
- { "Role", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s",
- wpas_dbus_getter_p2p_role,
- NULL
- },
- { "SSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
- wpas_dbus_getter_p2p_group_ssid,
- NULL
- },
- { "BSSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
- wpas_dbus_getter_p2p_group_bssid,
- NULL
- },
- { "Frequency", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "q",
- wpas_dbus_getter_p2p_group_frequency,
- NULL
- },
- { "Passphrase", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s",
- wpas_dbus_getter_p2p_group_passphrase,
- NULL
- },
- { "PSK", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
- wpas_dbus_getter_p2p_group_psk,
- NULL
- },
- { "WPSVendorExtensions", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "aay",
- wpas_dbus_getter_p2p_group_vendor_ext,
- wpas_dbus_setter_p2p_group_vendor_ext
- },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-static const struct wpa_dbus_signal_desc wpas_dbus_p2p_group_signals[] = {
- { "PeerJoined", WPAS_DBUS_NEW_IFACE_P2P_GROUP,
- {
- { "peer", "o", ARG_OUT },
- END_ARGS
- }
- },
- { "PeerDisconnected", WPAS_DBUS_NEW_IFACE_P2P_GROUP,
- {
- { "peer", "o", ARG_OUT },
- END_ARGS
- }
- },
- { NULL, NULL, { END_ARGS } }
-};
-
-/**
- * wpas_dbus_register_p2p_group - Register a p2p group object with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @ssid: SSID struct
- * Returns: 0 on success, -1 on failure
- *
- * Registers p2p group representing object with dbus
- */
-void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- struct wpas_dbus_priv *ctrl_iface;
- struct wpa_dbus_object_desc *obj_desc;
- char group_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return;
-
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return;
-
- if (wpa_s->dbus_groupobj_path) {
- wpa_printf(MSG_INFO, "%s: Group object '%s' already exists",
- __func__, wpa_s->dbus_groupobj_path);
- return;
- }
-
- if (wpas_dbus_get_group_obj_path(wpa_s, ssid, group_obj_path) < 0)
- return;
-
- wpa_s->dbus_groupobj_path = os_strdup(group_obj_path);
- if (wpa_s->dbus_groupobj_path == NULL)
- return;
-
- wpa_printf(MSG_INFO, "dbus: Register group object '%s'",
- group_obj_path);
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create object description");
- goto err;
- }
-
- wpas_dbus_register(obj_desc, wpa_s, NULL, NULL,
- wpas_dbus_p2p_group_properties,
- wpas_dbus_p2p_group_signals);
-
- if (wpa_dbus_register_object_per_iface(ctrl_iface, group_obj_path,
- wpa_s->ifname, obj_desc))
- goto err;
-
- return;
-
-err:
- if (wpa_s->dbus_groupobj_path) {
- os_free(wpa_s->dbus_groupobj_path);
- wpa_s->dbus_groupobj_path = NULL;
- }
-
- free_dbus_object_desc(obj_desc);
-}
-
-/**
- * wpas_dbus_unregister_p2p_group - Unregister a p2p group object from dbus
- * @wpa_s: wpa_supplicant interface structure
- * @ssid: network name of the p2p group started
- */
-void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
- const struct wpa_ssid *ssid)
-{
- struct wpas_dbus_priv *ctrl_iface;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return;
-
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return;
-
- if (!wpa_s->dbus_groupobj_path) {
- wpa_printf(MSG_DEBUG,
- "%s: Group object '%s' already unregistered",
- __func__, wpa_s->dbus_groupobj_path);
- return;
- }
-
- wpa_printf(MSG_DEBUG, "dbus: Unregister group object '%s'",
- wpa_s->dbus_groupobj_path);
-
- wpa_dbus_unregister_object_per_iface(ctrl_iface,
- wpa_s->dbus_groupobj_path);
-
- os_free(wpa_s->dbus_groupobj_path);
- wpa_s->dbus_groupobj_path = NULL;
-}
-
-static const struct wpa_dbus_property_desc
-wpas_dbus_p2p_groupmember_properties[] = {
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-/**
- * wpas_dbus_register_p2p_groupmember - Register a p2p groupmember
- * object with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @p2p_if_addr: i/f addr of the device joining this group
- *
- * Registers p2p groupmember representing object with dbus
- */
-void wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s,
- const u8 *p2p_if_addr)
-{
- struct wpas_dbus_priv *ctrl_iface;
- struct wpa_dbus_object_desc *obj_desc = NULL;
- struct groupmember_handler_args *arg;
- char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return;
-
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return;
-
- if (!wpa_s->dbus_groupobj_path)
- return;
-
- os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/" COMPACT_MACSTR,
- wpa_s->dbus_groupobj_path, MAC2STR(p2p_if_addr));
-
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create object description");
- goto err;
- }
-
- /* allocate memory for handlers arguments */
- arg = os_zalloc(sizeof(struct groupmember_handler_args));
- if (!arg) {
- wpa_printf(MSG_ERROR, "Not enough memory "
- "to create arguments for method");
- goto err;
- }
-
- arg->wpa_s = wpa_s;
- os_memcpy(arg->member_addr, p2p_if_addr, ETH_ALEN);
-
- wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
- wpas_dbus_p2p_groupmember_properties, NULL);
-
- if (wpa_dbus_register_object_per_iface(ctrl_iface, groupmember_obj_path,
- wpa_s->ifname, obj_desc))
- goto err;
-
- wpa_printf(MSG_INFO,
- "dbus: Registered group member object '%s' successfully",
- groupmember_obj_path);
- return;
-
-err:
- free_dbus_object_desc(obj_desc);
-}
-
-/**
- * wpas_dbus_unregister_p2p_groupmember - Unregister a p2p groupmember
- * object with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @p2p_if_addr: i/f addr of the device joining this group
- *
- * Unregisters p2p groupmember representing object with dbus
- */
-void wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
- const u8 *p2p_if_addr)
-{
- struct wpas_dbus_priv *ctrl_iface;
- char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return;
-
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return;
-
- if (!wpa_s->dbus_groupobj_path)
- return;
-
- os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/" COMPACT_MACSTR,
- wpa_s->dbus_groupobj_path, MAC2STR(p2p_if_addr));
-
- wpa_dbus_unregister_object_per_iface(ctrl_iface, groupmember_obj_path);
-}
-
-
-static const struct wpa_dbus_property_desc
- wpas_dbus_persistent_group_properties[] = {
- { "Properties", WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, "a{sv}",
- wpas_dbus_getter_persistent_group_properties,
- wpas_dbus_setter_persistent_group_properties
- },
- { NULL, NULL, NULL, NULL, NULL }
-};
-
-/* No signals intended for persistent group objects */
-
-/**
- * wpas_dbus_register_persistent_group - Register a configured(saved)
- * persistent group with dbus
- * @wpa_s: wpa_supplicant interface structure
- * @ssid: persistent group (still represented as a network within wpa)
- * configuration data
- * Returns: 0 on success, -1 on failure
- *
- * Registers a persistent group representing object with dbus.
- */
-int wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- struct wpas_dbus_priv *ctrl_iface;
- struct wpa_dbus_object_desc *obj_desc;
- struct network_handler_args *arg;
- char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return 0;
-
- /* Make sure ssid is a persistent group */
- if (ssid->disabled != 2 && !ssid->p2p_persistent_group)
- return -1; /* should we return w/o complaining? */
-
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- /*
- * Intentionally not coming up with different numbering scheme
- * for persistent groups.
- */
- os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
- wpa_s->dbus_new_path, ssid->id);
-
- wpa_printf(MSG_DEBUG, "dbus: Register persistent group object '%s'",
- pgrp_obj_path);
- obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "dbus: Not enough memory to create "
- "object description");
- goto err;
- }
-
- /*
- * Reusing the same context structure as that for networks
- * since these are represented using same data structure.
- */
- /* allocate memory for handlers arguments */
- arg = os_zalloc(sizeof(struct network_handler_args));
- if (!arg) {
- wpa_printf(MSG_ERROR, "dbus: Not enough memory to create "
- "arguments for method");
- goto err;
- }
-
- arg->wpa_s = wpa_s;
- arg->ssid = ssid;
-
- wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL,
- wpas_dbus_persistent_group_properties,
- NULL);
-
- if (wpa_dbus_register_object_per_iface(ctrl_iface, pgrp_obj_path,
- wpa_s->ifname, obj_desc))
- goto err;
-
- wpas_dbus_signal_persistent_group_added(wpa_s, ssid->id);
-
- return 0;
-
-err:
- free_dbus_object_desc(obj_desc);
- return -1;
-}
-
-
-/**
- * wpas_dbus_unregister_persistent_group - Unregister a persistent_group
- * from dbus
- * @wpa_s: wpa_supplicant interface structure
- * @nid: network id
- * Returns: 0 on success, -1 on failure
- *
- * Unregisters persistent group representing object from dbus
- *
- * NOTE: There is a slight issue with the semantics here. While the
- * implementation simply means the persistent group is unloaded from memory,
- * it should not get interpreted as the group is actually being erased/removed
- * from persistent storage as well.
- */
-int wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s,
- int nid)
-{
- struct wpas_dbus_priv *ctrl_iface;
- char pgrp_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
- int ret;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL ||
- wpa_s->dbus_new_path == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
- wpa_s->dbus_new_path, nid);
-
- wpa_printf(MSG_DEBUG, "dbus: Unregister persistent group object '%s'",
- pgrp_obj_path);
- ret = wpa_dbus_unregister_object_per_iface(ctrl_iface, pgrp_obj_path);
-
- if (!ret)
- wpas_dbus_signal_persistent_group_removed(wpa_s, nid);
-
- return ret;
-}
-
-#endif /* CONFIG_P2P */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new.h b/contrib/wpa/wpa_supplicant/dbus/dbus_new.h
deleted file mode 100644
index 363a7e5..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new.h
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef CTRL_IFACE_DBUS_NEW_H
-#define CTRL_IFACE_DBUS_NEW_H
-
-#include "common/defs.h"
-#include "p2p/p2p.h"
-
-struct wpa_global;
-struct wpa_supplicant;
-struct wpa_ssid;
-struct wps_event_m2d;
-struct wps_event_fail;
-struct wps_credential;
-
-enum wpas_dbus_prop {
- WPAS_DBUS_PROP_AP_SCAN,
- WPAS_DBUS_PROP_SCANNING,
- WPAS_DBUS_PROP_STATE,
- WPAS_DBUS_PROP_CURRENT_BSS,
- WPAS_DBUS_PROP_CURRENT_NETWORK,
- WPAS_DBUS_PROP_CURRENT_AUTH_MODE,
- WPAS_DBUS_PROP_BSSS,
- WPAS_DBUS_PROP_DISCONNECT_REASON,
-};
-
-enum wpas_dbus_bss_prop {
- WPAS_DBUS_BSS_PROP_SIGNAL,
- WPAS_DBUS_BSS_PROP_FREQ,
- WPAS_DBUS_BSS_PROP_MODE,
- WPAS_DBUS_BSS_PROP_PRIVACY,
- WPAS_DBUS_BSS_PROP_RATES,
- WPAS_DBUS_BSS_PROP_WPA,
- WPAS_DBUS_BSS_PROP_RSN,
- WPAS_DBUS_BSS_PROP_WPS,
- WPAS_DBUS_BSS_PROP_IES,
-};
-
-#define WPAS_DBUS_OBJECT_PATH_MAX 150
-
-#define WPAS_DBUS_NEW_SERVICE "fi.w1.wpa_supplicant1"
-#define WPAS_DBUS_NEW_PATH "/fi/w1/wpa_supplicant1"
-#define WPAS_DBUS_NEW_INTERFACE "fi.w1.wpa_supplicant1"
-
-#define WPAS_DBUS_NEW_PATH_INTERFACES WPAS_DBUS_NEW_PATH "/Interfaces"
-#define WPAS_DBUS_NEW_IFACE_INTERFACE WPAS_DBUS_NEW_INTERFACE ".Interface"
-#define WPAS_DBUS_NEW_IFACE_WPS WPAS_DBUS_NEW_IFACE_INTERFACE ".WPS"
-
-#define WPAS_DBUS_NEW_NETWORKS_PART "Networks"
-#define WPAS_DBUS_NEW_IFACE_NETWORK WPAS_DBUS_NEW_INTERFACE ".Network"
-
-#define WPAS_DBUS_NEW_BSSIDS_PART "BSSs"
-#define WPAS_DBUS_NEW_IFACE_BSS WPAS_DBUS_NEW_INTERFACE ".BSS"
-
-#define WPAS_DBUS_NEW_IFACE_P2PDEVICE \
- WPAS_DBUS_NEW_IFACE_INTERFACE ".P2PDevice"
-
-/*
- * Groups correspond to P2P groups where this device is a GO (owner)
- */
-#define WPAS_DBUS_NEW_P2P_GROUPS_PART "Groups"
-#define WPAS_DBUS_NEW_IFACE_P2P_GROUP WPAS_DBUS_NEW_INTERFACE ".Group"
-
-/*
- * Different dbus object for persistent groups so they do not get confused
- * with regular (configured) network objects.
- */
-#define WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "PersistentGroups"
-#define WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP \
- WPAS_DBUS_NEW_INTERFACE ".PersistentGroup"
-
-#define WPAS_DBUS_NEW_P2P_PEERS_PART "Peers"
-#define WPAS_DBUS_NEW_IFACE_P2P_PEER WPAS_DBUS_NEW_INTERFACE ".Peer"
-
-#define WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "Members"
-#define WPAS_DBUS_NEW_IFACE_P2P_GROUPMEMBER \
- WPAS_DBUS_NEW_INTERFACE ".GroupMember"
-
-/* Errors */
-#define WPAS_DBUS_ERROR_UNKNOWN_ERROR \
- WPAS_DBUS_NEW_INTERFACE ".UnknownError"
-#define WPAS_DBUS_ERROR_INVALID_ARGS \
- WPAS_DBUS_NEW_INTERFACE ".InvalidArgs"
-
-#define WPAS_DBUS_ERROR_IFACE_EXISTS \
- WPAS_DBUS_NEW_INTERFACE ".InterfaceExists"
-#define WPAS_DBUS_ERROR_IFACE_UNKNOWN \
- WPAS_DBUS_NEW_INTERFACE ".InterfaceUnknown"
-
-#define WPAS_DBUS_ERROR_NOT_CONNECTED \
- WPAS_DBUS_NEW_INTERFACE ".NotConnected"
-#define WPAS_DBUS_ERROR_NETWORK_UNKNOWN \
- WPAS_DBUS_NEW_INTERFACE ".NetworkUnknown"
-
-#define WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNAVAILABLE \
- WPAS_DBUS_NEW_INTERFACE ".ConnectChannelUnavailable"
-#define WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNSUPPORTED \
- WPAS_DBUS_NEW_INTERFACE ".ConnectChannelUnsupported"
-#define WPAS_DBUS_ERROR_CONNECT_UNSPECIFIED_ERROR \
- WPAS_DBUS_NEW_INTERFACE ".ConnectUnspecifiedError"
-
-#define WPAS_DBUS_ERROR_BLOB_EXISTS \
- WPAS_DBUS_NEW_INTERFACE ".BlobExists"
-#define WPAS_DBUS_ERROR_BLOB_UNKNOWN \
- WPAS_DBUS_NEW_INTERFACE ".BlobUnknown"
-
-#define WPAS_DBUS_ERROR_SUBSCRIPTION_IN_USE \
- WPAS_DBUS_NEW_INTERFACE ".SubscriptionInUse"
-#define WPAS_DBUS_ERROR_NO_SUBSCRIPTION \
- WPAS_DBUS_NEW_INTERFACE ".NoSubscription"
-#define WPAS_DBUS_ERROR_SUBSCRIPTION_EPERM \
- WPAS_DBUS_NEW_INTERFACE ".SubscriptionNotYou"
-
-
-void wpas_dbus_subscribe_noc(struct wpas_dbus_priv *priv);
-void wpas_dbus_unsubscribe_noc(struct wpas_dbus_priv *priv);
-
-
-#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
-
-int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
-void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
-
-int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s);
-int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s);
-void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
- enum wpas_dbus_prop property);
-void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
- enum wpas_dbus_bss_prop property,
- unsigned int id);
-void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
-void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id);
-void wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid,
- enum wpa_ctrl_req_type rtype,
- const char *default_text);
-void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success);
-void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred);
-void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
- struct wps_event_m2d *m2d);
-void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
- struct wps_event_fail *fail);
-void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s);
-int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
-int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid);
-int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
- u8 bssid[ETH_ALEN], unsigned int id);
-int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
- u8 bssid[ETH_ALEN], unsigned int id);
-void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
- const char *name);
-void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
- const char *name);
-void wpas_dbus_signal_debug_level_changed(struct wpa_global *global);
-void wpas_dbus_signal_debug_timestamp_changed(struct wpa_global *global);
-void wpas_dbus_signal_debug_show_keys_changed(struct wpa_global *global);
-
-int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr);
-void wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr);
-int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr);
-void wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr);
-void wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
- const char *role);
-void wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr, int request,
- enum p2p_prov_disc_status status,
- u16 config_methods,
- unsigned int generated_pin);
-void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
- const u8 *src, u16 dev_passwd_id);
-void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
- const struct wpa_ssid *ssid,
- int client, int network_id);
-void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
-void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
- struct p2p_go_neg_results *res);
-void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
- const struct wpa_ssid *ssid);
-int wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
-int wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s,
- int nid);
-void wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s,
- int status, const u8 *bssid);
-void wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s,
- const u8 *p2p_if_addr);
-void wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
- const u8 *p2p_if_addr);
-void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
- const u8 *member);
-void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s,
- int freq, const u8 *sa, u8 dialog_token,
- u16 update_indic, const u8 *tlvs,
- size_t tlvs_len);
-void wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
- const u8 *sa, u16 update_indic,
- const u8 *tlvs, size_t tlvs_len);
-void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
- const u8 *member);
-void wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
- struct wps_event_fail *fail);
-void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
- int depth, const char *subject,
- const char *cert_hash,
- const struct wpabuf *cert);
-void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
- const u8 *addr, const u8 *dst, const u8 *bssid,
- const u8 *ie, size_t ie_len, u32 ssi_signal);
-void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
- const char *status, const char *parameter);
-
-#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
-
-static inline int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
-{
- return 0;
-}
-
-static inline int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
-{
- return 0;
-}
-
-#define wpas_dbus_signal_state_changed(w, n, o) do { } while (0)
-
-static inline void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
- enum wpas_dbus_prop property)
-{
-}
-
-static inline void wpas_dbus_bss_signal_prop_changed(
- struct wpa_supplicant *wpa_s, enum wpas_dbus_bss_prop property,
- unsigned int id)
-{
-}
-
-static inline void wpas_dbus_signal_network_enabled_changed(
- struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
-{
-}
-
-static inline void wpas_dbus_signal_network_selected(
- struct wpa_supplicant *wpa_s, int id)
-{
-}
-
-static inline void wpas_dbus_signal_network_request(
- struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
- enum wpa_ctrl_req_type rtype, const char *default_txt)
-{
-}
-
-static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s,
- int success)
-{
-}
-
-static inline void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred)
-{
-}
-
-static inline void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
- struct wps_event_m2d *m2d)
-{
-}
-
-static inline void wpas_dbus_signal_wps_event_fail(
- struct wpa_supplicant *wpa_s, struct wps_event_fail *fail)
-{
-}
-
-static inline void wpas_dbus_signal_wps_event_success(
- struct wpa_supplicant *wpa_s)
-{
-}
-
-static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- return 0;
-}
-
-static inline int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s,
- int nid)
-{
- return 0;
-}
-
-static inline int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
- u8 bssid[ETH_ALEN], unsigned int id)
-{
- return 0;
-}
-
-static inline int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
- u8 bssid[ETH_ALEN], unsigned int id)
-{
- return 0;
-}
-
-static inline void wpas_dbus_signal_blob_added(struct wpa_supplicant *wpa_s,
- const char *name)
-{
-}
-
-static inline void wpas_dbus_signal_blob_removed(struct wpa_supplicant *wpa_s,
- const char *name)
-{
-}
-
-static inline void wpas_dbus_signal_debug_level_changed(
- struct wpa_global *global)
-{
-}
-
-static inline void wpas_dbus_signal_debug_timestamp_changed(
- struct wpa_global *global)
-{
-}
-
-static inline void wpas_dbus_signal_debug_show_keys_changed(
- struct wpa_global *global)
-{
-}
-
-static inline int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr)
-{
- return 0;
-}
-
-static inline int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr)
-{
- return 0;
-}
-
-static inline void
-wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
- const char *role)
-{
-}
-
-static inline void
-wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr, int request,
- enum p2p_prov_disc_status status,
- u16 config_methods,
- unsigned int generated_pin)
-{
-}
-
-static inline void wpas_dbus_signal_p2p_go_neg_req(
- struct wpa_supplicant *wpa_s,
- const u8 *src,
- u16 dev_passwd_id)
-{
-}
-
-static inline void
-wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
- const struct wpa_ssid *ssid,
- int client, int network_id)
-{
-}
-
-static inline void
-wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
-}
-
-static inline int wpas_dbus_register_persistent_group(
- struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
-{
- return 0;
-}
-
-static inline int wpas_dbus_unregister_persistent_group(
- struct wpa_supplicant *wpa_s, int nid)
-{
- return 0;
-}
-
-static inline void
-wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
- struct p2p_go_neg_results *res)
-{
-}
-
-static inline void
-wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
- const struct wpa_ssid *ssid)
-{
-}
-
-static inline void wpas_dbus_signal_p2p_invitation_result(
- struct wpa_supplicant *wpa_s, int status,
- const u8 *bssid)
-{
-}
-
-static inline void
-wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s,
- const u8 *p2p_if_addr)
-{
-}
-
-static inline void
-wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s, int freq,
- const u8 *sa, u8 dialog_token, u16 update_indic,
- const u8 *tlvs, size_t tlvs_len)
-{
-}
-
-static inline void
-wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
- const u8 *sa, u16 update_indic,
- const u8 *tlvs, size_t tlvs_len)
-{
-}
-
-static inline void
-wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s,
- const u8 *p2p_if_addr)
-{
-}
-
-static inline void
-wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
- const u8 *member)
-{
-}
-
-static inline void
-wpas_dbus_signal_peer_device_found(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr)
-{
-}
-
-static inline void
-wpas_dbus_signal_peer_device_lost(struct wpa_supplicant *wpa_s,
- const u8 *dev_addr)
-{
-}
-
-static inline void
-wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
- const u8 *member)
-{
-}
-
-static inline void
-wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
- struct wps_event_fail *fail)
-{
-}
-
-static inline void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
- int depth,
- const char *subject,
- const char *cert_hash,
- const struct wpabuf *cert)
-{
-}
-
-static inline void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
- const u8 *addr, const u8 *dst,
- const u8 *bssid,
- const u8 *ie, size_t ie_len,
- u32 ssi_signal)
-{
-}
-
-static inline void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
- const char *status,
- const char *parameter)
-{
-}
-
-#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
-
-#endif /* CTRL_IFACE_DBUS_H_NEW */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.c b/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.c
deleted file mode 100644
index 5e06932..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.c
+++ /dev/null
@@ -1,3759 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
- * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-
-#include "common.h"
-#include "common/ieee802_11_defs.h"
-#include "eap_peer/eap_methods.h"
-#include "eapol_supp/eapol_supp_sm.h"
-#include "rsn_supp/wpa.h"
-#include "../config.h"
-#include "../wpa_supplicant_i.h"
-#include "../driver_i.h"
-#include "../notify.h"
-#include "../bss.h"
-#include "../scan.h"
-#include "../autoscan.h"
-#include "dbus_new_helpers.h"
-#include "dbus_new.h"
-#include "dbus_new_handlers.h"
-#include "dbus_dict_helpers.h"
-#include "dbus_common_i.h"
-
-extern int wpa_debug_level;
-extern int wpa_debug_show_keys;
-extern int wpa_debug_timestamp;
-
-static const char *debug_strings[] = {
- "excessive", "msgdump", "debug", "info", "warning", "error", NULL
-};
-
-
-/**
- * wpas_dbus_error_unknown_error - Return a new InvalidArgs error message
- * @message: Pointer to incoming dbus message this error refers to
- * @arg: Optional string appended to error message
- * Returns: a dbus error message
- *
- * Convenience function to create and return an UnknownError
- */
-DBusMessage * wpas_dbus_error_unknown_error(DBusMessage *message,
- const char *arg)
-{
- /*
- * This function can be called as a result of a failure
- * within internal getter calls, which will call this function
- * with a NULL message parameter. However, dbus_message_new_error
- * looks very unkindly (i.e, abort()) on a NULL message, so
- * in this case, we should not call it.
- */
- if (message == NULL) {
- wpa_printf(MSG_INFO, "dbus: wpas_dbus_error_unknown_error "
- "called with NULL message (arg=%s)",
- arg ? arg : "N/A");
- return NULL;
- }
-
- return dbus_message_new_error(message, WPAS_DBUS_ERROR_UNKNOWN_ERROR,
- arg);
-}
-
-
-/**
- * wpas_dbus_error_iface_unknown - Return a new invalid interface error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: A dbus error message
- *
- * Convenience function to create and return an invalid interface error
- */
-static DBusMessage * wpas_dbus_error_iface_unknown(DBusMessage *message)
-{
- return dbus_message_new_error(message, WPAS_DBUS_ERROR_IFACE_UNKNOWN,
- "wpa_supplicant knows nothing about "
- "this interface.");
-}
-
-
-/**
- * wpas_dbus_error_network_unknown - Return a new NetworkUnknown error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: a dbus error message
- *
- * Convenience function to create and return an invalid network error
- */
-static DBusMessage * wpas_dbus_error_network_unknown(DBusMessage *message)
-{
- return dbus_message_new_error(message, WPAS_DBUS_ERROR_NETWORK_UNKNOWN,
- "There is no such a network in this "
- "interface.");
-}
-
-
-/**
- * wpas_dbus_error_invalid_args - Return a new InvalidArgs error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: a dbus error message
- *
- * Convenience function to create and return an invalid options error
- */
-DBusMessage * wpas_dbus_error_invalid_args(DBusMessage *message,
- const char *arg)
-{
- DBusMessage *reply;
-
- reply = dbus_message_new_error(message, WPAS_DBUS_ERROR_INVALID_ARGS,
- "Did not receive correct message "
- "arguments.");
- if (arg != NULL)
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &arg,
- DBUS_TYPE_INVALID);
-
- return reply;
-}
-
-
-static const char *dont_quote[] = {
- "key_mgmt", "proto", "pairwise", "auth_alg", "group", "eap",
- "opensc_engine_path", "pkcs11_engine_path", "pkcs11_module_path",
- "bssid", "scan_freq", "freq_list", NULL
-};
-
-static dbus_bool_t should_quote_opt(const char *key)
-{
- int i = 0;
- while (dont_quote[i] != NULL) {
- if (os_strcmp(key, dont_quote[i]) == 0)
- return FALSE;
- i++;
- }
- return TRUE;
-}
-
-/**
- * get_iface_by_dbus_path - Get a new network interface
- * @global: Pointer to global data from wpa_supplicant_init()
- * @path: Pointer to a dbus object path representing an interface
- * Returns: Pointer to the interface or %NULL if not found
- */
-static struct wpa_supplicant * get_iface_by_dbus_path(
- struct wpa_global *global, const char *path)
-{
- struct wpa_supplicant *wpa_s;
-
- for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
- if (os_strcmp(wpa_s->dbus_new_path, path) == 0)
- return wpa_s;
- }
- return NULL;
-}
-
-
-/**
- * set_network_properties - Set properties of a configured network
- * @wpa_s: wpa_supplicant structure for a network interface
- * @ssid: wpa_ssid structure for a configured network
- * @iter: DBus message iterator containing dictionary of network
- * properties to set.
- * @error: On failure, an error describing the failure
- * Returns: TRUE if the request succeeds, FALSE if it failed
- *
- * Sets network configuration with parameters given id DBus dictionary
- */
-dbus_bool_t set_network_properties(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid,
- DBusMessageIter *iter,
- DBusError *error)
-{
- struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
- DBusMessageIter iter_dict;
- char *value = NULL;
-
- if (!wpa_dbus_dict_open_read(iter, &iter_dict, error))
- return FALSE;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- size_t size = 50;
- int ret;
-
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- value = NULL;
- if (entry.type == DBUS_TYPE_ARRAY &&
- entry.array_type == DBUS_TYPE_BYTE) {
- if (entry.array_len <= 0)
- goto error;
-
- size = entry.array_len * 2 + 1;
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
-
- ret = wpa_snprintf_hex(value, size,
- (u8 *) entry.bytearray_value,
- entry.array_len);
- if (ret <= 0)
- goto error;
- } else if (entry.type == DBUS_TYPE_STRING) {
- if (should_quote_opt(entry.key)) {
- size = os_strlen(entry.str_value);
- if (size <= 0)
- goto error;
-
- size += 3;
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
-
- ret = os_snprintf(value, size, "\"%s\"",
- entry.str_value);
- if (ret < 0 || (size_t) ret != (size - 1))
- goto error;
- } else {
- value = os_strdup(entry.str_value);
- if (value == NULL)
- goto error;
- }
- } else if (entry.type == DBUS_TYPE_UINT32) {
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
-
- ret = os_snprintf(value, size, "%u",
- entry.uint32_value);
- if (ret <= 0)
- goto error;
- } else if (entry.type == DBUS_TYPE_INT32) {
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
-
- ret = os_snprintf(value, size, "%d",
- entry.int32_value);
- if (ret <= 0)
- goto error;
- } else
- goto error;
-
- if (wpa_config_set(ssid, entry.key, value, 0) < 0)
- goto error;
-
- if ((os_strcmp(entry.key, "psk") == 0 &&
- value[0] == '"' && ssid->ssid_len) ||
- (os_strcmp(entry.key, "ssid") == 0 && ssid->passphrase))
- wpa_config_update_psk(ssid);
- else if (os_strcmp(entry.key, "priority") == 0)
- wpa_config_update_prio_list(wpa_s->conf);
-
- os_free(value);
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- return TRUE;
-
-error:
- os_free(value);
- wpa_dbus_dict_entry_clear(&entry);
- dbus_set_error_const(error, DBUS_ERROR_INVALID_ARGS,
- "invalid message format");
- return FALSE;
-}
-
-
-/**
- * wpas_dbus_simple_property_getter - Get basic type property
- * @iter: Message iter to use when appending arguments
- * @type: DBus type of property (must be basic type)
- * @val: pointer to place holding property value
- * @error: On failure an error describing the failure
- * Returns: TRUE if the request was successful, FALSE if it failed
- *
- * Generic getter for basic type properties. Type is required to be basic.
- */
-dbus_bool_t wpas_dbus_simple_property_getter(DBusMessageIter *iter,
- const int type,
- const void *val,
- DBusError *error)
-{
- DBusMessageIter variant_iter;
-
- if (!dbus_type_is_basic(type)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: given type is not basic", __func__);
- return FALSE;
- }
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- wpa_dbus_type_as_string(type),
- &variant_iter))
- goto error;
-
- if (!dbus_message_iter_append_basic(&variant_iter, type, val))
- goto error;
-
- if (!dbus_message_iter_close_container(iter, &variant_iter))
- goto error;
-
- return TRUE;
-
-error:
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: error constructing reply", __func__);
- return FALSE;
-}
-
-
-/**
- * wpas_dbus_simple_property_setter - Set basic type property
- * @message: Pointer to incoming dbus message
- * @type: DBus type of property (must be basic type)
- * @val: pointer to place where value being set will be stored
- * Returns: TRUE if the request was successful, FALSE if it failed
- *
- * Generic setter for basic type properties. Type is required to be basic.
- */
-dbus_bool_t wpas_dbus_simple_property_setter(DBusMessageIter *iter,
- DBusError *error,
- const int type, void *val)
-{
- DBusMessageIter variant_iter;
-
- if (!dbus_type_is_basic(type)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: given type is not basic", __func__);
- return FALSE;
- }
-
- /* Look at the new value */
- dbus_message_iter_recurse(iter, &variant_iter);
- if (dbus_message_iter_get_arg_type(&variant_iter) != type) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "wrong property type");
- return FALSE;
- }
- dbus_message_iter_get_basic(&variant_iter, val);
-
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_simple_array_property_getter - Get array type property
- * @iter: Pointer to incoming dbus message iterator
- * @type: DBus type of property array elements (must be basic type)
- * @array: pointer to array of elements to put into response message
- * @array_len: length of above array
- * @error: a pointer to an error to fill on failure
- * Returns: TRUE if the request succeeded, FALSE if it failed
- *
- * Generic getter for array type properties. Array elements type is
- * required to be basic.
- */
-dbus_bool_t wpas_dbus_simple_array_property_getter(DBusMessageIter *iter,
- const int type,
- const void *array,
- size_t array_len,
- DBusError *error)
-{
- DBusMessageIter variant_iter, array_iter;
- char type_str[] = "a?"; /* ? will be replaced with subtype letter; */
- const char *sub_type_str;
- size_t element_size, i;
-
- if (!dbus_type_is_basic(type)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: given type is not basic", __func__);
- return FALSE;
- }
-
- sub_type_str = wpa_dbus_type_as_string(type);
- type_str[1] = sub_type_str[0];
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- type_str, &variant_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 1", __func__);
- return FALSE;
- }
-
- if (!dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
- sub_type_str, &array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 2", __func__);
- return FALSE;
- }
-
- switch(type) {
- case DBUS_TYPE_BYTE:
- case DBUS_TYPE_BOOLEAN:
- element_size = 1;
- break;
- case DBUS_TYPE_INT16:
- case DBUS_TYPE_UINT16:
- element_size = sizeof(uint16_t);
- break;
- case DBUS_TYPE_INT32:
- case DBUS_TYPE_UINT32:
- element_size = sizeof(uint32_t);
- break;
- case DBUS_TYPE_INT64:
- case DBUS_TYPE_UINT64:
- element_size = sizeof(uint64_t);
- break;
- case DBUS_TYPE_DOUBLE:
- element_size = sizeof(double);
- break;
- case DBUS_TYPE_STRING:
- case DBUS_TYPE_OBJECT_PATH:
- element_size = sizeof(char *);
- break;
- default:
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: unknown element type %d", __func__, type);
- return FALSE;
- }
-
- for (i = 0; i < array_len; i++) {
- dbus_message_iter_append_basic(&array_iter, type,
- array + i * element_size);
- }
-
- if (!dbus_message_iter_close_container(&variant_iter, &array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 3", __func__);
- return FALSE;
- }
-
- if (!dbus_message_iter_close_container(iter, &variant_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 4", __func__);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_simple_array_array_property_getter - Get array array type property
- * @iter: Pointer to incoming dbus message iterator
- * @type: DBus type of property array elements (must be basic type)
- * @array: pointer to array of elements to put into response message
- * @array_len: length of above array
- * @error: a pointer to an error to fill on failure
- * Returns: TRUE if the request succeeded, FALSE if it failed
- *
- * Generic getter for array type properties. Array elements type is
- * required to be basic.
- */
-dbus_bool_t wpas_dbus_simple_array_array_property_getter(DBusMessageIter *iter,
- const int type,
- struct wpabuf **array,
- size_t array_len,
- DBusError *error)
-{
- DBusMessageIter variant_iter, array_iter;
- char type_str[] = "aa?";
- char inner_type_str[] = "a?";
- const char *sub_type_str;
- size_t i;
-
- if (!dbus_type_is_basic(type)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: given type is not basic", __func__);
- return FALSE;
- }
-
- sub_type_str = wpa_dbus_type_as_string(type);
- type_str[2] = sub_type_str[0];
- inner_type_str[1] = sub_type_str[0];
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- type_str, &variant_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 1", __func__);
- return FALSE;
- }
- if (!dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
- inner_type_str, &array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 2", __func__);
- return FALSE;
- }
-
- for (i = 0; i < array_len; i++) {
- wpa_dbus_dict_bin_array_add_element(&array_iter,
- wpabuf_head(array[i]),
- wpabuf_len(array[i]));
-
- }
-
- if (!dbus_message_iter_close_container(&variant_iter, &array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to close message 2", __func__);
- return FALSE;
- }
-
- if (!dbus_message_iter_close_container(iter, &variant_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to close message 1", __func__);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_handler_create_interface - Request registration of a network iface
- * @message: Pointer to incoming dbus message
- * @global: %wpa_supplicant global data structure
- * Returns: The object path of the new interface object,
- * or a dbus error message with more information
- *
- * Handler function for "CreateInterface" method call. Handles requests
- * by dbus clients to register a network interface that wpa_supplicant
- * will manage.
- */
-DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
- struct wpa_global *global)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- char *driver = NULL;
- char *ifname = NULL;
- char *confname = NULL;
- char *bridge_ifname = NULL;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
- if (!os_strcmp(entry.key, "Driver") &&
- (entry.type == DBUS_TYPE_STRING)) {
- driver = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (driver == NULL)
- goto error;
- } else if (!os_strcmp(entry.key, "Ifname") &&
- (entry.type == DBUS_TYPE_STRING)) {
- ifname = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (ifname == NULL)
- goto error;
- } else if (!os_strcmp(entry.key, "ConfigFile") &&
- (entry.type == DBUS_TYPE_STRING)) {
- confname = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (confname == NULL)
- goto error;
- } else if (!os_strcmp(entry.key, "BridgeIfname") &&
- (entry.type == DBUS_TYPE_STRING)) {
- bridge_ifname = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (bridge_ifname == NULL)
- goto error;
- } else {
- wpa_dbus_dict_entry_clear(&entry);
- goto error;
- }
- }
-
- if (ifname == NULL)
- goto error; /* Required Ifname argument missing */
-
- /*
- * Try to get the wpa_supplicant record for this iface, return
- * an error if we already control it.
- */
- if (wpa_supplicant_get_iface(global, ifname) != NULL) {
- reply = dbus_message_new_error(message,
- WPAS_DBUS_ERROR_IFACE_EXISTS,
- "wpa_supplicant already "
- "controls this interface.");
- } else {
- struct wpa_supplicant *wpa_s;
- struct wpa_interface iface;
- os_memset(&iface, 0, sizeof(iface));
- iface.driver = driver;
- iface.ifname = ifname;
- iface.confname = confname;
- iface.bridge_ifname = bridge_ifname;
- /* Otherwise, have wpa_supplicant attach to it. */
- if ((wpa_s = wpa_supplicant_add_iface(global, &iface))) {
- const char *path = wpa_s->dbus_new_path;
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
- &path, DBUS_TYPE_INVALID);
- } else {
- reply = wpas_dbus_error_unknown_error(
- message, "wpa_supplicant couldn't grab this "
- "interface.");
- }
- }
-
-out:
- os_free(driver);
- os_free(ifname);
- os_free(confname);
- os_free(bridge_ifname);
- return reply;
-
-error:
- reply = wpas_dbus_error_invalid_args(message, NULL);
- goto out;
-}
-
-
-/**
- * wpas_dbus_handler_remove_interface - Request deregistration of an interface
- * @message: Pointer to incoming dbus message
- * @global: wpa_supplicant global data structure
- * Returns: a dbus message containing a UINT32 indicating success (1) or
- * failure (0), or returns a dbus error message with more information
- *
- * Handler function for "removeInterface" method call. Handles requests
- * by dbus clients to deregister a network interface that wpa_supplicant
- * currently manages.
- */
-DBusMessage * wpas_dbus_handler_remove_interface(DBusMessage *message,
- struct wpa_global *global)
-{
- struct wpa_supplicant *wpa_s;
- char *path;
- DBusMessage *reply = NULL;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID);
-
- wpa_s = get_iface_by_dbus_path(global, path);
- if (wpa_s == NULL)
- reply = wpas_dbus_error_iface_unknown(message);
- else if (wpa_supplicant_remove_iface(global, wpa_s, 0)) {
- reply = wpas_dbus_error_unknown_error(
- message, "wpa_supplicant couldn't remove this "
- "interface.");
- }
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_handler_get_interface - Get the object path for an interface name
- * @message: Pointer to incoming dbus message
- * @global: %wpa_supplicant global data structure
- * Returns: The object path of the interface object,
- * or a dbus error message with more information
- *
- * Handler function for "getInterface" method call.
- */
-DBusMessage * wpas_dbus_handler_get_interface(DBusMessage *message,
- struct wpa_global *global)
-{
- DBusMessage *reply = NULL;
- const char *ifname;
- const char *path;
- struct wpa_supplicant *wpa_s;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &ifname,
- DBUS_TYPE_INVALID);
-
- wpa_s = wpa_supplicant_get_iface(global, ifname);
- if (wpa_s == NULL)
- return wpas_dbus_error_iface_unknown(message);
-
- path = wpa_s->dbus_new_path;
- reply = dbus_message_new_method_return(message);
- if (reply == NULL)
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- if (!dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID)) {
- dbus_message_unref(reply);
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- }
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_getter_debug_level - Get debug level
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "DebugLevel" property.
- */
-dbus_bool_t wpas_dbus_getter_debug_level(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- const char *str;
- int idx = wpa_debug_level;
-
- if (idx < 0)
- idx = 0;
- if (idx > 5)
- idx = 5;
- str = debug_strings[idx];
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &str, error);
-}
-
-
-/**
- * wpas_dbus_getter_debug_timestamp - Get debug timestamp
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "DebugTimestamp" property.
- */
-dbus_bool_t wpas_dbus_getter_debug_timestamp(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
- &wpa_debug_timestamp, error);
-
-}
-
-
-/**
- * wpas_dbus_getter_debug_show_keys - Get debug show keys
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "DebugShowKeys" property.
- */
-dbus_bool_t wpas_dbus_getter_debug_show_keys(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
- &wpa_debug_show_keys, error);
-
-}
-
-/**
- * wpas_dbus_setter_debug_level - Set debug level
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter for "DebugLevel" property.
- */
-dbus_bool_t wpas_dbus_setter_debug_level(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct wpa_global *global = user_data;
- const char *str = NULL;
- int i, val = -1;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_STRING,
- &str))
- return FALSE;
-
- for (i = 0; debug_strings[i]; i++)
- if (os_strcmp(debug_strings[i], str) == 0) {
- val = i;
- break;
- }
-
- if (val < 0 ||
- wpa_supplicant_set_debug_params(global, val, wpa_debug_timestamp,
- wpa_debug_show_keys)) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED, "wrong debug "
- "level value");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_setter_debug_timestamp - Set debug timestamp
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter for "DebugTimestamp" property.
- */
-dbus_bool_t wpas_dbus_setter_debug_timestamp(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_global *global = user_data;
- dbus_bool_t val;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
- &val))
- return FALSE;
-
- wpa_supplicant_set_debug_params(global, wpa_debug_level, val ? 1 : 0,
- wpa_debug_show_keys);
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_setter_debug_show_keys - Set debug show keys
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter for "DebugShowKeys" property.
- */
-dbus_bool_t wpas_dbus_setter_debug_show_keys(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_global *global = user_data;
- dbus_bool_t val;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
- &val))
- return FALSE;
-
- wpa_supplicant_set_debug_params(global, wpa_debug_level,
- wpa_debug_timestamp,
- val ? 1 : 0);
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_interfaces - Request registered interfaces list
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Interfaces" property. Handles requests
- * by dbus clients to return list of registered interfaces objects
- * paths
- */
-dbus_bool_t wpas_dbus_getter_interfaces(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_global *global = user_data;
- struct wpa_supplicant *wpa_s;
- const char **paths;
- unsigned int i = 0, num = 0;
- dbus_bool_t success;
-
- for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
- num++;
-
- paths = os_calloc(num, sizeof(char *));
- if (!paths) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
- paths[i++] = wpa_s->dbus_new_path;
-
- success = wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_OBJECT_PATH,
- paths, num, error);
-
- os_free(paths);
- return success;
-}
-
-
-/**
- * wpas_dbus_getter_eap_methods - Request supported EAP methods list
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "EapMethods" property. Handles requests
- * by dbus clients to return list of strings with supported EAP methods
- */
-dbus_bool_t wpas_dbus_getter_eap_methods(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- char **eap_methods;
- size_t num_items = 0;
- dbus_bool_t success;
-
- eap_methods = eap_get_names_as_string_array(&num_items);
- if (!eap_methods) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- success = wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_STRING,
- eap_methods,
- num_items, error);
-
- while (num_items)
- os_free(eap_methods[--num_items]);
- os_free(eap_methods);
- return success;
-}
-
-
-/**
- * wpas_dbus_getter_global_capabilities - Request supported global capabilities
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Capabilities" property. Handles requests by dbus clients to
- * return a list of strings with supported capabilities like AP, RSN IBSS,
- * and P2P that are determined at compile time.
- */
-dbus_bool_t wpas_dbus_getter_global_capabilities(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- const char *capabilities[5] = { NULL, NULL, NULL, NULL, NULL };
- size_t num_items = 0;
-
-#ifdef CONFIG_AP
- capabilities[num_items++] = "ap";
-#endif /* CONFIG_AP */
-#ifdef CONFIG_IBSS_RSN
- capabilities[num_items++] = "ibss-rsn";
-#endif /* CONFIG_IBSS_RSN */
-#ifdef CONFIG_P2P
- capabilities[num_items++] = "p2p";
-#endif /* CONFIG_P2P */
-#ifdef CONFIG_INTERWORKING
- capabilities[num_items++] = "interworking";
-#endif /* CONFIG_INTERWORKING */
-
- return wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_STRING,
- capabilities,
- num_items, error);
-}
-
-
-static int wpas_dbus_get_scan_type(DBusMessage *message, DBusMessageIter *var,
- char **type, DBusMessage **reply)
-{
- if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_STRING) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Type must be a string");
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong Type value type. String required");
- return -1;
- }
- dbus_message_iter_get_basic(var, type);
- return 0;
-}
-
-
-static int wpas_dbus_get_scan_ssids(DBusMessage *message, DBusMessageIter *var,
- struct wpa_driver_scan_params *params,
- DBusMessage **reply)
-{
- struct wpa_driver_scan_ssid *ssids = params->ssids;
- size_t ssids_num = 0;
- u8 *ssid;
- DBusMessageIter array_iter, sub_array_iter;
- char *val;
- int len;
-
- if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_ARRAY) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: ssids "
- "must be an array of arrays of bytes");
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong SSIDs value type. Array of arrays of "
- "bytes required");
- return -1;
- }
-
- dbus_message_iter_recurse(var, &array_iter);
-
- if (dbus_message_iter_get_arg_type(&array_iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&array_iter) != DBUS_TYPE_BYTE)
- {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: ssids "
- "must be an array of arrays of bytes");
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong SSIDs value type. Array of arrays of "
- "bytes required");
- return -1;
- }
-
- while (dbus_message_iter_get_arg_type(&array_iter) == DBUS_TYPE_ARRAY)
- {
- if (ssids_num >= WPAS_MAX_SCAN_SSIDS) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Too many ssids specified on scan dbus "
- "call");
- *reply = wpas_dbus_error_invalid_args(
- message, "Too many ssids specified. Specify "
- "at most four");
- return -1;
- }
-
- dbus_message_iter_recurse(&array_iter, &sub_array_iter);
-
- dbus_message_iter_get_fixed_array(&sub_array_iter, &val, &len);
-
- if (len > MAX_SSID_LEN) {
- wpa_printf(MSG_DEBUG,
- "wpas_dbus_handler_scan[dbus]: "
- "SSID too long (len=%d max_len=%d)",
- len, MAX_SSID_LEN);
- *reply = wpas_dbus_error_invalid_args(
- message, "Invalid SSID: too long");
- return -1;
- }
-
- if (len != 0) {
- ssid = os_malloc(len);
- if (ssid == NULL) {
- wpa_printf(MSG_DEBUG,
- "wpas_dbus_handler_scan[dbus]: "
- "out of memory. Cannot allocate "
- "memory for SSID");
- *reply = dbus_message_new_error(
- message, DBUS_ERROR_NO_MEMORY, NULL);
- return -1;
- }
- os_memcpy(ssid, val, len);
- } else {
- /* Allow zero-length SSIDs */
- ssid = NULL;
- }
-
- ssids[ssids_num].ssid = ssid;
- ssids[ssids_num].ssid_len = len;
-
- dbus_message_iter_next(&array_iter);
- ssids_num++;
- }
-
- params->num_ssids = ssids_num;
- return 0;
-}
-
-
-static int wpas_dbus_get_scan_ies(DBusMessage *message, DBusMessageIter *var,
- struct wpa_driver_scan_params *params,
- DBusMessage **reply)
-{
- u8 *ies = NULL, *nies;
- int ies_len = 0;
- DBusMessageIter array_iter, sub_array_iter;
- char *val;
- int len;
-
- if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_ARRAY) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: ies must "
- "be an array of arrays of bytes");
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong IEs value type. Array of arrays of "
- "bytes required");
- return -1;
- }
-
- dbus_message_iter_recurse(var, &array_iter);
-
- if (dbus_message_iter_get_arg_type(&array_iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&array_iter) != DBUS_TYPE_BYTE)
- {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: ies must "
- "be an array of arrays of bytes");
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong IEs value type. Array required");
- return -1;
- }
-
- while (dbus_message_iter_get_arg_type(&array_iter) == DBUS_TYPE_ARRAY)
- {
- dbus_message_iter_recurse(&array_iter, &sub_array_iter);
-
- dbus_message_iter_get_fixed_array(&sub_array_iter, &val, &len);
- if (len == 0) {
- dbus_message_iter_next(&array_iter);
- continue;
- }
-
- nies = os_realloc(ies, ies_len + len);
- if (nies == NULL) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "out of memory. Cannot allocate memory for "
- "IE");
- os_free(ies);
- *reply = dbus_message_new_error(
- message, DBUS_ERROR_NO_MEMORY, NULL);
- return -1;
- }
- ies = nies;
- os_memcpy(ies + ies_len, val, len);
- ies_len += len;
-
- dbus_message_iter_next(&array_iter);
- }
-
- params->extra_ies = ies;
- params->extra_ies_len = ies_len;
- return 0;
-}
-
-
-static int wpas_dbus_get_scan_channels(DBusMessage *message,
- DBusMessageIter *var,
- struct wpa_driver_scan_params *params,
- DBusMessage **reply)
-{
- DBusMessageIter array_iter, sub_array_iter;
- int *freqs = NULL, *nfreqs;
- int freqs_num = 0;
-
- if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_ARRAY) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Channels must be an array of structs");
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong Channels value type. Array of structs "
- "required");
- return -1;
- }
-
- dbus_message_iter_recurse(var, &array_iter);
-
- if (dbus_message_iter_get_arg_type(&array_iter) != DBUS_TYPE_STRUCT) {
- wpa_printf(MSG_DEBUG,
- "wpas_dbus_handler_scan[dbus]: Channels must be an "
- "array of structs");
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong Channels value type. Array of structs "
- "required");
- return -1;
- }
-
- while (dbus_message_iter_get_arg_type(&array_iter) == DBUS_TYPE_STRUCT)
- {
- int freq, width;
-
- dbus_message_iter_recurse(&array_iter, &sub_array_iter);
-
- if (dbus_message_iter_get_arg_type(&sub_array_iter) !=
- DBUS_TYPE_UINT32) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Channel must by specified by struct of "
- "two UINT32s %c",
- dbus_message_iter_get_arg_type(
- &sub_array_iter));
- *reply = wpas_dbus_error_invalid_args(
- message, "Wrong Channel struct. Two UINT32s "
- "required");
- os_free(freqs);
- return -1;
- }
- dbus_message_iter_get_basic(&sub_array_iter, &freq);
-
- if (!dbus_message_iter_next(&sub_array_iter) ||
- dbus_message_iter_get_arg_type(&sub_array_iter) !=
- DBUS_TYPE_UINT32) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Channel must by specified by struct of "
- "two UINT32s");
- *reply = wpas_dbus_error_invalid_args(
- message,
- "Wrong Channel struct. Two UINT32s required");
- os_free(freqs);
- return -1;
- }
-
- dbus_message_iter_get_basic(&sub_array_iter, &width);
-
-#define FREQS_ALLOC_CHUNK 32
- if (freqs_num % FREQS_ALLOC_CHUNK == 0) {
- nfreqs = os_realloc_array(
- freqs, freqs_num + FREQS_ALLOC_CHUNK,
- sizeof(int));
- if (nfreqs == NULL)
- os_free(freqs);
- freqs = nfreqs;
- }
- if (freqs == NULL) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "out of memory. can't allocate memory for "
- "freqs");
- *reply = dbus_message_new_error(
- message, DBUS_ERROR_NO_MEMORY, NULL);
- return -1;
- }
-
- freqs[freqs_num] = freq;
-
- freqs_num++;
- dbus_message_iter_next(&array_iter);
- }
-
- nfreqs = os_realloc_array(freqs, freqs_num + 1, sizeof(int));
- if (nfreqs == NULL)
- os_free(freqs);
- freqs = nfreqs;
- if (freqs == NULL) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "out of memory. Can't allocate memory for freqs");
- *reply = dbus_message_new_error(
- message, DBUS_ERROR_NO_MEMORY, NULL);
- return -1;
- }
- freqs[freqs_num] = 0;
-
- params->freqs = freqs;
- return 0;
-}
-
-
-/**
- * wpas_dbus_handler_scan - Request a wireless scan on an interface
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL indicating success or DBus error message on failure
- *
- * Handler function for "Scan" method call of a network device. Requests
- * that wpa_supplicant perform a wireless scan as soon as possible
- * on a particular wireless interface.
- */
-DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- DBusMessageIter iter, dict_iter, entry_iter, variant_iter;
- char *key = NULL, *type = NULL;
- struct wpa_driver_scan_params params;
- size_t i;
-
- os_memset(&params, 0, sizeof(params));
-
- dbus_message_iter_init(message, &iter);
-
- dbus_message_iter_recurse(&iter, &dict_iter);
-
- while (dbus_message_iter_get_arg_type(&dict_iter) ==
- DBUS_TYPE_DICT_ENTRY) {
- dbus_message_iter_recurse(&dict_iter, &entry_iter);
- dbus_message_iter_get_basic(&entry_iter, &key);
- dbus_message_iter_next(&entry_iter);
- dbus_message_iter_recurse(&entry_iter, &variant_iter);
-
- if (os_strcmp(key, "Type") == 0) {
- if (wpas_dbus_get_scan_type(message, &variant_iter,
- &type, &reply) < 0)
- goto out;
- } else if (os_strcmp(key, "SSIDs") == 0) {
- if (wpas_dbus_get_scan_ssids(message, &variant_iter,
- &params, &reply) < 0)
- goto out;
- } else if (os_strcmp(key, "IEs") == 0) {
- if (wpas_dbus_get_scan_ies(message, &variant_iter,
- &params, &reply) < 0)
- goto out;
- } else if (os_strcmp(key, "Channels") == 0) {
- if (wpas_dbus_get_scan_channels(message, &variant_iter,
- &params, &reply) < 0)
- goto out;
- } else {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Unknown argument %s", key);
- reply = wpas_dbus_error_invalid_args(message, key);
- goto out;
- }
-
- dbus_message_iter_next(&dict_iter);
- }
-
- if (!type) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Scan type not specified");
- reply = wpas_dbus_error_invalid_args(message, key);
- goto out;
- }
-
- if (!os_strcmp(type, "passive")) {
- if (params.num_ssids || params.extra_ies_len) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "SSIDs or IEs specified for passive scan.");
- reply = wpas_dbus_error_invalid_args(
- message, "You can specify only Channels in "
- "passive scan");
- goto out;
- } else if (params.freqs && params.freqs[0]) {
- wpa_supplicant_trigger_scan(wpa_s, &params);
- } else {
- wpa_s->scan_req = MANUAL_SCAN_REQ;
- wpa_supplicant_req_scan(wpa_s, 0, 0);
- }
- } else if (!os_strcmp(type, "active")) {
- if (!params.num_ssids) {
- /* Add wildcard ssid */
- params.num_ssids++;
- }
-#ifdef CONFIG_AUTOSCAN
- autoscan_deinit(wpa_s);
-#endif /* CONFIG_AUTOSCAN */
- wpa_supplicant_trigger_scan(wpa_s, &params);
- } else {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: "
- "Unknown scan type: %s", type);
- reply = wpas_dbus_error_invalid_args(message,
- "Wrong scan type");
- goto out;
- }
-
-out:
- for (i = 0; i < WPAS_MAX_SCAN_SSIDS; i++)
- os_free((u8 *) params.ssids[i].ssid);
- os_free((u8 *) params.extra_ies);
- os_free(params.freqs);
- return reply;
-}
-
-
-/*
- * wpas_dbus_handler_disconnect - Terminate the current connection
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NotConnected DBus error message if already not connected
- * or NULL otherwise.
- *
- * Handler function for "Disconnect" method call of network interface.
- */
-DBusMessage * wpas_dbus_handler_disconnect(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- if (wpa_s->current_ssid != NULL) {
- wpa_s->disconnected = 1;
- wpa_supplicant_deauthenticate(wpa_s,
- WLAN_REASON_DEAUTH_LEAVING);
-
- return NULL;
- }
-
- return dbus_message_new_error(message, WPAS_DBUS_ERROR_NOT_CONNECTED,
- "This interface is not connected");
-}
-
-
-/**
- * wpas_dbus_new_iface_add_network - Add a new configured network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing the object path of the new network
- *
- * Handler function for "AddNetwork" method call of a network interface.
- */
-DBusMessage * wpas_dbus_handler_add_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_ssid *ssid = NULL;
- char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *path = path_buf;
- DBusError error;
-
- dbus_message_iter_init(message, &iter);
-
- ssid = wpa_config_add_network(wpa_s->conf);
- if (ssid == NULL) {
- wpa_printf(MSG_ERROR, "wpas_dbus_handler_add_network[dbus]: "
- "can't add new interface.");
- reply = wpas_dbus_error_unknown_error(
- message,
- "wpa_supplicant could not add "
- "a network on this interface.");
- goto err;
- }
- wpas_notify_network_added(wpa_s, ssid);
- ssid->disabled = 1;
- wpa_config_set_network_defaults(ssid);
-
- dbus_error_init(&error);
- if (!set_network_properties(wpa_s, ssid, &iter, &error)) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_handler_add_network[dbus]:"
- "control interface couldn't set network "
- "properties");
- reply = wpas_dbus_reply_new_from_error(message, &error,
- DBUS_ERROR_INVALID_ARGS,
- "Failed to add network");
- dbus_error_free(&error);
- goto err;
- }
-
- /* Construct the object path for this network. */
- os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
- wpa_s->dbus_new_path, ssid->id);
-
- reply = dbus_message_new_method_return(message);
- if (reply == NULL) {
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto err;
- }
- if (!dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID)) {
- dbus_message_unref(reply);
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto err;
- }
-
- return reply;
-
-err:
- if (ssid) {
- wpas_notify_network_removed(wpa_s, ssid);
- wpa_config_remove_network(wpa_s->conf, ssid->id);
- }
- return reply;
-}
-
-
-/**
- * wpas_dbus_handler_reassociate - Reassociate to current AP
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NotConnected DBus error message if not connected
- * or NULL otherwise.
- *
- * Handler function for "Reassociate" method call of network interface.
- */
-DBusMessage * wpas_dbus_handler_reassociate(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- if (wpa_s->current_ssid != NULL) {
- wpas_request_connection(wpa_s);
- return NULL;
- }
-
- return dbus_message_new_error(message, WPAS_DBUS_ERROR_NOT_CONNECTED,
- "This interface is not connected");
-}
-
-
-/**
- * wpas_dbus_handler_remove_network - Remove a configured network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL on success or dbus error on failure
- *
- * Handler function for "RemoveNetwork" method call of a network interface.
- */
-DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- const char *op;
- char *iface = NULL, *net_id = NULL;
- int id;
- struct wpa_ssid *ssid;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &op,
- DBUS_TYPE_INVALID);
-
- /* Extract the network ID and ensure the network */
- /* is actually a child of this interface */
- iface = wpas_dbus_new_decompose_object_path(op, 0, &net_id, NULL);
- if (iface == NULL || net_id == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
- reply = wpas_dbus_error_invalid_args(message, op);
- goto out;
- }
-
- errno = 0;
- id = strtoul(net_id, NULL, 10);
- if (errno != 0) {
- reply = wpas_dbus_error_invalid_args(message, op);
- goto out;
- }
-
- ssid = wpa_config_get_network(wpa_s->conf, id);
- if (ssid == NULL) {
- reply = wpas_dbus_error_network_unknown(message);
- goto out;
- }
-
- wpas_notify_network_removed(wpa_s, ssid);
-
- if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
- wpa_printf(MSG_ERROR,
- "wpas_dbus_handler_remove_network[dbus]: "
- "error occurred when removing network %d", id);
- reply = wpas_dbus_error_unknown_error(
- message, "error removing the specified network on "
- "this interface.");
- goto out;
- }
-
- if (ssid == wpa_s->current_ssid)
- wpa_supplicant_deauthenticate(wpa_s,
- WLAN_REASON_DEAUTH_LEAVING);
-
-out:
- os_free(iface);
- os_free(net_id);
- return reply;
-}
-
-
-static void remove_network(void *arg, struct wpa_ssid *ssid)
-{
- struct wpa_supplicant *wpa_s = arg;
-
- wpas_notify_network_removed(wpa_s, ssid);
-
- if (wpa_config_remove_network(wpa_s->conf, ssid->id) < 0) {
- wpa_printf(MSG_ERROR,
- "wpas_dbus_handler_remove_all_networks[dbus]: "
- "error occurred when removing network %d",
- ssid->id);
- return;
- }
-
- if (ssid == wpa_s->current_ssid)
- wpa_supplicant_deauthenticate(wpa_s,
- WLAN_REASON_DEAUTH_LEAVING);
-}
-
-
-/**
- * wpas_dbus_handler_remove_all_networks - Remove all configured networks
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL on success or dbus error on failure
- *
- * Handler function for "RemoveAllNetworks" method call of a network interface.
- */
-DBusMessage * wpas_dbus_handler_remove_all_networks(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- /* NB: could check for failure and return an error */
- wpa_config_foreach_network(wpa_s->conf, remove_network, wpa_s);
- return NULL;
-}
-
-
-/**
- * wpas_dbus_handler_select_network - Attempt association with a network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL on success or dbus error on failure
- *
- * Handler function for "SelectNetwork" method call of network interface.
- */
-DBusMessage * wpas_dbus_handler_select_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- const char *op;
- char *iface = NULL, *net_id = NULL;
- int id;
- struct wpa_ssid *ssid;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &op,
- DBUS_TYPE_INVALID);
-
- /* Extract the network ID and ensure the network */
- /* is actually a child of this interface */
- iface = wpas_dbus_new_decompose_object_path(op, 0, &net_id, NULL);
- if (iface == NULL || net_id == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
- reply = wpas_dbus_error_invalid_args(message, op);
- goto out;
- }
-
- errno = 0;
- id = strtoul(net_id, NULL, 10);
- if (errno != 0) {
- reply = wpas_dbus_error_invalid_args(message, op);
- goto out;
- }
-
- ssid = wpa_config_get_network(wpa_s->conf, id);
- if (ssid == NULL) {
- reply = wpas_dbus_error_network_unknown(message);
- goto out;
- }
-
- /* Finally, associate with the network */
- wpa_supplicant_select_network(wpa_s, ssid);
-
-out:
- os_free(iface);
- os_free(net_id);
- return reply;
-}
-
-
-/**
- * wpas_dbus_handler_network_reply - Reply to a NetworkRequest signal
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL on success or dbus error on failure
- *
- * Handler function for "NetworkReply" method call of network interface.
- */
-DBusMessage * wpas_dbus_handler_network_reply(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
-#ifdef IEEE8021X_EAPOL
- DBusMessage *reply = NULL;
- const char *op, *field, *value;
- char *iface = NULL, *net_id = NULL;
- int id;
- struct wpa_ssid *ssid;
-
- if (!dbus_message_get_args(message, NULL,
- DBUS_TYPE_OBJECT_PATH, &op,
- DBUS_TYPE_STRING, &field,
- DBUS_TYPE_STRING, &value,
- DBUS_TYPE_INVALID))
- return wpas_dbus_error_invalid_args(message, NULL);
-
- /* Extract the network ID and ensure the network */
- /* is actually a child of this interface */
- iface = wpas_dbus_new_decompose_object_path(op, 0, &net_id, NULL);
- if (iface == NULL || net_id == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
- reply = wpas_dbus_error_invalid_args(message, op);
- goto out;
- }
-
- errno = 0;
- id = strtoul(net_id, NULL, 10);
- if (errno != 0) {
- reply = wpas_dbus_error_invalid_args(message, net_id);
- goto out;
- }
-
- ssid = wpa_config_get_network(wpa_s->conf, id);
- if (ssid == NULL) {
- reply = wpas_dbus_error_network_unknown(message);
- goto out;
- }
-
- if (wpa_supplicant_ctrl_iface_ctrl_rsp_handle(wpa_s, ssid,
- field, value) < 0)
- reply = wpas_dbus_error_invalid_args(message, field);
- else {
- /* Tell EAP to retry immediately */
- eapol_sm_notify_ctrl_response(wpa_s->eapol);
- }
-
-out:
- os_free(iface);
- os_free(net_id);
- return reply;
-#else /* IEEE8021X_EAPOL */
- wpa_printf(MSG_DEBUG, "CTRL_IFACE: 802.1X not included");
- return wpas_dbus_error_unknown_error(message, "802.1X not included");
-#endif /* IEEE8021X_EAPOL */
-}
-
-
-/**
- * wpas_dbus_handler_add_blob - Store named binary blob (ie, for certificates)
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: A dbus message containing an error on failure or NULL on success
- *
- * Asks wpa_supplicant to internally store a binary blobs.
- */
-DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- DBusMessageIter iter, array_iter;
-
- char *blob_name;
- u8 *blob_data;
- int blob_len;
- struct wpa_config_blob *blob = NULL;
-
- dbus_message_iter_init(message, &iter);
- dbus_message_iter_get_basic(&iter, &blob_name);
-
- if (wpa_config_get_blob(wpa_s->conf, blob_name)) {
- return dbus_message_new_error(message,
- WPAS_DBUS_ERROR_BLOB_EXISTS,
- NULL);
- }
-
- dbus_message_iter_next(&iter);
- dbus_message_iter_recurse(&iter, &array_iter);
-
- dbus_message_iter_get_fixed_array(&array_iter, &blob_data, &blob_len);
-
- blob = os_zalloc(sizeof(*blob));
- if (!blob) {
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto err;
- }
-
- blob->data = os_malloc(blob_len);
- if (!blob->data) {
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto err;
- }
- os_memcpy(blob->data, blob_data, blob_len);
-
- blob->len = blob_len;
- blob->name = os_strdup(blob_name);
- if (!blob->name) {
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto err;
- }
-
- wpa_config_set_blob(wpa_s->conf, blob);
- wpas_notify_blob_added(wpa_s, blob->name);
-
- return reply;
-
-err:
- if (blob) {
- os_free(blob->name);
- os_free(blob->data);
- os_free(blob);
- }
- return reply;
-}
-
-
-/**
- * wpas_dbus_handler_get_blob - Get named binary blob (ie, for certificates)
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: A dbus message containing array of bytes (blob)
- *
- * Gets one wpa_supplicant's binary blobs.
- */
-DBusMessage * wpas_dbus_handler_get_blob(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- DBusMessageIter iter, array_iter;
-
- char *blob_name;
- const struct wpa_config_blob *blob;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &blob_name,
- DBUS_TYPE_INVALID);
-
- blob = wpa_config_get_blob(wpa_s->conf, blob_name);
- if (!blob) {
- return dbus_message_new_error(message,
- WPAS_DBUS_ERROR_BLOB_UNKNOWN,
- "Blob id not set");
- }
-
- reply = dbus_message_new_method_return(message);
- if (!reply) {
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto out;
- }
-
- dbus_message_iter_init_append(reply, &iter);
-
- if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_BYTE_AS_STRING,
- &array_iter)) {
- dbus_message_unref(reply);
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto out;
- }
-
- if (!dbus_message_iter_append_fixed_array(&array_iter, DBUS_TYPE_BYTE,
- &(blob->data), blob->len)) {
- dbus_message_unref(reply);
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto out;
- }
-
- if (!dbus_message_iter_close_container(&iter, &array_iter)) {
- dbus_message_unref(reply);
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto out;
- }
-
-out:
- return reply;
-}
-
-
-/**
- * wpas_remove_handler_remove_blob - Remove named binary blob
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: NULL on success or dbus error
- *
- * Asks wpa_supplicant to internally remove a binary blobs.
- */
-DBusMessage * wpas_dbus_handler_remove_blob(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- char *blob_name;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &blob_name,
- DBUS_TYPE_INVALID);
-
- if (wpa_config_remove_blob(wpa_s->conf, blob_name)) {
- return dbus_message_new_error(message,
- WPAS_DBUS_ERROR_BLOB_UNKNOWN,
- "Blob id not set");
- }
- wpas_notify_blob_removed(wpa_s, blob_name);
-
- return reply;
-
-}
-
-/*
- * wpas_dbus_handler_flush_bss - Flush the BSS cache
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL
- *
- * Handler function for "FlushBSS" method call of network interface.
- */
-DBusMessage * wpas_dbus_handler_flush_bss(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- dbus_uint32_t age;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_UINT32, &age,
- DBUS_TYPE_INVALID);
-
- if (age == 0)
- wpa_bss_flush(wpa_s);
- else
- wpa_bss_flush_by_age(wpa_s, age);
-
- return NULL;
-}
-
-
-#ifdef CONFIG_AUTOSCAN
-/**
- * wpas_dbus_handler_autoscan - Set autoscan parameters for the interface
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL
- *
- * Handler function for "AutoScan" method call of network interface.
- */
-DBusMessage * wpas_dbus_handler_autoscan(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- enum wpa_states state = wpa_s->wpa_state;
- char *arg;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg,
- DBUS_TYPE_INVALID);
-
- if (arg != NULL && os_strlen(arg) > 0) {
- char *tmp;
- tmp = os_strdup(arg);
- if (tmp == NULL) {
- reply = dbus_message_new_error(message,
- DBUS_ERROR_NO_MEMORY,
- NULL);
- } else {
- os_free(wpa_s->conf->autoscan);
- wpa_s->conf->autoscan = tmp;
- if (state == WPA_DISCONNECTED || state == WPA_INACTIVE)
- autoscan_init(wpa_s, 1);
- else if (state == WPA_SCANNING)
- wpa_supplicant_reinit_autoscan(wpa_s);
- }
- } else if (arg != NULL && os_strlen(arg) == 0) {
- os_free(wpa_s->conf->autoscan);
- wpa_s->conf->autoscan = NULL;
- autoscan_deinit(wpa_s);
- } else
- reply = dbus_message_new_error(message,
- DBUS_ERROR_INVALID_ARGS,
- NULL);
-
- return reply;
-}
-#endif /* CONFIG_AUTOSCAN */
-
-
-/**
- * wpas_dbus_getter_capabilities - Return interface capabilities
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Capabilities" property of an interface.
- */
-dbus_bool_t wpas_dbus_getter_capabilities(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- struct wpa_driver_capa capa;
- int res;
- DBusMessageIter iter_dict, iter_dict_entry, iter_dict_val, iter_array,
- variant_iter;
- const char *scans[] = { "active", "passive", "ssid" };
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- "a{sv}", &variant_iter))
- goto nomem;
-
- if (!wpa_dbus_dict_open_write(&variant_iter, &iter_dict))
- goto nomem;
-
- res = wpa_drv_get_capa(wpa_s, &capa);
-
- /***** pairwise cipher */
- if (res < 0) {
- const char *args[] = {"ccmp", "tkip", "none"};
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "Pairwise", args,
- sizeof(args) / sizeof(char*)))
- goto nomem;
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "Pairwise",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_CCMP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "ccmp"))
- goto nomem;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_GCMP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "gcmp"))
- goto nomem;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_TKIP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "tkip"))
- goto nomem;
- }
-
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "none"))
- goto nomem;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
- }
-
- /***** group cipher */
- if (res < 0) {
- const char *args[] = {
- "ccmp", "tkip", "wep104", "wep40"
- };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "Group", args,
- sizeof(args) / sizeof(char*)))
- goto nomem;
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "Group",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_CCMP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "ccmp"))
- goto nomem;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_GCMP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "gcmp"))
- goto nomem;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_TKIP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "tkip"))
- goto nomem;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_WEP104) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wep104"))
- goto nomem;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_WEP40) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wep40"))
- goto nomem;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
- }
-
- /***** key management */
- if (res < 0) {
- const char *args[] = {
- "wpa-psk", "wpa-eap", "ieee8021x", "wpa-none",
-#ifdef CONFIG_WPS
- "wps",
-#endif /* CONFIG_WPS */
- "none"
- };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "KeyMgmt", args,
- sizeof(args) / sizeof(char*)))
- goto nomem;
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "KeyMgmt",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
-
- if (!wpa_dbus_dict_string_array_add_element(&iter_array,
- "none"))
- goto nomem;
-
- if (!wpa_dbus_dict_string_array_add_element(&iter_array,
- "ieee8021x"))
- goto nomem;
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA2)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa-eap"))
- goto nomem;
-
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FT)
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa-ft-eap"))
- goto nomem;
-
-/* TODO: Ensure that driver actually supports sha256 encryption. */
-#ifdef CONFIG_IEEE80211W
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa-eap-sha256"))
- goto nomem;
-#endif /* CONFIG_IEEE80211W */
- }
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa-psk"))
- goto nomem;
-
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK)
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa-ft-psk"))
- goto nomem;
-
-/* TODO: Ensure that driver actually supports sha256 encryption. */
-#ifdef CONFIG_IEEE80211W
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa-psk-sha256"))
- goto nomem;
-#endif /* CONFIG_IEEE80211W */
- }
-
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa-none"))
- goto nomem;
- }
-
-
-#ifdef CONFIG_WPS
- if (!wpa_dbus_dict_string_array_add_element(&iter_array,
- "wps"))
- goto nomem;
-#endif /* CONFIG_WPS */
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
- }
-
- /***** WPA protocol */
- if (res < 0) {
- const char *args[] = { "rsn", "wpa" };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "Protocol", args,
- sizeof(args) / sizeof(char*)))
- goto nomem;
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "Protocol",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA2 |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "rsn"))
- goto nomem;
- }
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "wpa"))
- goto nomem;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
- }
-
- /***** auth alg */
- if (res < 0) {
- const char *args[] = { "open", "shared", "leap" };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "AuthAlg", args,
- sizeof(args) / sizeof(char*)))
- goto nomem;
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "AuthAlg",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
-
- if (capa.auth & (WPA_DRIVER_AUTH_OPEN)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "open"))
- goto nomem;
- }
-
- if (capa.auth & (WPA_DRIVER_AUTH_SHARED)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "shared"))
- goto nomem;
- }
-
- if (capa.auth & (WPA_DRIVER_AUTH_LEAP)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "leap"))
- goto nomem;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
- }
-
- /***** Scan */
- if (!wpa_dbus_dict_append_string_array(&iter_dict, "Scan", scans,
- sizeof(scans) / sizeof(char *)))
- goto nomem;
-
- /***** Modes */
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "Modes",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
-
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "infrastructure"))
- goto nomem;
-
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "ad-hoc"))
- goto nomem;
-
- if (res >= 0) {
- if (capa.flags & (WPA_DRIVER_FLAGS_AP)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "ap"))
- goto nomem;
- }
-
- if (capa.flags & (WPA_DRIVER_FLAGS_P2P_CAPABLE)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "p2p"))
- goto nomem;
- }
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto nomem;
- /***** Modes end */
-
- if (res >= 0) {
- dbus_int32_t max_scan_ssid = capa.max_scan_ssids;
-
- if (!wpa_dbus_dict_append_int32(&iter_dict, "MaxScanSSID",
- max_scan_ssid))
- goto nomem;
- }
-
- if (!wpa_dbus_dict_close_write(&variant_iter, &iter_dict))
- goto nomem;
- if (!dbus_message_iter_close_container(iter, &variant_iter))
- goto nomem;
-
- return TRUE;
-
-nomem:
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
-}
-
-
-/**
- * wpas_dbus_getter_state - Get interface state
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "State" property.
- */
-dbus_bool_t wpas_dbus_getter_state(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- const char *str_state;
- char *state_ls, *tmp;
- dbus_bool_t success = FALSE;
-
- str_state = wpa_supplicant_state_txt(wpa_s->wpa_state);
-
- /* make state string lowercase to fit new DBus API convention
- */
- state_ls = tmp = os_strdup(str_state);
- if (!tmp) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
- while (*tmp) {
- *tmp = tolower(*tmp);
- tmp++;
- }
-
- success = wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &state_ls, error);
-
- os_free(state_ls);
-
- return success;
-}
-
-
-/**
- * wpas_dbus_new_iface_get_scanning - Get interface scanning state
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "scanning" property.
- */
-dbus_bool_t wpas_dbus_getter_scanning(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
- &scanning, error);
-}
-
-
-/**
- * wpas_dbus_getter_ap_scan - Control roaming mode
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter function for "ApScan" property.
- */
-dbus_bool_t wpas_dbus_getter_ap_scan(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_uint32_t ap_scan = wpa_s->conf->ap_scan;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT32,
- &ap_scan, error);
-}
-
-
-/**
- * wpas_dbus_setter_ap_scan - Control roaming mode
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter function for "ApScan" property.
- */
-dbus_bool_t wpas_dbus_setter_ap_scan(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_uint32_t ap_scan;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_UINT32,
- &ap_scan))
- return FALSE;
-
- if (wpa_supplicant_set_ap_scan(wpa_s, ap_scan)) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "ap_scan must be 0, 1, or 2");
- return FALSE;
- }
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_fast_reauth - Control fast
- * reauthentication (TLS session resumption)
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter function for "FastReauth" property.
- */
-dbus_bool_t wpas_dbus_getter_fast_reauth(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_bool_t fast_reauth = wpa_s->conf->fast_reauth ? TRUE : FALSE;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
- &fast_reauth, error);
-}
-
-
-/**
- * wpas_dbus_setter_fast_reauth - Control fast
- * reauthentication (TLS session resumption)
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter function for "FastReauth" property.
- */
-dbus_bool_t wpas_dbus_setter_fast_reauth(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_bool_t fast_reauth;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
- &fast_reauth))
- return FALSE;
-
- wpa_s->conf->fast_reauth = fast_reauth;
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_disconnect_reason - Get most recent reason for disconnect
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "DisconnectReason" property. The reason is negative if it is
- * locally generated.
- */
-dbus_bool_t wpas_dbus_getter_disconnect_reason(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_int32_t reason = wpa_s->disconnect_reason;
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT32,
- &reason, error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_expire_age - Get BSS entry expiration age
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter function for "BSSExpireAge" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_expire_age(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_uint32_t expire_age = wpa_s->conf->bss_expiration_age;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT32,
- &expire_age, error);
-}
-
-
-/**
- * wpas_dbus_setter_bss_expire_age - Control BSS entry expiration age
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter function for "BSSExpireAge" property.
- */
-dbus_bool_t wpas_dbus_setter_bss_expire_age(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_uint32_t expire_age;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_UINT32,
- &expire_age))
- return FALSE;
-
- if (wpa_supplicant_set_bss_expiration_age(wpa_s, expire_age)) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "BSSExpireAge must be >= 10");
- return FALSE;
- }
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_bss_expire_count - Get BSS entry expiration scan count
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter function for "BSSExpireCount" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_expire_count(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_uint32_t expire_count = wpa_s->conf->bss_expiration_scan_count;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT32,
- &expire_count, error);
-}
-
-
-/**
- * wpas_dbus_setter_bss_expire_count - Control BSS entry expiration scan count
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter function for "BSSExpireCount" property.
- */
-dbus_bool_t wpas_dbus_setter_bss_expire_count(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_uint32_t expire_count;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_UINT32,
- &expire_count))
- return FALSE;
-
- if (wpa_supplicant_set_bss_expiration_count(wpa_s, expire_count)) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "BSSExpireCount must be > 0");
- return FALSE;
- }
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_country - Control country code
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter function for "Country" property.
- */
-dbus_bool_t wpas_dbus_getter_country(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- char country[3];
- char *str = country;
-
- country[0] = wpa_s->conf->country[0];
- country[1] = wpa_s->conf->country[1];
- country[2] = '\0';
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &str, error);
-}
-
-
-/**
- * wpas_dbus_setter_country - Control country code
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter function for "Country" property.
- */
-dbus_bool_t wpas_dbus_setter_country(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- const char *country;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_STRING,
- &country))
- return FALSE;
-
- if (!country[0] || !country[1]) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "invalid country code");
- return FALSE;
- }
-
- if (wpa_s->drv_priv != NULL && wpa_drv_set_country(wpa_s, country)) {
- wpa_printf(MSG_DEBUG, "Failed to set country");
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "failed to set country code");
- return FALSE;
- }
-
- wpa_s->conf->country[0] = country[0];
- wpa_s->conf->country[1] = country[1];
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_scan_interval - Get scan interval
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter function for "ScanInterval" property.
- */
-dbus_bool_t wpas_dbus_getter_scan_interval(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_int32_t scan_interval = wpa_s->scan_interval;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT32,
- &scan_interval, error);
-}
-
-
-/**
- * wpas_dbus_setter_scan_interval - Control scan interval
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter function for "ScanInterval" property.
- */
-dbus_bool_t wpas_dbus_setter_scan_interval(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_int32_t scan_interval;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_INT32,
- &scan_interval))
- return FALSE;
-
- if (wpa_supplicant_set_scan_interval(wpa_s, scan_interval)) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "scan_interval must be >= 0");
- return FALSE;
- }
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_ifname - Get interface name
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Ifname" property.
- */
-dbus_bool_t wpas_dbus_getter_ifname(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- const char *ifname = wpa_s->ifname;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &ifname, error);
-}
-
-
-/**
- * wpas_dbus_getter_driver - Get interface name
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Driver" property.
- */
-dbus_bool_t wpas_dbus_getter_driver(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- const char *driver;
-
- if (wpa_s->driver == NULL || wpa_s->driver->name == NULL) {
- wpa_printf(MSG_DEBUG, "wpas_dbus_getter_driver[dbus]: "
- "wpa_s has no driver set");
- dbus_set_error(error, DBUS_ERROR_FAILED, "%s: no driver set",
- __func__);
- return FALSE;
- }
-
- driver = wpa_s->driver->name;
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &driver, error);
-}
-
-
-/**
- * wpas_dbus_getter_current_bss - Get current bss object path
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "CurrentBSS" property.
- */
-dbus_bool_t wpas_dbus_getter_current_bss(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *bss_obj_path = path_buf;
-
- if (wpa_s->current_bss)
- os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
- wpa_s->dbus_new_path, wpa_s->current_bss->id);
- else
- os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
- &bss_obj_path, error);
-}
-
-
-/**
- * wpas_dbus_getter_current_network - Get current network object path
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "CurrentNetwork" property.
- */
-dbus_bool_t wpas_dbus_getter_current_network(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *net_obj_path = path_buf;
-
- if (wpa_s->current_ssid)
- os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
- wpa_s->dbus_new_path, wpa_s->current_ssid->id);
- else
- os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
- &net_obj_path, error);
-}
-
-
-/**
- * wpas_dbus_getter_current_auth_mode - Get current authentication type
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "CurrentAuthMode" property.
- */
-dbus_bool_t wpas_dbus_getter_current_auth_mode(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- const char *eap_mode;
- const char *auth_mode;
- char eap_mode_buf[WPAS_DBUS_AUTH_MODE_MAX];
-
- if (wpa_s->wpa_state != WPA_COMPLETED) {
- auth_mode = "INACTIVE";
- } else if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X ||
- wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
- eap_mode = wpa_supplicant_get_eap_mode(wpa_s);
- os_snprintf(eap_mode_buf, WPAS_DBUS_AUTH_MODE_MAX,
- "EAP-%s", eap_mode);
- auth_mode = eap_mode_buf;
-
- } else {
- auth_mode = wpa_key_mgmt_txt(wpa_s->key_mgmt,
- wpa_s->current_ssid->proto);
- }
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &auth_mode, error);
-}
-
-
-/**
- * wpas_dbus_getter_bridge_ifname - Get interface name
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "BridgeIfname" property.
- */
-dbus_bool_t wpas_dbus_getter_bridge_ifname(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- const char *bridge_ifname = wpa_s->bridge_ifname;
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &bridge_ifname, error);
-}
-
-
-/**
- * wpas_dbus_getter_bsss - Get array of BSSs objects
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "BSSs" property.
- */
-dbus_bool_t wpas_dbus_getter_bsss(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- struct wpa_bss *bss;
- char **paths;
- unsigned int i = 0;
- dbus_bool_t success = FALSE;
-
- paths = os_calloc(wpa_s->num_bss, sizeof(char *));
- if (!paths) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- /* Loop through scan results and append each result's object path */
- dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
- paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- if (paths[i] == NULL) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY,
- "no memory");
- goto out;
- }
- /* Construct the object path for this BSS. */
- os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
- wpa_s->dbus_new_path, bss->id);
- }
-
- success = wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_OBJECT_PATH,
- paths, wpa_s->num_bss,
- error);
-
-out:
- while (i)
- os_free(paths[--i]);
- os_free(paths);
- return success;
-}
-
-
-/**
- * wpas_dbus_getter_networks - Get array of networks objects
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Networks" property.
- */
-dbus_bool_t wpas_dbus_getter_networks(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- struct wpa_ssid *ssid;
- char **paths;
- unsigned int i = 0, num = 0;
- dbus_bool_t success = FALSE;
-
- if (wpa_s->conf == NULL) {
- wpa_printf(MSG_ERROR, "%s[dbus]: An error occurred getting "
- "networks list.", __func__);
- dbus_set_error(error, DBUS_ERROR_FAILED, "%s: an error "
- "occurred getting the networks list", __func__);
- return FALSE;
- }
-
- for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
- if (!network_is_persistent_group(ssid))
- num++;
-
- paths = os_calloc(num, sizeof(char *));
- if (!paths) {
- dbus_set_error(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- /* Loop through configured networks and append object path of each */
- for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
- if (network_is_persistent_group(ssid))
- continue;
- paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- if (paths[i] == NULL) {
- dbus_set_error(error, DBUS_ERROR_NO_MEMORY, "no memory");
- goto out;
- }
-
- /* Construct the object path for this network. */
- os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
- wpa_s->dbus_new_path, ssid->id);
- }
-
- success = wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_OBJECT_PATH,
- paths, num, error);
-
-out:
- while (i)
- os_free(paths[--i]);
- os_free(paths);
- return success;
-}
-
-
-/**
- * wpas_dbus_getter_blobs - Get all blobs defined for this interface
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Blobs" property.
- */
-dbus_bool_t wpas_dbus_getter_blobs(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- DBusMessageIter variant_iter, dict_iter, entry_iter, array_iter;
- struct wpa_config_blob *blob;
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- "a{say}", &variant_iter) ||
- !dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
- "{say}", &dict_iter)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- blob = wpa_s->conf->blobs;
- while (blob) {
- if (!dbus_message_iter_open_container(&dict_iter,
- DBUS_TYPE_DICT_ENTRY,
- NULL, &entry_iter) ||
- !dbus_message_iter_append_basic(&entry_iter,
- DBUS_TYPE_STRING,
- &(blob->name)) ||
- !dbus_message_iter_open_container(&entry_iter,
- DBUS_TYPE_ARRAY,
- DBUS_TYPE_BYTE_AS_STRING,
- &array_iter) ||
- !dbus_message_iter_append_fixed_array(&array_iter,
- DBUS_TYPE_BYTE,
- &(blob->data),
- blob->len) ||
- !dbus_message_iter_close_container(&entry_iter,
- &array_iter) ||
- !dbus_message_iter_close_container(&dict_iter,
- &entry_iter)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY,
- "no memory");
- return FALSE;
- }
-
- blob = blob->next;
- }
-
- if (!dbus_message_iter_close_container(&variant_iter, &dict_iter) ||
- !dbus_message_iter_close_container(iter, &variant_iter)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static struct wpa_bss * get_bss_helper(struct bss_handler_args *args,
- DBusError *error, const char *func_name)
-{
- struct wpa_bss *res = wpa_bss_get_id(args->wpa_s, args->id);
-
- if (!res) {
- wpa_printf(MSG_ERROR, "%s[dbus]: no bss with id %d found",
- func_name, args->id);
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: BSS %d not found",
- func_name, args->id);
- }
-
- return res;
-}
-
-
-/**
- * wpas_dbus_getter_bss_bssid - Return the BSSID of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "BSSID" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_bssid(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
- res->bssid, ETH_ALEN,
- error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_ssid - Return the SSID of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "SSID" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_ssid(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
- res->ssid, res->ssid_len,
- error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_privacy - Return the privacy flag of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Privacy" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_privacy(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
- dbus_bool_t privacy;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- privacy = (res->caps & IEEE80211_CAP_PRIVACY) ? TRUE : FALSE;
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
- &privacy, error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_mode - Return the mode of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Mode" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_mode(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
- const char *mode;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- if (res->caps & IEEE80211_CAP_IBSS)
- mode = "ad-hoc";
- else
- mode = "infrastructure";
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &mode, error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_level - Return the signal strength of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Level" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_signal(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
- s16 level;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- level = (s16) res->level;
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT16,
- &level, error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_frequency - Return the frequency of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Frequency" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_frequency(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
- u16 freq;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- freq = (u16) res->freq;
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
- &freq, error);
-}
-
-
-static int cmp_u8s_desc(const void *a, const void *b)
-{
- return (*(u8 *) b - *(u8 *) a);
-}
-
-
-/**
- * wpas_dbus_getter_bss_rates - Return available bit rates of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Rates" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_rates(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
- u8 *ie_rates = NULL;
- u32 *real_rates;
- int rates_num, i;
- dbus_bool_t success = FALSE;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- rates_num = wpa_bss_get_bit_rates(res, &ie_rates);
- if (rates_num < 0)
- return FALSE;
-
- qsort(ie_rates, rates_num, 1, cmp_u8s_desc);
-
- real_rates = os_malloc(sizeof(u32) * rates_num);
- if (!real_rates) {
- os_free(ie_rates);
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- for (i = 0; i < rates_num; i++)
- real_rates[i] = ie_rates[i] * 500000;
-
- success = wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_UINT32,
- real_rates, rates_num,
- error);
-
- os_free(ie_rates);
- os_free(real_rates);
- return success;
-}
-
-
-static dbus_bool_t wpas_dbus_get_bss_security_prop(DBusMessageIter *iter,
- struct wpa_ie_data *ie_data,
- DBusError *error)
-{
- DBusMessageIter iter_dict, variant_iter;
- const char *group;
- const char *pairwise[3]; /* max 3 pairwise ciphers is supported */
- const char *key_mgmt[7]; /* max 7 key managements may be supported */
- int n;
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- "a{sv}", &variant_iter))
- goto nomem;
-
- if (!wpa_dbus_dict_open_write(&variant_iter, &iter_dict))
- goto nomem;
-
- /* KeyMgmt */
- n = 0;
- if (ie_data->key_mgmt & WPA_KEY_MGMT_PSK)
- key_mgmt[n++] = "wpa-psk";
- if (ie_data->key_mgmt & WPA_KEY_MGMT_FT_PSK)
- key_mgmt[n++] = "wpa-ft-psk";
- if (ie_data->key_mgmt & WPA_KEY_MGMT_PSK_SHA256)
- key_mgmt[n++] = "wpa-psk-sha256";
- if (ie_data->key_mgmt & WPA_KEY_MGMT_IEEE8021X)
- key_mgmt[n++] = "wpa-eap";
- if (ie_data->key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X)
- key_mgmt[n++] = "wpa-ft-eap";
- if (ie_data->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA256)
- key_mgmt[n++] = "wpa-eap-sha256";
- if (ie_data->key_mgmt & WPA_KEY_MGMT_NONE)
- key_mgmt[n++] = "wpa-none";
-
- if (!wpa_dbus_dict_append_string_array(&iter_dict, "KeyMgmt",
- key_mgmt, n))
- goto nomem;
-
- /* Group */
- switch (ie_data->group_cipher) {
- case WPA_CIPHER_WEP40:
- group = "wep40";
- break;
- case WPA_CIPHER_TKIP:
- group = "tkip";
- break;
- case WPA_CIPHER_CCMP:
- group = "ccmp";
- break;
- case WPA_CIPHER_GCMP:
- group = "gcmp";
- break;
- case WPA_CIPHER_WEP104:
- group = "wep104";
- break;
- default:
- group = "";
- break;
- }
-
- if (!wpa_dbus_dict_append_string(&iter_dict, "Group", group))
- goto nomem;
-
- /* Pairwise */
- n = 0;
- if (ie_data->pairwise_cipher & WPA_CIPHER_TKIP)
- pairwise[n++] = "tkip";
- if (ie_data->pairwise_cipher & WPA_CIPHER_CCMP)
- pairwise[n++] = "ccmp";
- if (ie_data->pairwise_cipher & WPA_CIPHER_GCMP)
- pairwise[n++] = "gcmp";
-
- if (!wpa_dbus_dict_append_string_array(&iter_dict, "Pairwise",
- pairwise, n))
- goto nomem;
-
- /* Management group (RSN only) */
- if (ie_data->proto == WPA_PROTO_RSN) {
- switch (ie_data->mgmt_group_cipher) {
-#ifdef CONFIG_IEEE80211W
- case WPA_CIPHER_AES_128_CMAC:
- group = "aes128cmac";
- break;
-#endif /* CONFIG_IEEE80211W */
- default:
- group = "";
- break;
- }
-
- if (!wpa_dbus_dict_append_string(&iter_dict, "MgmtGroup",
- group))
- goto nomem;
- }
-
- if (!wpa_dbus_dict_close_write(&variant_iter, &iter_dict))
- goto nomem;
- if (!dbus_message_iter_close_container(iter, &variant_iter))
- goto nomem;
-
- return TRUE;
-
-nomem:
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
-}
-
-
-/**
- * wpas_dbus_getter_bss_wpa - Return the WPA options of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "WPA" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_wpa(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
- struct wpa_ie_data wpa_data;
- const u8 *ie;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- os_memset(&wpa_data, 0, sizeof(wpa_data));
- ie = wpa_bss_get_vendor_ie(res, WPA_IE_VENDOR_TYPE);
- if (ie) {
- if (wpa_parse_wpa_ie(ie, 2 + ie[1], &wpa_data) < 0) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "failed to parse WPA IE");
- return FALSE;
- }
- }
-
- return wpas_dbus_get_bss_security_prop(iter, &wpa_data, error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_rsn - Return the RSN options of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "RSN" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_rsn(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
- struct wpa_ie_data wpa_data;
- const u8 *ie;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- os_memset(&wpa_data, 0, sizeof(wpa_data));
- ie = wpa_bss_get_ie(res, WLAN_EID_RSN);
- if (ie) {
- if (wpa_parse_wpa_ie(ie, 2 + ie[1], &wpa_data) < 0) {
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "failed to parse RSN IE");
- return FALSE;
- }
- }
-
- return wpas_dbus_get_bss_security_prop(iter, &wpa_data, error);
-}
-
-
-/**
- * wpas_dbus_getter_bss_wps - Return the WPS options of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "WPS" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_wps(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
-#ifdef CONFIG_WPS
- struct wpabuf *wps_ie;
-#endif /* CONFIG_WPS */
- DBusMessageIter iter_dict, variant_iter;
- const char *type = "";
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- "a{sv}", &variant_iter))
- goto nomem;
-
- if (!wpa_dbus_dict_open_write(&variant_iter, &iter_dict))
- goto nomem;
-
-#ifdef CONFIG_WPS
- wps_ie = wpa_bss_get_vendor_ie_multi(res, WPS_IE_VENDOR_TYPE);
- if (wps_ie) {
- if (wps_is_selected_pbc_registrar(wps_ie))
- type = "pbc";
- else if (wps_is_selected_pin_registrar(wps_ie))
- type = "pin";
- }
-#endif /* CONFIG_WPS */
-
- if (!wpa_dbus_dict_append_string(&iter_dict, "Type", type))
- goto nomem;
-
- if (!wpa_dbus_dict_close_write(&variant_iter, &iter_dict))
- goto nomem;
- if (!dbus_message_iter_close_container(iter, &variant_iter))
- goto nomem;
-
- return TRUE;
-
-nomem:
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
-}
-
-
-/**
- * wpas_dbus_getter_bss_ies - Return all IEs of a BSS
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "IEs" property.
- */
-dbus_bool_t wpas_dbus_getter_bss_ies(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct bss_handler_args *args = user_data;
- struct wpa_bss *res;
-
- res = get_bss_helper(args, error, __func__);
- if (!res)
- return FALSE;
-
- return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
- res + 1, res->ie_len,
- error);
-}
-
-
-/**
- * wpas_dbus_getter_enabled - Check whether network is enabled or disabled
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "enabled" property of a configured network.
- */
-dbus_bool_t wpas_dbus_getter_enabled(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct network_handler_args *net = user_data;
- dbus_bool_t enabled = net->ssid->disabled ? FALSE : TRUE;
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
- &enabled, error);
-}
-
-
-/**
- * wpas_dbus_setter_enabled - Mark a configured network as enabled or disabled
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter for "Enabled" property of a configured network.
- */
-dbus_bool_t wpas_dbus_setter_enabled(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct network_handler_args *net = user_data;
- struct wpa_supplicant *wpa_s;
- struct wpa_ssid *ssid;
- dbus_bool_t enable;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
- &enable))
- return FALSE;
-
- wpa_s = net->wpa_s;
- ssid = net->ssid;
-
- if (enable)
- wpa_supplicant_enable_network(wpa_s, ssid);
- else
- wpa_supplicant_disable_network(wpa_s, ssid);
-
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_getter_network_properties - Get options for a configured network
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Properties" property of a configured network.
- */
-dbus_bool_t wpas_dbus_getter_network_properties(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct network_handler_args *net = user_data;
- DBusMessageIter variant_iter, dict_iter;
- char **iterator;
- char **props = wpa_config_get_all(net->ssid, 1);
- dbus_bool_t success = FALSE;
-
- if (!props) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, "a{sv}",
- &variant_iter) ||
- !wpa_dbus_dict_open_write(&variant_iter, &dict_iter)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- goto out;
- }
-
- iterator = props;
- while (*iterator) {
- if (!wpa_dbus_dict_append_string(&dict_iter, *iterator,
- *(iterator + 1))) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY,
- "no memory");
- goto out;
- }
- iterator += 2;
- }
-
-
- if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
- !dbus_message_iter_close_container(iter, &variant_iter)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- goto out;
- }
-
- success = TRUE;
-
-out:
- iterator = props;
- while (*iterator) {
- os_free(*iterator);
- iterator++;
- }
- os_free(props);
- return success;
-}
-
-
-/**
- * wpas_dbus_setter_network_properties - Set options for a configured network
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter for "Properties" property of a configured network.
- */
-dbus_bool_t wpas_dbus_setter_network_properties(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct network_handler_args *net = user_data;
- struct wpa_ssid *ssid = net->ssid;
- DBusMessageIter variant_iter;
-
- dbus_message_iter_recurse(iter, &variant_iter);
- return set_network_properties(net->wpa_s, ssid, &variant_iter, error);
-}
-
-
-#ifdef CONFIG_AP
-
-DBusMessage * wpas_dbus_handler_subscribe_preq(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- struct wpas_dbus_priv *priv = wpa_s->global->dbus;
- char *name;
-
- if (wpa_s->preq_notify_peer != NULL) {
- if (os_strcmp(dbus_message_get_sender(message),
- wpa_s->preq_notify_peer) == 0)
- return NULL;
-
- return dbus_message_new_error(message,
- WPAS_DBUS_ERROR_SUBSCRIPTION_IN_USE,
- "Another application is already subscribed");
- }
-
- name = os_strdup(dbus_message_get_sender(message));
- if (!name)
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- "out of memory");
-
- wpa_s->preq_notify_peer = name;
-
- /* Subscribe to clean up if application closes socket */
- wpas_dbus_subscribe_noc(priv);
-
- /*
- * Double-check it's still alive to make sure that we didn't
- * miss the NameOwnerChanged signal, e.g. while strdup'ing.
- */
- if (!dbus_bus_name_has_owner(priv->con, name, NULL)) {
- /*
- * Application no longer exists, clean up.
- * The return value is irrelevant now.
- *
- * Need to check if the NameOwnerChanged handling
- * already cleaned up because we have processed
- * DBus messages while checking if the name still
- * has an owner.
- */
- if (!wpa_s->preq_notify_peer)
- return NULL;
- os_free(wpa_s->preq_notify_peer);
- wpa_s->preq_notify_peer = NULL;
- wpas_dbus_unsubscribe_noc(priv);
- }
-
- return NULL;
-}
-
-
-DBusMessage * wpas_dbus_handler_unsubscribe_preq(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- struct wpas_dbus_priv *priv = wpa_s->global->dbus;
-
- if (!wpa_s->preq_notify_peer)
- return dbus_message_new_error(message,
- WPAS_DBUS_ERROR_NO_SUBSCRIPTION,
- "Not subscribed");
-
- if (os_strcmp(wpa_s->preq_notify_peer,
- dbus_message_get_sender(message)))
- return dbus_message_new_error(message,
- WPAS_DBUS_ERROR_SUBSCRIPTION_EPERM,
- "Can't unsubscribe others");
-
- os_free(wpa_s->preq_notify_peer);
- wpa_s->preq_notify_peer = NULL;
- wpas_dbus_unsubscribe_noc(priv);
- return NULL;
-}
-
-
-void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
- const u8 *addr, const u8 *dst, const u8 *bssid,
- const u8 *ie, size_t ie_len, u32 ssi_signal)
-{
- DBusMessage *msg;
- DBusMessageIter iter, dict_iter;
- struct wpas_dbus_priv *priv = wpa_s->global->dbus;
-
- /* Do nothing if the control interface is not turned on */
- if (priv == NULL)
- return;
-
- if (wpa_s->preq_notify_peer == NULL)
- return;
-
- msg = dbus_message_new_signal(wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE,
- "ProbeRequest");
- if (msg == NULL)
- return;
-
- dbus_message_set_destination(msg, wpa_s->preq_notify_peer);
-
- dbus_message_iter_init_append(msg, &iter);
-
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
- goto fail;
- if (addr && !wpa_dbus_dict_append_byte_array(&dict_iter, "addr",
- (const char *) addr,
- ETH_ALEN))
- goto fail;
- if (dst && !wpa_dbus_dict_append_byte_array(&dict_iter, "dst",
- (const char *) dst,
- ETH_ALEN))
- goto fail;
- if (bssid && !wpa_dbus_dict_append_byte_array(&dict_iter, "bssid",
- (const char *) bssid,
- ETH_ALEN))
- goto fail;
- if (ie && ie_len && !wpa_dbus_dict_append_byte_array(&dict_iter, "ies",
- (const char *) ie,
- ie_len))
- goto fail;
- if (ssi_signal && !wpa_dbus_dict_append_int32(&dict_iter, "signal",
- ssi_signal))
- goto fail;
- if (!wpa_dbus_dict_close_write(&iter, &dict_iter))
- goto fail;
-
- dbus_connection_send(priv->con, msg, NULL);
- goto out;
-fail:
- wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
-out:
- dbus_message_unref(msg);
-}
-
-#endif /* CONFIG_AP */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.h b/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.h
deleted file mode 100644
index aa56550..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef CTRL_IFACE_DBUS_NEW_HANDLERS_H
-#define CTRL_IFACE_DBUS_NEW_HANDLERS_H
-
-struct network_handler_args {
- struct wpa_supplicant *wpa_s;
- struct wpa_ssid *ssid;
-};
-
-struct bss_handler_args {
- struct wpa_supplicant *wpa_s;
- unsigned int id;
-};
-
-dbus_bool_t wpas_dbus_simple_property_getter(DBusMessageIter *iter,
- const int type,
- const void *val,
- DBusError *error);
-
-dbus_bool_t wpas_dbus_simple_property_setter(DBusMessageIter *iter,
- DBusError *error,
- const int type, void *val);
-
-dbus_bool_t wpas_dbus_simple_array_property_getter(DBusMessageIter *iter,
- const int type,
- const void *array,
- size_t array_len,
- DBusError *error);
-
-dbus_bool_t wpas_dbus_simple_array_array_property_getter(DBusMessageIter *iter,
- const int type,
- struct wpabuf **array,
- size_t array_len,
- DBusError *error);
-
-DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
- struct wpa_global *global);
-
-DBusMessage * wpas_dbus_handler_remove_interface(DBusMessage *message,
- struct wpa_global *global);
-
-DBusMessage * wpas_dbus_handler_get_interface(DBusMessage *message,
- struct wpa_global *global);
-
-dbus_bool_t wpas_dbus_getter_debug_level(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_debug_timestamp(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_debug_show_keys(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_debug_level(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_setter_debug_timestamp(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_debug_show_keys(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_interfaces(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_eap_methods(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_global_capabilities(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_disconnect(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-dbus_bool_t set_network_properties(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid,
- DBusMessageIter *iter,
- DBusError *error);
-
-DBusMessage * wpas_dbus_handler_add_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_reassociate(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_remove_all_networks(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_select_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_network_reply(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_get_blob(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_remove_blob(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_flush_bss(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_autoscan(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-dbus_bool_t wpas_dbus_getter_capabilities(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_state(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_scanning(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_ap_scan(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_ap_scan(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_fast_reauth(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_fast_reauth(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_disconnect_reason(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_expire_age(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_setter_bss_expire_age(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_expire_count(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_bss_expire_count(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_country(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_country(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_scan_interval(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_scan_interval(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_ifname(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_driver(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bridge_ifname(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_current_bss(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_current_network(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_current_auth_mode(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bsss(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_networks(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_blobs(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_bssid(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_ssid(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_privacy(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_mode(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_signal(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_frequency(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_rates(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_wpa(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_rsn(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_wps(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_bss_ies(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_enabled(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_enabled(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_network_properties(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_network_properties(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-dbus_bool_t wpas_dbus_getter_process_credentials(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_setter_process_credentials(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-DBusMessage * wpas_dbus_error_invalid_args(DBusMessage *message,
- const char *arg);
-DBusMessage * wpas_dbus_error_unknown_error(DBusMessage *message,
- const char *arg);
-
-DBusMessage * wpas_dbus_handler_subscribe_preq(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-DBusMessage * wpas_dbus_handler_unsubscribe_preq(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-#endif /* CTRL_IFACE_DBUS_HANDLERS_NEW_H */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
deleted file mode 100644
index 30e0eb3..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ /dev/null
@@ -1,2438 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface (P2P)
- * Copyright (c) 2011-2012, Intel Corporation
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-
-#include "utils/includes.h"
-#include "common.h"
-#include "../config.h"
-#include "../wpa_supplicant_i.h"
-#include "../wps_supplicant.h"
-#include "../notify.h"
-#include "dbus_new_helpers.h"
-#include "dbus_new.h"
-#include "dbus_new_handlers.h"
-#include "dbus_new_handlers_p2p.h"
-#include "dbus_dict_helpers.h"
-#include "p2p/p2p.h"
-#include "common/ieee802_11_defs.h"
-#include "ap/hostapd.h"
-#include "ap/ap_config.h"
-#include "ap/wps_hostapd.h"
-
-#include "../p2p_supplicant.h"
-
-/**
- * Parses out the mac address from the peer object path.
- * @peer_path - object path of the form
- * /fi/w1/wpa_supplicant1/Interfaces/n/Peers/00112233445566 (no colons)
- * @addr - out param must be of ETH_ALEN size
- * Returns 0 if valid (including MAC), -1 otherwise
- */
-static int parse_peer_object_path(char *peer_path, u8 addr[ETH_ALEN])
-{
- char *p;
-
- if (!peer_path)
- return -1;
- p = os_strrchr(peer_path, '/');
- if (!p)
- return -1;
- p++;
- return hwaddr_compact_aton(p, addr);
-}
-
-
-/**
- * wpas_dbus_error_persistent_group_unknown - Return a new PersistentGroupUnknown
- * error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: a dbus error message
- *
- * Convenience function to create and return an invalid persistent group error.
- */
-static DBusMessage * wpas_dbus_error_persistent_group_unknown(
- DBusMessage *message)
-{
- return dbus_message_new_error(message, WPAS_DBUS_ERROR_NETWORK_UNKNOWN,
- "There is no such persistent group in "
- "this P2P device.");
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- struct wpa_dbus_dict_entry entry;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- DBusMessageIter iter_dict;
- unsigned int timeout = 0;
- enum p2p_discovery_type type = P2P_FIND_ONLY_SOCIAL;
- int num_req_dev_types = 0;
- unsigned int i;
- u8 *req_dev_types = NULL;
-
- dbus_message_iter_init(message, &iter);
- entry.key = NULL;
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- if (!os_strcmp(entry.key, "Timeout") &&
- (entry.type == DBUS_TYPE_INT32)) {
- timeout = entry.uint32_value;
- } else if (os_strcmp(entry.key, "RequestedDeviceTypes") == 0) {
- if ((entry.type != DBUS_TYPE_ARRAY) ||
- (entry.array_type != WPAS_DBUS_TYPE_BINARRAY))
- goto error_clear;
-
- os_free(req_dev_types);
- req_dev_types =
- os_malloc(WPS_DEV_TYPE_LEN * entry.array_len);
- if (!req_dev_types)
- goto error_clear;
-
- for (i = 0; i < entry.array_len; i++) {
- if (wpabuf_len(entry.binarray_value[i]) !=
- WPS_DEV_TYPE_LEN)
- goto error_clear;
- os_memcpy(req_dev_types + i * WPS_DEV_TYPE_LEN,
- wpabuf_head(entry.binarray_value[i]),
- WPS_DEV_TYPE_LEN);
- }
- num_req_dev_types = entry.array_len;
- } else if (!os_strcmp(entry.key, "DiscoveryType") &&
- (entry.type == DBUS_TYPE_STRING)) {
- if (!os_strcmp(entry.str_value, "start_with_full"))
- type = P2P_FIND_START_WITH_FULL;
- else if (!os_strcmp(entry.str_value, "social"))
- type = P2P_FIND_ONLY_SOCIAL;
- else if (!os_strcmp(entry.str_value, "progressive"))
- type = P2P_FIND_PROGRESSIVE;
- else
- goto error_clear;
- } else
- goto error_clear;
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- wpas_p2p_find(wpa_s, timeout, type, num_req_dev_types, req_dev_types,
- NULL, 0);
- os_free(req_dev_types);
- return reply;
-
-error_clear:
- wpa_dbus_dict_entry_clear(&entry);
-error:
- os_free(req_dev_types);
- reply = wpas_dbus_error_invalid_args(message, entry.key);
- return reply;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_stop_find(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- wpas_p2p_stop_find(wpa_s);
- return NULL;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_rejectpeer(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter;
- char *peer_object_path = NULL;
- u8 peer_addr[ETH_ALEN];
-
- dbus_message_iter_init(message, &iter);
- dbus_message_iter_get_basic(&iter, &peer_object_path);
-
- if (parse_peer_object_path(peer_object_path, peer_addr) < 0)
- return wpas_dbus_error_invalid_args(message, NULL);
-
- if (wpas_p2p_reject(wpa_s, peer_addr) < 0)
- return wpas_dbus_error_unknown_error(message,
- "Failed to call wpas_p2p_reject method.");
-
- return NULL;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_listen(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- dbus_int32_t timeout = 0;
-
- if (!dbus_message_get_args(message, NULL, DBUS_TYPE_INT32, &timeout,
- DBUS_TYPE_INVALID))
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
-
- if (wpas_p2p_listen(wpa_s, (unsigned int)timeout))
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
-
- return NULL;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_extendedlisten(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- unsigned int period = 0, interval = 0;
- struct wpa_dbus_dict_entry entry;
- DBusMessageIter iter;
- DBusMessageIter iter_dict;
-
- dbus_message_iter_init(message, &iter);
- entry.key = NULL;
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- if (!os_strcmp(entry.key, "period") &&
- (entry.type == DBUS_TYPE_INT32))
- period = entry.uint32_value;
- else if (!os_strcmp(entry.key, "interval") &&
- (entry.type == DBUS_TYPE_INT32))
- interval = entry.uint32_value;
- else
- goto error_clear;
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (wpas_p2p_ext_listen(wpa_s, period, interval))
- return wpas_dbus_error_unknown_error(
- message, "failed to initiate a p2p_ext_listen.");
-
- return NULL;
-
-error_clear:
- wpa_dbus_dict_entry_clear(&entry);
-error:
- return wpas_dbus_error_invalid_args(message, entry.key);
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_presence_request(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- unsigned int dur1 = 0, int1 = 0, dur2 = 0, int2 = 0;
- struct wpa_dbus_dict_entry entry;
- DBusMessageIter iter;
- DBusMessageIter iter_dict;
-
- dbus_message_iter_init(message, &iter);
- entry.key = NULL;
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- if (!os_strcmp(entry.key, "duration1") &&
- (entry.type == DBUS_TYPE_INT32))
- dur1 = entry.uint32_value;
- else if (!os_strcmp(entry.key, "interval1") &&
- entry.type == DBUS_TYPE_INT32)
- int1 = entry.uint32_value;
- else if (!os_strcmp(entry.key, "duration2") &&
- entry.type == DBUS_TYPE_INT32)
- dur2 = entry.uint32_value;
- else if (!os_strcmp(entry.key, "interval2") &&
- entry.type == DBUS_TYPE_INT32)
- int2 = entry.uint32_value;
- else
- goto error_clear;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
- if (wpas_p2p_presence_req(wpa_s, dur1, int1, dur2, int2) < 0)
- return wpas_dbus_error_unknown_error(message,
- "Failed to invoke presence request.");
-
- return NULL;
-
-error_clear:
- wpa_dbus_dict_entry_clear(&entry);
-error:
- return wpas_dbus_error_invalid_args(message, entry.key);
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_group_add(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- char *pg_object_path = NULL;
- int persistent_group = 0;
- int freq = 0;
- char *iface = NULL;
- char *net_id_str = NULL;
- unsigned int group_id = 0;
- struct wpa_ssid *ssid;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto inv_args;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto inv_args;
-
- if (!os_strcmp(entry.key, "persistent") &&
- (entry.type == DBUS_TYPE_BOOLEAN)) {
- persistent_group = (entry.bool_value == TRUE) ? 1 : 0;
- } else if (!os_strcmp(entry.key, "frequency") &&
- (entry.type == DBUS_TYPE_INT32)) {
- freq = entry.int32_value;
- if (freq <= 0)
- goto inv_args_clear;
- } else if (!os_strcmp(entry.key, "persistent_group_object") &&
- entry.type == DBUS_TYPE_OBJECT_PATH)
- pg_object_path = os_strdup(entry.str_value);
- else
- goto inv_args_clear;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (pg_object_path != NULL) {
- /*
- * A persistent group Object Path is defined meaning we want
- * to re-invoke a persistent group.
- */
-
- iface = wpas_dbus_new_decompose_object_path(pg_object_path, 1,
- &net_id_str, NULL);
- if (iface == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
- reply =
- wpas_dbus_error_invalid_args(message,
- pg_object_path);
- goto out;
- }
-
- group_id = strtoul(net_id_str, NULL, 10);
- if (errno == EINVAL) {
- reply = wpas_dbus_error_invalid_args(
- message, pg_object_path);
- goto out;
- }
-
- /* Get the SSID structure from the persistent group id */
- ssid = wpa_config_get_network(wpa_s->conf, group_id);
- if (ssid == NULL || ssid->disabled != 2)
- goto inv_args;
-
- if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0)) {
- reply = wpas_dbus_error_unknown_error(
- message,
- "Failed to reinvoke a persistent group");
- goto out;
- }
- } else if (wpas_p2p_group_add(wpa_s, persistent_group, freq, 0))
- goto inv_args;
-
-out:
- os_free(pg_object_path);
- os_free(net_id_str);
- os_free(iface);
- return reply;
-inv_args_clear:
- wpa_dbus_dict_entry_clear(&entry);
-inv_args:
- reply = wpas_dbus_error_invalid_args(message, NULL);
- goto out;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_disconnect(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- if (wpas_p2p_disconnect(wpa_s))
- return wpas_dbus_error_unknown_error(message,
- "failed to disconnect");
-
- return NULL;
-}
-
-
-static dbus_bool_t wpa_dbus_p2p_check_enabled(struct wpa_supplicant *wpa_s,
- DBusMessage *message,
- DBusMessage **out_reply,
- DBusError *error)
-{
- /* Return an error message or an error if P2P isn't available */
- if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) {
- if (out_reply) {
- *out_reply = dbus_message_new_error(
- message, DBUS_ERROR_FAILED,
- "P2P is not available for this interface");
- }
- dbus_set_error_const(error, DBUS_ERROR_FAILED,
- "P2P is not available for this "
- "interface");
- return FALSE;
- }
- return TRUE;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_flush(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
-
- if (!wpa_dbus_p2p_check_enabled(wpa_s, message, &reply, NULL))
- return reply;
-
- os_memset(wpa_s->p2p_auth_invite, 0, ETH_ALEN);
- wpa_s->force_long_sd = 0;
- p2p_flush(wpa_s->global->p2p);
-
- return NULL;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- char *peer_object_path = NULL;
- int persistent_group = 0;
- int join = 0;
- int authorize_only = 0;
- int go_intent = -1;
- int freq = 0;
- u8 addr[ETH_ALEN];
- char *pin = NULL;
- enum p2p_wps_method wps_method = WPS_NOT_READY;
- int new_pin;
- char *err_msg = NULL;
- char *iface = NULL;
-
- if (!wpa_dbus_p2p_check_enabled(wpa_s, message, &reply, NULL))
- return reply;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto inv_args;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto inv_args;
-
- if (!os_strcmp(entry.key, "peer") &&
- (entry.type == DBUS_TYPE_OBJECT_PATH)) {
- peer_object_path = os_strdup(entry.str_value);
- } else if (!os_strcmp(entry.key, "persistent") &&
- (entry.type == DBUS_TYPE_BOOLEAN)) {
- persistent_group = (entry.bool_value == TRUE) ? 1 : 0;
- } else if (!os_strcmp(entry.key, "join") &&
- (entry.type == DBUS_TYPE_BOOLEAN)) {
- join = (entry.bool_value == TRUE) ? 1 : 0;
- } else if (!os_strcmp(entry.key, "authorize_only") &&
- (entry.type == DBUS_TYPE_BOOLEAN)) {
- authorize_only = (entry.bool_value == TRUE) ? 1 : 0;
- } else if (!os_strcmp(entry.key, "frequency") &&
- (entry.type == DBUS_TYPE_INT32)) {
- freq = entry.int32_value;
- if (freq <= 0)
- goto inv_args_clear;
- } else if (!os_strcmp(entry.key, "go_intent") &&
- (entry.type == DBUS_TYPE_INT32)) {
- go_intent = entry.int32_value;
- if ((go_intent < 0) || (go_intent > 15))
- goto inv_args_clear;
- } else if (!os_strcmp(entry.key, "wps_method") &&
- (entry.type == DBUS_TYPE_STRING)) {
- if (!os_strcmp(entry.str_value, "pbc"))
- wps_method = WPS_PBC;
- else if (!os_strcmp(entry.str_value, "pin"))
- wps_method = WPS_PIN_DISPLAY;
- else if (!os_strcmp(entry.str_value, "display"))
- wps_method = WPS_PIN_DISPLAY;
- else if (!os_strcmp(entry.str_value, "keypad"))
- wps_method = WPS_PIN_KEYPAD;
- else
- goto inv_args_clear;
- } else if (!os_strcmp(entry.key, "pin") &&
- (entry.type == DBUS_TYPE_STRING)) {
- pin = os_strdup(entry.str_value);
- } else
- goto inv_args_clear;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (!peer_object_path || (wps_method == WPS_NOT_READY) ||
- (parse_peer_object_path(peer_object_path, addr) < 0) ||
- !p2p_peer_known(wpa_s->global->p2p, addr))
- goto inv_args;
-
- /*
- * Validate the wps_method specified and the pin value.
- */
- if ((!pin || !pin[0]) && (wps_method == WPS_PIN_KEYPAD))
- goto inv_args;
-
- new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method,
- persistent_group, 0, join, authorize_only,
- go_intent, freq, -1, 0, 0);
-
- if (new_pin >= 0) {
- char npin[9];
- char *generated_pin;
- os_snprintf(npin, sizeof(npin), "%08d", new_pin);
- generated_pin = npin;
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_STRING,
- &generated_pin, DBUS_TYPE_INVALID);
- } else {
- switch (new_pin) {
- case -2:
- err_msg = "connect failed due to channel "
- "unavailability.";
- iface = WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNAVAILABLE;
- break;
-
- case -3:
- err_msg = "connect failed due to unsupported channel.";
- iface = WPAS_DBUS_ERROR_CONNECT_CHANNEL_UNSUPPORTED;
- break;
-
- default:
- err_msg = "connect failed due to unspecified error.";
- iface = WPAS_DBUS_ERROR_CONNECT_UNSPECIFIED_ERROR;
- break;
- }
-
- /*
- * TODO:
- * Do we need specialized errors corresponding to above
- * error conditions as against just returning a different
- * error message?
- */
- reply = dbus_message_new_error(message, iface, err_msg);
- }
-
-out:
- os_free(peer_object_path);
- os_free(pin);
- return reply;
-inv_args_clear:
- wpa_dbus_dict_entry_clear(&entry);
-inv_args:
- reply = wpas_dbus_error_invalid_args(message, NULL);
- goto out;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_invite(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- char *peer_object_path = NULL;
- char *pg_object_path = NULL;
- char *iface = NULL;
- char *net_id_str = NULL;
- u8 peer_addr[ETH_ALEN];
- unsigned int group_id = 0;
- int persistent = 0;
- struct wpa_ssid *ssid;
-
- if (!wpa_dbus_p2p_check_enabled(wpa_s, message, &reply, NULL))
- return reply;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto err;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto err;
-
- if (!os_strcmp(entry.key, "peer") &&
- (entry.type == DBUS_TYPE_OBJECT_PATH)) {
- peer_object_path = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- } else if (!os_strcmp(entry.key, "persistent_group_object") &&
- (entry.type == DBUS_TYPE_OBJECT_PATH)) {
- pg_object_path = os_strdup(entry.str_value);
- persistent = 1;
- wpa_dbus_dict_entry_clear(&entry);
- } else {
- wpa_dbus_dict_entry_clear(&entry);
- goto err;
- }
- }
-
- if (!peer_object_path ||
- (parse_peer_object_path(peer_object_path, peer_addr) < 0) ||
- !p2p_peer_known(wpa_s->global->p2p, peer_addr)) {
- goto err;
- }
-
- if (persistent) {
- /*
- * A group ID is defined meaning we want to re-invoke a
- * persistent group
- */
-
- iface = wpas_dbus_new_decompose_object_path(pg_object_path, 1,
- &net_id_str, NULL);
- if (iface == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
- reply = wpas_dbus_error_invalid_args(message,
- pg_object_path);
- goto out;
- }
-
- group_id = strtoul(net_id_str, NULL, 10);
- if (errno == EINVAL) {
- reply = wpas_dbus_error_invalid_args(
- message, pg_object_path);
- goto out;
- }
-
- /* Get the SSID structure from the persistent group id */
- ssid = wpa_config_get_network(wpa_s->conf, group_id);
- if (ssid == NULL || ssid->disabled != 2)
- goto err;
-
- if (wpas_p2p_invite(wpa_s, peer_addr, ssid, NULL, 0, 0) < 0) {
- reply = wpas_dbus_error_unknown_error(
- message,
- "Failed to reinvoke a persistent group");
- goto out;
- }
- } else {
- /*
- * No group ID means propose to a peer to join my active group
- */
- if (wpas_p2p_invite_group(wpa_s, wpa_s->ifname,
- peer_addr, NULL)) {
- reply = wpas_dbus_error_unknown_error(
- message, "Failed to join to an active group");
- goto out;
- }
- }
-
-out:
- os_free(pg_object_path);
- os_free(peer_object_path);
- return reply;
-
-err:
- reply = wpas_dbus_error_invalid_args(message, NULL);
- goto out;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_prov_disc_req(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter;
- char *peer_object_path = NULL;
- char *config_method = NULL;
- u8 peer_addr[ETH_ALEN];
-
- dbus_message_iter_init(message, &iter);
- dbus_message_iter_get_basic(&iter, &peer_object_path);
-
- if (parse_peer_object_path(peer_object_path, peer_addr) < 0)
- return wpas_dbus_error_invalid_args(message, NULL);
-
- dbus_message_iter_next(&iter);
- dbus_message_iter_get_basic(&iter, &config_method);
-
- /*
- * Validation checks on config_method are being duplicated here
- * to be able to return invalid args reply since the error code
- * from p2p module are not granular enough (yet).
- */
- if (os_strcmp(config_method, "display") &&
- os_strcmp(config_method, "keypad") &&
- os_strcmp(config_method, "pbc") &&
- os_strcmp(config_method, "pushbutton"))
- return wpas_dbus_error_invalid_args(message, NULL);
-
- if (wpas_p2p_prov_disc(wpa_s, peer_addr, config_method,
- WPAS_P2P_PD_FOR_GO_NEG) < 0)
- return wpas_dbus_error_unknown_error(message,
- "Failed to send provision discovery request");
-
- return NULL;
-}
-
-
-/*
- * P2P Device property accessor methods.
- */
-
-dbus_bool_t wpas_dbus_getter_p2p_device_config(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- DBusMessageIter variant_iter, dict_iter;
- DBusMessageIter iter_secdev_dict_entry, iter_secdev_dict_val,
- iter_secdev_dict_array;
- const char *dev_name;
- int num_vendor_extensions = 0;
- int i;
- const struct wpabuf *vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
-
- if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error))
- return FALSE;
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- "a{sv}", &variant_iter) ||
- !wpa_dbus_dict_open_write(&variant_iter, &dict_iter))
- goto err_no_mem;
-
- /* DeviceName */
- dev_name = wpa_s->conf->device_name;
- if (dev_name &&
- !wpa_dbus_dict_append_string(&dict_iter, "DeviceName", dev_name))
- goto err_no_mem;
-
- /* Primary device type */
- if (!wpa_dbus_dict_append_byte_array(&dict_iter, "PrimaryDeviceType",
- (char *)wpa_s->conf->device_type,
- WPS_DEV_TYPE_LEN))
- goto err_no_mem;
-
- /* Secondary device types */
- if (wpa_s->conf->num_sec_device_types) {
- if (!wpa_dbus_dict_begin_array(&dict_iter,
- "SecondaryDeviceTypes",
- DBUS_TYPE_ARRAY_AS_STRING
- DBUS_TYPE_BYTE_AS_STRING,
- &iter_secdev_dict_entry,
- &iter_secdev_dict_val,
- &iter_secdev_dict_array))
- goto err_no_mem;
-
- for (i = 0; i < wpa_s->conf->num_sec_device_types; i++)
- wpa_dbus_dict_bin_array_add_element(
- &iter_secdev_dict_array,
- wpa_s->conf->sec_device_type[i],
- WPS_DEV_TYPE_LEN);
-
- if (!wpa_dbus_dict_end_array(&dict_iter,
- &iter_secdev_dict_entry,
- &iter_secdev_dict_val,
- &iter_secdev_dict_array))
- goto err_no_mem;
- }
-
- /* Vendor Extensions */
- for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) {
- if (wpa_s->conf->wps_vendor_ext[i] == NULL)
- continue;
- vendor_ext[num_vendor_extensions++] =
- wpa_s->conf->wps_vendor_ext[i];
- }
-
- if (num_vendor_extensions &&
- !wpa_dbus_dict_append_wpabuf_array(&dict_iter,
- "VendorExtension",
- vendor_ext,
- num_vendor_extensions))
- goto err_no_mem;
-
- /* GO Intent */
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "GOIntent",
- wpa_s->conf->p2p_go_intent))
- goto err_no_mem;
-
- /* Persistent Reconnect */
- if (!wpa_dbus_dict_append_bool(&dict_iter, "PersistentReconnect",
- wpa_s->conf->persistent_reconnect))
- goto err_no_mem;
-
- /* Listen Reg Class */
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "ListenRegClass",
- wpa_s->conf->p2p_listen_reg_class))
- goto err_no_mem;
-
- /* Listen Channel */
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "ListenChannel",
- wpa_s->conf->p2p_listen_channel))
- goto err_no_mem;
-
- /* Oper Reg Class */
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "OperRegClass",
- wpa_s->conf->p2p_oper_reg_class))
- goto err_no_mem;
-
- /* Oper Channel */
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "OperChannel",
- wpa_s->conf->p2p_oper_channel))
- goto err_no_mem;
-
- /* SSID Postfix */
- if (wpa_s->conf->p2p_ssid_postfix &&
- !wpa_dbus_dict_append_string(&dict_iter, "SsidPostfix",
- wpa_s->conf->p2p_ssid_postfix))
- goto err_no_mem;
-
- /* Intra Bss */
- if (!wpa_dbus_dict_append_bool(&dict_iter, "IntraBss",
- wpa_s->conf->p2p_intra_bss))
- goto err_no_mem;
-
- /* Group Idle */
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "GroupIdle",
- wpa_s->conf->p2p_group_idle))
- goto err_no_mem;
-
- /* Dissasociation low ack */
- if (!wpa_dbus_dict_append_uint32(&dict_iter, "disassoc_low_ack",
- wpa_s->conf->disassoc_low_ack))
- goto err_no_mem;
-
- if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
- !dbus_message_iter_close_container(iter, &variant_iter))
- goto err_no_mem;
-
- return TRUE;
-
-err_no_mem:
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
-}
-
-
-dbus_bool_t wpas_dbus_setter_p2p_device_config(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- DBusMessageIter variant_iter, iter_dict;
- struct wpa_dbus_dict_entry entry = {.type = DBUS_TYPE_STRING };
- unsigned int i;
-
- if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error))
- return FALSE;
-
- dbus_message_iter_recurse(iter, &variant_iter);
- if (!wpa_dbus_dict_open_read(&variant_iter, &iter_dict, error))
- return FALSE;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) {
- dbus_set_error_const(error, DBUS_ERROR_INVALID_ARGS,
- "invalid message format");
- return FALSE;
- }
-
- if (os_strcmp(entry.key, "DeviceName") == 0) {
- char *devname;
-
- if (entry.type != DBUS_TYPE_STRING)
- goto error;
-
- devname = os_strdup(entry.str_value);
- if (devname == NULL)
- goto err_no_mem_clear;
-
- os_free(wpa_s->conf->device_name);
- wpa_s->conf->device_name = devname;
-
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_DEVICE_NAME;
- } else if (os_strcmp(entry.key, "PrimaryDeviceType") == 0) {
- if (entry.type != DBUS_TYPE_ARRAY ||
- entry.array_type != DBUS_TYPE_BYTE ||
- entry.array_len != WPS_DEV_TYPE_LEN)
- goto error;
-
- os_memcpy(wpa_s->conf->device_type,
- entry.bytearray_value,
- WPS_DEV_TYPE_LEN);
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_DEVICE_TYPE;
- } else if (os_strcmp(entry.key, "SecondaryDeviceTypes") == 0) {
- if (entry.type != DBUS_TYPE_ARRAY ||
- entry.array_type != WPAS_DBUS_TYPE_BINARRAY ||
- entry.array_len > MAX_SEC_DEVICE_TYPES)
- goto error;
-
- for (i = 0; i < entry.array_len; i++)
- if (wpabuf_len(entry.binarray_value[i]) !=
- WPS_DEV_TYPE_LEN)
- goto err_no_mem_clear;
- for (i = 0; i < entry.array_len; i++)
- os_memcpy(wpa_s->conf->sec_device_type[i],
- wpabuf_head(entry.binarray_value[i]),
- WPS_DEV_TYPE_LEN);
- wpa_s->conf->num_sec_device_types = entry.array_len;
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_SEC_DEVICE_TYPE;
- } else if (os_strcmp(entry.key, "VendorExtension") == 0) {
- if ((entry.type != DBUS_TYPE_ARRAY) ||
- (entry.array_type != WPAS_DBUS_TYPE_BINARRAY) ||
- (entry.array_len > P2P_MAX_WPS_VENDOR_EXT))
- goto error;
-
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_VENDOR_EXTENSION;
-
- for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) {
- wpabuf_free(wpa_s->conf->wps_vendor_ext[i]);
- if (i < entry.array_len) {
- wpa_s->conf->wps_vendor_ext[i] =
- entry.binarray_value[i];
- entry.binarray_value[i] = NULL;
- } else
- wpa_s->conf->wps_vendor_ext[i] = NULL;
- }
- } else if ((os_strcmp(entry.key, "GOIntent") == 0) &&
- (entry.type == DBUS_TYPE_UINT32) &&
- (entry.uint32_value <= 15))
- wpa_s->conf->p2p_go_intent = entry.uint32_value;
- else if ((os_strcmp(entry.key, "PersistentReconnect") == 0) &&
- (entry.type == DBUS_TYPE_BOOLEAN))
- wpa_s->conf->persistent_reconnect = entry.bool_value;
- else if ((os_strcmp(entry.key, "ListenRegClass") == 0) &&
- (entry.type == DBUS_TYPE_UINT32)) {
- wpa_s->conf->p2p_listen_reg_class = entry.uint32_value;
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_P2P_LISTEN_CHANNEL;
- } else if ((os_strcmp(entry.key, "ListenChannel") == 0) &&
- (entry.type == DBUS_TYPE_UINT32)) {
- wpa_s->conf->p2p_listen_channel = entry.uint32_value;
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_P2P_LISTEN_CHANNEL;
- } else if ((os_strcmp(entry.key, "OperRegClass") == 0) &&
- (entry.type == DBUS_TYPE_UINT32)) {
- wpa_s->conf->p2p_oper_reg_class = entry.uint32_value;
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_P2P_OPER_CHANNEL;
- } else if ((os_strcmp(entry.key, "OperChannel") == 0) &&
- (entry.type == DBUS_TYPE_UINT32)) {
- wpa_s->conf->p2p_oper_channel = entry.uint32_value;
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_P2P_OPER_CHANNEL;
- } else if (os_strcmp(entry.key, "SsidPostfix") == 0) {
- char *postfix;
-
- if (entry.type != DBUS_TYPE_STRING)
- goto error;
-
- postfix = os_strdup(entry.str_value);
- if (!postfix)
- goto err_no_mem_clear;
-
- os_free(wpa_s->conf->p2p_ssid_postfix);
- wpa_s->conf->p2p_ssid_postfix = postfix;
-
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_P2P_SSID_POSTFIX;
- } else if ((os_strcmp(entry.key, "IntraBss") == 0) &&
- (entry.type == DBUS_TYPE_BOOLEAN)) {
- wpa_s->conf->p2p_intra_bss = entry.bool_value;
- wpa_s->conf->changed_parameters |=
- CFG_CHANGED_P2P_INTRA_BSS;
- } else if ((os_strcmp(entry.key, "GroupIdle") == 0) &&
- (entry.type == DBUS_TYPE_UINT32))
- wpa_s->conf->p2p_group_idle = entry.uint32_value;
- else if (os_strcmp(entry.key, "disassoc_low_ack") == 0 &&
- entry.type == DBUS_TYPE_UINT32)
- wpa_s->conf->disassoc_low_ack = entry.uint32_value;
- else
- goto error;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (wpa_s->conf->changed_parameters) {
- /* Some changed parameters requires to update config*/
- wpa_supplicant_update_config(wpa_s);
- }
-
- return TRUE;
-
- error:
- dbus_set_error_const(error, DBUS_ERROR_INVALID_ARGS,
- "invalid message format");
- wpa_dbus_dict_entry_clear(&entry);
- return FALSE;
-
- err_no_mem_clear:
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- wpa_dbus_dict_entry_clear(&entry);
- return FALSE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peers(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- struct p2p_data *p2p = wpa_s->global->p2p;
- int next = 0, i = 0;
- int num = 0, out_of_mem = 0;
- const u8 *addr;
- const struct p2p_peer_info *peer_info = NULL;
- dbus_bool_t success = FALSE;
-
- struct dl_list peer_objpath_list;
- struct peer_objpath_node {
- struct dl_list list;
- char path[WPAS_DBUS_OBJECT_PATH_MAX];
- } *node, *tmp;
-
- char **peer_obj_paths = NULL;
-
- if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error))
- return FALSE;
-
- dl_list_init(&peer_objpath_list);
-
- /* Get the first peer info */
- peer_info = p2p_get_peer_found(p2p, NULL, next);
-
- /* Get next and accumulate them */
- next = 1;
- while (peer_info != NULL) {
- node = os_zalloc(sizeof(struct peer_objpath_node));
- if (!node) {
- out_of_mem = 1;
- goto error;
- }
-
- addr = peer_info->p2p_device_addr;
- os_snprintf(node->path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART
- "/" COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(addr));
- dl_list_add_tail(&peer_objpath_list, &node->list);
- num++;
-
- peer_info = p2p_get_peer_found(p2p, addr, next);
- }
-
- /*
- * Now construct the peer object paths in a form suitable for
- * array_property_getter helper below.
- */
- peer_obj_paths = os_calloc(num, sizeof(char *));
-
- if (!peer_obj_paths) {
- out_of_mem = 1;
- goto error;
- }
-
- dl_list_for_each_safe(node, tmp, &peer_objpath_list,
- struct peer_objpath_node, list)
- peer_obj_paths[i++] = node->path;
-
- success = wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_OBJECT_PATH,
- peer_obj_paths, num,
- error);
-
-error:
- if (peer_obj_paths)
- os_free(peer_obj_paths);
-
- dl_list_for_each_safe(node, tmp, &peer_objpath_list,
- struct peer_objpath_node, list) {
- dl_list_del(&node->list);
- os_free(node);
- }
- if (out_of_mem)
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
-
- return success;
-}
-
-
-enum wpas_p2p_role {
- WPAS_P2P_ROLE_DEVICE,
- WPAS_P2P_ROLE_GO,
- WPAS_P2P_ROLE_CLIENT,
-};
-
-static enum wpas_p2p_role wpas_get_p2p_role(struct wpa_supplicant *wpa_s)
-{
- struct wpa_ssid *ssid = wpa_s->current_ssid;
-
- if (!ssid)
- return WPAS_P2P_ROLE_DEVICE;
- if (wpa_s->wpa_state != WPA_COMPLETED)
- return WPAS_P2P_ROLE_DEVICE;
-
- switch (ssid->mode) {
- case WPAS_MODE_P2P_GO:
- case WPAS_MODE_P2P_GROUP_FORMATION:
- return WPAS_P2P_ROLE_GO;
- case WPAS_MODE_INFRA:
- if (ssid->p2p_group)
- return WPAS_P2P_ROLE_CLIENT;
- return WPAS_P2P_ROLE_DEVICE;
- default:
- return WPAS_P2P_ROLE_DEVICE;
- }
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_role(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- char *str;
-
- switch (wpas_get_p2p_role(wpa_s)) {
- case WPAS_P2P_ROLE_GO:
- str = "GO";
- break;
- case WPAS_P2P_ROLE_CLIENT:
- str = "client";
- break;
- default:
- str = "device";
- }
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING, &str,
- error);
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_group(DBusMessageIter *iter, DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- char path_buf[WPAS_DBUS_OBJECT_PATH_MAX];
- char *dbus_groupobj_path = path_buf;
-
- if (wpa_s->dbus_groupobj_path == NULL)
- os_snprintf(dbus_groupobj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "/");
- else
- os_snprintf(dbus_groupobj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s", wpa_s->dbus_groupobj_path);
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
- &dbus_groupobj_path, error);
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peergo(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- char go_peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
-
- if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_CLIENT)
- os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
- else
- os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
- COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(wpa_s->go_dev_addr));
-
- path = go_peer_obj_path;
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
- &path, error);
-}
-
-
-/*
- * Peer object properties accessor methods
- */
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_device_name(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
- char *tmp;
-
- if (!wpa_dbus_p2p_check_enabled(peer_args->wpa_s, NULL, NULL, error))
- return FALSE;
-
- /* get the peer info */
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- tmp = os_strdup(info->device_name);
- if (!tmp) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING, &tmp,
- error)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- os_free(tmp);
- return FALSE;
- }
-
- os_free(tmp);
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_primary_device_type(
- DBusMessageIter *iter, DBusError *error, void *user_data)
-{
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
-
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- if (!wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
- (char *)
- info->pri_dev_type,
- WPS_DEV_TYPE_LEN, error)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_config_method(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
-
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
- &info->config_methods, error)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_level(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
-
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT32,
- &info->level, error)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_device_capability(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
-
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BYTE,
- &info->dev_capab, error)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_group_capability(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
-
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BYTE,
- &info->group_capab, error)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_secondary_device_types(
- DBusMessageIter *iter, DBusError *error, void *user_data)
-{
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
- DBusMessageIter variant_iter, array_iter;
-
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- DBUS_TYPE_ARRAY_AS_STRING
- DBUS_TYPE_ARRAY_AS_STRING
- DBUS_TYPE_BYTE_AS_STRING,
- &variant_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 1", __func__);
- return FALSE;
- }
-
- if (!dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_ARRAY_AS_STRING
- DBUS_TYPE_BYTE_AS_STRING,
- &array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 2", __func__);
- return FALSE;
- }
-
- if (info->wps_sec_dev_type_list_len) {
- const u8 *sec_dev_type_list = info->wps_sec_dev_type_list;
- int num_sec_device_types =
- info->wps_sec_dev_type_list_len / WPS_DEV_TYPE_LEN;
- int i;
- DBusMessageIter inner_array_iter;
-
- for (i = 0; i < num_sec_device_types; i++) {
- if (!dbus_message_iter_open_container(
- &array_iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_BYTE_AS_STRING,
- &inner_array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct "
- "message 3 (%d)",
- __func__, i);
- return FALSE;
- }
-
- if (!dbus_message_iter_append_fixed_array(
- &inner_array_iter, DBUS_TYPE_BYTE,
- &sec_dev_type_list, WPS_DEV_TYPE_LEN)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct "
- "message 4 (%d)",
- __func__, i);
- return FALSE;
- }
-
- if (!dbus_message_iter_close_container(
- &array_iter, &inner_array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct "
- "message 5 (%d)",
- __func__, i);
- return FALSE;
- }
-
- sec_dev_type_list += WPS_DEV_TYPE_LEN;
- }
- }
-
- if (!dbus_message_iter_close_container(&variant_iter, &array_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 6", __func__);
- return FALSE;
- }
-
- if (!dbus_message_iter_close_container(iter, &variant_iter)) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "%s: failed to construct message 7", __func__);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_vendor_extension(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpabuf *vendor_extension[P2P_MAX_WPS_VENDOR_EXT];
- int i, num;
- struct peer_handler_args *peer_args = user_data;
- const struct p2p_peer_info *info;
-
- info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
- peer_args->p2p_device_addr, 0);
- if (info == NULL) {
- dbus_set_error(error, DBUS_ERROR_FAILED,
- "failed to find peer");
- return FALSE;
- }
-
- /* Add WPS vendor extensions attribute */
- for (i = 0, num = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) {
- if (info->wps_vendor_ext[i] == NULL)
- continue;
- vendor_extension[num] = info->wps_vendor_ext[i];
- num++;
- }
-
- if (!wpas_dbus_simple_array_array_property_getter(iter, DBUS_TYPE_BYTE,
- vendor_extension,
- num, error))
- return FALSE;
-
- return TRUE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_ies(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- dbus_bool_t success;
- /* struct peer_handler_args *peer_args = user_data; */
-
- success = wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
- NULL, 0, error);
- return success;
-}
-
-
-/**
- * wpas_dbus_getter_persistent_groups - Get array of persistent group objects
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "PersistentGroups" property.
- */
-dbus_bool_t wpas_dbus_getter_persistent_groups(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- struct wpa_ssid *ssid;
- char **paths;
- unsigned int i = 0, num = 0;
- dbus_bool_t success = FALSE;
-
- if (wpa_s->conf == NULL) {
- wpa_printf(MSG_ERROR, "dbus: %s: "
- "An error occurred getting persistent groups list",
- __func__);
- dbus_set_error_const(error, DBUS_ERROR_FAILED, "an error "
- "occurred getting persistent groups list");
- return FALSE;
- }
-
- for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
- if (network_is_persistent_group(ssid))
- num++;
-
- paths = os_calloc(num, sizeof(char *));
- if (!paths) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- return FALSE;
- }
-
- /* Loop through configured networks and append object path of each */
- for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
- if (!network_is_persistent_group(ssid))
- continue;
- paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- if (paths[i] == NULL) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY,
- "no memory");
- goto out;
- }
- /* Construct the object path for this network. */
- os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%d",
- wpa_s->dbus_new_path, ssid->id);
- }
-
- success = wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_OBJECT_PATH,
- paths, num, error);
-
-out:
- while (i)
- os_free(paths[--i]);
- os_free(paths);
- return success;
-}
-
-
-/**
- * wpas_dbus_getter_persistent_group_properties - Get options for a persistent
- * group
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "Properties" property of a persistent group.
- */
-dbus_bool_t wpas_dbus_getter_persistent_group_properties(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct network_handler_args *net = user_data;
-
- /* Leveraging the fact that persistent group object is still
- * represented in same manner as network within.
- */
- return wpas_dbus_getter_network_properties(iter, error, net);
-}
-
-
-/**
- * wpas_dbus_setter_persistent_group_properties - Get options for a persistent
- * group
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter for "Properties" property of a persistent group.
- */
-dbus_bool_t wpas_dbus_setter_persistent_group_properties(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct network_handler_args *net = user_data;
- struct wpa_ssid *ssid = net->ssid;
- DBusMessageIter variant_iter;
-
- /*
- * Leveraging the fact that persistent group object is still
- * represented in same manner as network within.
- */
- dbus_message_iter_recurse(iter, &variant_iter);
- return set_network_properties(net->wpa_s, ssid, &variant_iter, error);
-}
-
-
-/**
- * wpas_dbus_new_iface_add_persistent_group - Add a new configured
- * persistent_group
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing the object path of the new
- * persistent group
- *
- * Handler function for "AddPersistentGroup" method call of a P2P Device
- * interface.
- */
-DBusMessage * wpas_dbus_handler_add_persistent_group(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_ssid *ssid = NULL;
- char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *path = path_buf;
- DBusError error;
-
- dbus_message_iter_init(message, &iter);
-
- ssid = wpa_config_add_network(wpa_s->conf);
- if (ssid == NULL) {
- wpa_printf(MSG_ERROR, "dbus: %s: "
- "Cannot add new persistent group", __func__);
- reply = wpas_dbus_error_unknown_error(
- message,
- "wpa_supplicant could not add "
- "a persistent group on this interface.");
- goto err;
- }
-
- /* Mark the ssid as being a persistent group before the notification */
- ssid->disabled = 2;
- ssid->p2p_persistent_group = 1;
- wpas_notify_persistent_group_added(wpa_s, ssid);
-
- wpa_config_set_network_defaults(ssid);
-
- dbus_error_init(&error);
- if (!set_network_properties(wpa_s, ssid, &iter, &error)) {
- wpa_printf(MSG_DEBUG, "dbus: %s: "
- "Control interface could not set persistent group "
- "properties", __func__);
- reply = wpas_dbus_reply_new_from_error(message, &error,
- DBUS_ERROR_INVALID_ARGS,
- "Failed to set network "
- "properties");
- dbus_error_free(&error);
- goto err;
- }
-
- /* Construct the object path for this network. */
- os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%d",
- wpa_s->dbus_new_path, ssid->id);
-
- reply = dbus_message_new_method_return(message);
- if (reply == NULL) {
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto err;
- }
- if (!dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID)) {
- dbus_message_unref(reply);
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- goto err;
- }
-
- return reply;
-
-err:
- if (ssid) {
- wpas_notify_persistent_group_removed(wpa_s, ssid);
- wpa_config_remove_network(wpa_s->conf, ssid->id);
- }
- return reply;
-}
-
-
-/**
- * wpas_dbus_handler_remove_persistent_group - Remove a configured persistent
- * group
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL on success or dbus error on failure
- *
- * Handler function for "RemovePersistentGroup" method call of a P2P Device
- * interface.
- */
-DBusMessage * wpas_dbus_handler_remove_persistent_group(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- const char *op;
- char *iface = NULL, *persistent_group_id = NULL;
- int id;
- struct wpa_ssid *ssid;
-
- dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &op,
- DBUS_TYPE_INVALID);
-
- /*
- * Extract the network ID and ensure the network is actually a child of
- * this interface.
- */
- iface = wpas_dbus_new_decompose_object_path(op, 1,
- &persistent_group_id,
- NULL);
- if (iface == NULL || os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
- reply = wpas_dbus_error_invalid_args(message, op);
- goto out;
- }
-
- id = strtoul(persistent_group_id, NULL, 10);
- if (errno == EINVAL) {
- reply = wpas_dbus_error_invalid_args(message, op);
- goto out;
- }
-
- ssid = wpa_config_get_network(wpa_s->conf, id);
- if (ssid == NULL) {
- reply = wpas_dbus_error_persistent_group_unknown(message);
- goto out;
- }
-
- wpas_notify_persistent_group_removed(wpa_s, ssid);
-
- if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
- wpa_printf(MSG_ERROR, "dbus: %s: "
- "error occurred when removing persistent group %d",
- __func__, id);
- reply = wpas_dbus_error_unknown_error(
- message,
- "error removing the specified persistent group on "
- "this interface.");
- goto out;
- }
-
-out:
- os_free(iface);
- os_free(persistent_group_id);
- return reply;
-}
-
-
-static void remove_persistent_group(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- wpas_notify_persistent_group_removed(wpa_s, ssid);
-
- if (wpa_config_remove_network(wpa_s->conf, ssid->id) < 0) {
- wpa_printf(MSG_ERROR, "dbus: %s: "
- "error occurred when removing persistent group %d",
- __func__, ssid->id);
- return;
- }
-}
-
-
-/**
- * wpas_dbus_handler_remove_all_persistent_groups - Remove all configured
- * persistent groups
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: NULL on success or dbus error on failure
- *
- * Handler function for "RemoveAllPersistentGroups" method call of a
- * P2P Device interface.
- */
-DBusMessage * wpas_dbus_handler_remove_all_persistent_groups(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- struct wpa_ssid *ssid, *next;
- struct wpa_config *config;
-
- config = wpa_s->conf;
- ssid = config->ssid;
- while (ssid) {
- next = ssid->next;
- if (network_is_persistent_group(ssid))
- remove_persistent_group(wpa_s, ssid);
- ssid = next;
- }
- return NULL;
-}
-
-
-/*
- * Group object properties accessor methods
- */
-
-dbus_bool_t wpas_dbus_getter_p2p_group_members(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- struct wpa_ssid *ssid;
- unsigned int num_members;
- char **paths;
- unsigned int i;
- void *next = NULL;
- const u8 *addr;
- dbus_bool_t success = FALSE;
-
- /* Verify correct role for this property */
- if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_GO) {
- return wpas_dbus_simple_array_property_getter(
- iter, DBUS_TYPE_OBJECT_PATH, NULL, 0, error);
- }
-
- ssid = wpa_s->conf->ssid;
- /* At present WPAS P2P_GO mode only applicable for p2p_go */
- if (ssid->mode != WPAS_MODE_P2P_GO &&
- ssid->mode != WPAS_MODE_AP &&
- ssid->mode != WPAS_MODE_P2P_GROUP_FORMATION)
- return FALSE;
-
- num_members = p2p_get_group_num_members(wpa_s->p2p_group);
-
- paths = os_calloc(num_members, sizeof(char *));
- if (!paths)
- goto out_of_memory;
-
- i = 0;
- while ((addr = p2p_iterate_group_members(wpa_s->p2p_group, &next))) {
- paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- if (!paths[i])
- goto out_of_memory;
- os_snprintf(paths[i], WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART
- "/" COMPACT_MACSTR,
- wpa_s->dbus_groupobj_path, MAC2STR(addr));
- i++;
- }
-
- success = wpas_dbus_simple_array_property_getter(iter,
- DBUS_TYPE_OBJECT_PATH,
- paths, num_members,
- error);
-
- for (i = 0; i < num_members; i++)
- os_free(paths[i]);
- os_free(paths);
- return success;
-
-out_of_memory:
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
- if (paths) {
- for (i = 0; i < num_members; i++)
- os_free(paths[i]);
- os_free(paths);
- }
- return FALSE;
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_group_ssid(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- if (wpa_s->current_ssid == NULL)
- return FALSE;
- return wpas_dbus_simple_array_property_getter(
- iter, DBUS_TYPE_BYTE, wpa_s->current_ssid->ssid,
- wpa_s->current_ssid->ssid_len, error);
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_group_bssid(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- u8 role = wpas_get_p2p_role(wpa_s);
- u8 *p_bssid;
-
- if (role == WPAS_P2P_ROLE_CLIENT) {
- if (wpa_s->current_ssid == NULL)
- return FALSE;
- p_bssid = wpa_s->current_ssid->bssid;
- } else {
- if (wpa_s->ap_iface == NULL)
- return FALSE;
- p_bssid = wpa_s->ap_iface->bss[0]->own_addr;
- }
-
- return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
- p_bssid, ETH_ALEN,
- error);
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_group_frequency(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- u16 op_freq;
- u8 role = wpas_get_p2p_role(wpa_s);
-
- if (role == WPAS_P2P_ROLE_CLIENT) {
- if (wpa_s->go_params == NULL)
- return FALSE;
- op_freq = wpa_s->go_params->freq;
- } else {
- if (wpa_s->ap_iface == NULL)
- return FALSE;
- op_freq = wpa_s->ap_iface->freq;
- }
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
- &op_freq, error);
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_group_passphrase(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- u8 role = wpas_get_p2p_role(wpa_s);
- char *p_pass = NULL;
-
- /* Verify correct role for this property */
- if (role == WPAS_P2P_ROLE_GO) {
- if (wpa_s->current_ssid == NULL)
- return FALSE;
- p_pass = wpa_s->current_ssid->passphrase;
- } else
- p_pass = "";
-
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
- &p_pass, error);
-
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_group_psk(DBusMessageIter *iter,
- DBusError *error, void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- u8 role = wpas_get_p2p_role(wpa_s);
- u8 *p_psk = NULL;
- u8 psk_len = 0;
-
- /* Verify correct role for this property */
- if (role == WPAS_P2P_ROLE_CLIENT) {
- if (wpa_s->current_ssid == NULL)
- return FALSE;
- p_psk = wpa_s->current_ssid->psk;
- psk_len = 32;
- }
-
- return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
- &p_psk, psk_len, error);
-}
-
-
-dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- struct hostapd_data *hapd;
- struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
- int num_vendor_ext = 0;
- int i;
-
- /* Verify correct role for this property */
- if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO) {
- if (wpa_s->ap_iface == NULL)
- return FALSE;
- hapd = wpa_s->ap_iface->bss[0];
-
- /* Parse WPS Vendor Extensions sent in Beacon/Probe Response */
- for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++) {
- if (hapd->conf->wps_vendor_ext[i] == NULL)
- vendor_ext[i] = NULL;
- else {
- vendor_ext[num_vendor_ext++] =
- hapd->conf->wps_vendor_ext[i];
- }
- }
- }
-
- /* Return vendor extensions or no data */
- return wpas_dbus_simple_array_array_property_getter(iter,
- DBUS_TYPE_BYTE,
- vendor_ext,
- num_vendor_ext,
- error);
-}
-
-
-dbus_bool_t wpas_dbus_setter_p2p_group_vendor_ext(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- DBusMessageIter variant_iter, iter_dict;
- struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
- unsigned int i;
- struct hostapd_data *hapd = NULL;
-
- if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO &&
- wpa_s->ap_iface != NULL)
- hapd = wpa_s->ap_iface->bss[0];
- else
- return FALSE;
-
- dbus_message_iter_recurse(iter, &variant_iter);
- if (!wpa_dbus_dict_open_read(&variant_iter, &iter_dict, error))
- return FALSE;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) {
- dbus_set_error_const(error, DBUS_ERROR_INVALID_ARGS,
- "invalid message format");
- return FALSE;
- }
-
- if (os_strcmp(entry.key, "WPSVendorExtensions") == 0) {
- if (entry.type != DBUS_TYPE_ARRAY ||
- entry.array_type != WPAS_DBUS_TYPE_BINARRAY ||
- entry.array_len > MAX_WPS_VENDOR_EXTENSIONS)
- goto error;
-
- for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++) {
- if (i < entry.array_len) {
- hapd->conf->wps_vendor_ext[i] =
- entry.binarray_value[i];
- entry.binarray_value[i] = NULL;
- } else
- hapd->conf->wps_vendor_ext[i] = NULL;
- }
-
- hostapd_update_wps(hapd);
- } else
- goto error;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- return TRUE;
-
-error:
- wpa_dbus_dict_entry_clear(&entry);
- dbus_set_error_const(error, DBUS_ERROR_INVALID_ARGS,
- "invalid message format");
- return FALSE;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_add_service(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- int upnp = 0;
- int bonjour = 0;
- char *service = NULL;
- struct wpabuf *query = NULL;
- struct wpabuf *resp = NULL;
- u8 version = 0;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- if (!os_strcmp(entry.key, "service_type") &&
- (entry.type == DBUS_TYPE_STRING)) {
- if (!os_strcmp(entry.str_value, "upnp"))
- upnp = 1;
- else if (!os_strcmp(entry.str_value, "bonjour"))
- bonjour = 1;
- else
- goto error_clear;
- } else if (!os_strcmp(entry.key, "version") &&
- entry.type == DBUS_TYPE_INT32) {
- version = entry.uint32_value;
- } else if (!os_strcmp(entry.key, "service") &&
- (entry.type == DBUS_TYPE_STRING)) {
- service = os_strdup(entry.str_value);
- } else if (!os_strcmp(entry.key, "query")) {
- if ((entry.type != DBUS_TYPE_ARRAY) ||
- (entry.array_type != DBUS_TYPE_BYTE))
- goto error_clear;
- query = wpabuf_alloc_copy(
- entry.bytearray_value,
- entry.array_len);
- } else if (!os_strcmp(entry.key, "response")) {
- if ((entry.type != DBUS_TYPE_ARRAY) ||
- (entry.array_type != DBUS_TYPE_BYTE))
- goto error_clear;
- resp = wpabuf_alloc_copy(entry.bytearray_value,
- entry.array_len);
- }
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (upnp == 1) {
- if (version <= 0 || service == NULL)
- goto error;
-
- if (wpas_p2p_service_add_upnp(wpa_s, version, service) != 0)
- goto error;
-
- os_free(service);
- service = NULL;
- } else if (bonjour == 1) {
- if (query == NULL || resp == NULL)
- goto error;
-
- if (wpas_p2p_service_add_bonjour(wpa_s, query, resp) < 0)
- goto error;
- query = NULL;
- resp = NULL;
- } else
- goto error;
-
- return reply;
-error_clear:
- wpa_dbus_dict_entry_clear(&entry);
-error:
- os_free(service);
- wpabuf_free(query);
- wpabuf_free(resp);
- return wpas_dbus_error_invalid_args(message, NULL);
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_delete_service(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- int upnp = 0;
- int bonjour = 0;
- int ret = 0;
- char *service = NULL;
- struct wpabuf *query = NULL;
- u8 version = 0;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- if (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- if (!os_strcmp(entry.key, "service_type") &&
- (entry.type == DBUS_TYPE_STRING)) {
- if (!os_strcmp(entry.str_value, "upnp"))
- upnp = 1;
- else if (!os_strcmp(entry.str_value, "bonjour"))
- bonjour = 1;
- else
- goto error_clear;
- wpa_dbus_dict_entry_clear(&entry);
- }
- }
- if (upnp == 1) {
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
- if (!os_strcmp(entry.key, "version") &&
- entry.type == DBUS_TYPE_INT32)
- version = entry.uint32_value;
- else if (!os_strcmp(entry.key, "service") &&
- entry.type == DBUS_TYPE_STRING)
- service = os_strdup(entry.str_value);
- else
- goto error_clear;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (version <= 0 || service == NULL)
- goto error;
-
- ret = wpas_p2p_service_del_upnp(wpa_s, version, service);
- os_free(service);
- if (ret != 0)
- goto error;
- } else if (bonjour == 1) {
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- if (!os_strcmp(entry.key, "query")) {
- if ((entry.type != DBUS_TYPE_ARRAY) ||
- (entry.array_type != DBUS_TYPE_BYTE))
- goto error_clear;
- query = wpabuf_alloc_copy(
- entry.bytearray_value,
- entry.array_len);
- } else
- goto error_clear;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (query == NULL)
- goto error;
-
- ret = wpas_p2p_service_del_bonjour(wpa_s, query);
- if (ret != 0)
- goto error;
- wpabuf_free(query);
- } else
- goto error;
-
- return reply;
-error_clear:
- wpa_dbus_dict_entry_clear(&entry);
-error:
- return wpas_dbus_error_invalid_args(message, NULL);
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_flush_service(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- wpas_p2p_service_flush(wpa_s);
- return NULL;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_service_sd_req(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- int upnp = 0;
- char *service = NULL;
- char *peer_object_path = NULL;
- struct wpabuf *tlv = NULL;
- u8 version = 0;
- u64 ref = 0;
- u8 addr_buf[ETH_ALEN], *addr;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
- if (!os_strcmp(entry.key, "peer_object") &&
- entry.type == DBUS_TYPE_OBJECT_PATH) {
- peer_object_path = os_strdup(entry.str_value);
- } else if (!os_strcmp(entry.key, "service_type") &&
- entry.type == DBUS_TYPE_STRING) {
- if (!os_strcmp(entry.str_value, "upnp"))
- upnp = 1;
- else
- goto error_clear;
- } else if (!os_strcmp(entry.key, "version") &&
- entry.type == DBUS_TYPE_INT32) {
- version = entry.uint32_value;
- } else if (!os_strcmp(entry.key, "service") &&
- entry.type == DBUS_TYPE_STRING) {
- service = os_strdup(entry.str_value);
- } else if (!os_strcmp(entry.key, "tlv")) {
- if (entry.type != DBUS_TYPE_ARRAY ||
- entry.array_type != DBUS_TYPE_BYTE)
- goto error_clear;
- tlv = wpabuf_alloc_copy(entry.bytearray_value,
- entry.array_len);
- } else
- goto error_clear;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- if (!peer_object_path) {
- addr = NULL;
- } else {
- if (parse_peer_object_path(peer_object_path, addr_buf) < 0 ||
- !p2p_peer_known(wpa_s->global->p2p, addr_buf))
- goto error;
-
- addr = addr_buf;
- }
-
- if (upnp == 1) {
- if (version <= 0 || service == NULL)
- goto error;
-
- ref = wpas_p2p_sd_request_upnp(wpa_s, addr, version, service);
- } else {
- if (tlv == NULL)
- goto error;
- ref = wpas_p2p_sd_request(wpa_s, addr, tlv);
- wpabuf_free(tlv);
- }
-
- if (ref != 0) {
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_UINT64,
- &ref, DBUS_TYPE_INVALID);
- } else {
- reply = wpas_dbus_error_unknown_error(
- message, "Unable to send SD request");
- }
-out:
- os_free(service);
- os_free(peer_object_path);
- return reply;
-error_clear:
- wpa_dbus_dict_entry_clear(&entry);
-error:
- if (tlv)
- wpabuf_free(tlv);
- reply = wpas_dbus_error_invalid_args(message, NULL);
- goto out;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_service_sd_res(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter_dict;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- struct wpa_dbus_dict_entry entry;
- char *peer_object_path = NULL;
- struct wpabuf *tlv = NULL;
- int freq = 0;
- int dlg_tok = 0;
- u8 addr[ETH_ALEN];
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
-
- if (!os_strcmp(entry.key, "peer_object") &&
- entry.type == DBUS_TYPE_OBJECT_PATH) {
- peer_object_path = os_strdup(entry.str_value);
- } else if (!os_strcmp(entry.key, "frequency") &&
- entry.type == DBUS_TYPE_INT32) {
- freq = entry.uint32_value;
- } else if (!os_strcmp(entry.key, "dialog_token") &&
- entry.type == DBUS_TYPE_UINT32) {
- dlg_tok = entry.uint32_value;
- } else if (!os_strcmp(entry.key, "tlvs")) {
- if (entry.type != DBUS_TYPE_ARRAY ||
- entry.array_type != DBUS_TYPE_BYTE)
- goto error_clear;
- tlv = wpabuf_alloc_copy(entry.bytearray_value,
- entry.array_len);
- } else
- goto error_clear;
-
- wpa_dbus_dict_entry_clear(&entry);
- }
- if (!peer_object_path ||
- (parse_peer_object_path(peer_object_path, addr) < 0) ||
- !p2p_peer_known(wpa_s->global->p2p, addr))
- goto error;
-
- if (tlv == NULL)
- goto error;
-
- wpas_p2p_sd_response(wpa_s, freq, addr, (u8) dlg_tok, tlv);
- wpabuf_free(tlv);
-out:
- os_free(peer_object_path);
- return reply;
-error_clear:
- wpa_dbus_dict_entry_clear(&entry);
-error:
- reply = wpas_dbus_error_invalid_args(message, NULL);
- goto out;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_service_sd_cancel_req(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter;
- u64 req = 0;
-
- dbus_message_iter_init(message, &iter);
- dbus_message_iter_get_basic(&iter, &req);
-
- if (req == 0)
- goto error;
-
- if (!wpas_p2p_sd_cancel_request(wpa_s, req))
- goto error;
-
- return NULL;
-error:
- return wpas_dbus_error_invalid_args(message, NULL);
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_service_update(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- wpas_p2p_sd_service_update(wpa_s);
- return NULL;
-}
-
-
-DBusMessage * wpas_dbus_handler_p2p_serv_disc_external(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter;
- int ext = 0;
-
- dbus_message_iter_init(message, &iter);
- dbus_message_iter_get_basic(&iter, &ext);
-
- wpa_s->p2p_sd_over_ctrl_iface = ext;
-
- return NULL;
-
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.h b/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
deleted file mode 100644
index a11b3c8..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface for p2p
- * Copyright (c) 2011-2012, Intel Corporation
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef DBUS_NEW_HANDLERS_P2P_H
-#define DBUS_NEW_HANDLERS_P2P_H
-
-struct peer_handler_args {
- struct wpa_supplicant *wpa_s;
- u8 p2p_device_addr[ETH_ALEN];
-};
-
-struct groupmember_handler_args {
- struct wpa_supplicant *wpa_s;
- u8 member_addr[ETH_ALEN];
-};
-
-/*
- * P2P Device methods
- */
-
-DBusMessage *wpas_dbus_handler_p2p_find(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_stop_find(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_rejectpeer(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_listen(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_extendedlisten(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_presence_request(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_prov_disc_req(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_group_add(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_connect(
- DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_invite(
- DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_disconnect(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_flush(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_add_service(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_delete_service(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_flush_service(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_service_sd_req(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_service_sd_res(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_service_sd_cancel_req(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_service_update(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage *wpas_dbus_handler_p2p_serv_disc_external(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-/*
- * P2P Device property accessor methods.
- */
-dbus_bool_t wpas_dbus_setter_p2p_device_config(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_device_config(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peers(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_role(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_group(DBusMessageIter *iter, DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peergo(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-/*
- * P2P Peer properties.
- */
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_device_name(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_primary_device_type(
- DBusMessageIter *iter, DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_config_method(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_level(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_device_capability(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_group_capability(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_secondary_device_types(
- DBusMessageIter *iter, DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_vendor_extension(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_peer_ies(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-/*
- * P2P Group properties
- */
-
-dbus_bool_t wpas_dbus_getter_p2p_group_members(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_group_ssid(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_group_bssid(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_group_frequency(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_group_passphrase(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_group_psk(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_setter_p2p_group_vendor_ext(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-/*
- * P2P Persistent Groups and properties
- */
-
-dbus_bool_t wpas_dbus_getter_persistent_groups(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-dbus_bool_t wpas_dbus_getter_persistent_group_properties(DBusMessageIter *iter,
- DBusError *error, void *user_data);
-
-dbus_bool_t wpas_dbus_setter_persistent_group_properties(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-DBusMessage * wpas_dbus_handler_add_persistent_group(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_remove_persistent_group(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_handler_remove_all_persistent_groups(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-
-#endif /* DBUS_NEW_HANDLERS_P2P_H */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_wps.c b/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_wps.c
deleted file mode 100644
index 4ad5e7e..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_handlers_wps.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface (WPS)
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-
-#include "common.h"
-#include "../config.h"
-#include "../wpa_supplicant_i.h"
-#include "../wps_supplicant.h"
-#include "../driver_i.h"
-#include "../ap.h"
-#include "dbus_new_helpers.h"
-#include "dbus_new.h"
-#include "dbus_new_handlers.h"
-#include "dbus_dict_helpers.h"
-
-
-struct wps_start_params {
- int role; /* 0 - not set, 1 - enrollee, 2 - registrar */
- int type; /* 0 - not set, 1 - pin, 2 - pbc */
- u8 *bssid;
- char *pin;
- u8 *p2p_dev_addr;
-};
-
-
-static int wpas_dbus_handler_wps_role(DBusMessage *message,
- DBusMessageIter *entry_iter,
- struct wps_start_params *params,
- DBusMessage **reply)
-{
- DBusMessageIter variant_iter;
- char *val;
-
- dbus_message_iter_recurse(entry_iter, &variant_iter);
- if (dbus_message_iter_get_arg_type(&variant_iter) !=
- DBUS_TYPE_STRING) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Role type, "
- "string required");
- *reply = wpas_dbus_error_invalid_args(message,
- "Role must be a string");
- return -1;
- }
- dbus_message_iter_get_basic(&variant_iter, &val);
- if (os_strcmp(val, "enrollee") == 0)
- params->role = 1;
- else if (os_strcmp(val, "registrar") == 0)
- params->role = 2;
- else {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Uknown role %s", val);
- *reply = wpas_dbus_error_invalid_args(message, val);
- return -1;
- }
- return 0;
-}
-
-
-static int wpas_dbus_handler_wps_type(DBusMessage *message,
- DBusMessageIter *entry_iter,
- struct wps_start_params *params,
- DBusMessage **reply)
-{
- DBusMessageIter variant_iter;
- char *val;
-
- dbus_message_iter_recurse(entry_iter, &variant_iter);
- if (dbus_message_iter_get_arg_type(&variant_iter) !=
- DBUS_TYPE_STRING) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Type type, "
- "string required");
- *reply = wpas_dbus_error_invalid_args(message,
- "Type must be a string");
- return -1;
- }
- dbus_message_iter_get_basic(&variant_iter, &val);
- if (os_strcmp(val, "pin") == 0)
- params->type = 1;
- else if (os_strcmp(val, "pbc") == 0)
- params->type = 2;
- else {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Unknown type %s",
- val);
- *reply = wpas_dbus_error_invalid_args(message, val);
- return -1;
- }
- return 0;
-}
-
-
-static int wpas_dbus_handler_wps_bssid(DBusMessage *message,
- DBusMessageIter *entry_iter,
- struct wps_start_params *params,
- DBusMessage **reply)
-{
- DBusMessageIter variant_iter, array_iter;
- int len;
-
- dbus_message_iter_recurse(entry_iter, &variant_iter);
- if (dbus_message_iter_get_arg_type(&variant_iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&variant_iter) !=
- DBUS_TYPE_BYTE) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Bssid type, "
- "byte array required");
- *reply = wpas_dbus_error_invalid_args(
- message, "Bssid must be a byte array");
- return -1;
- }
- dbus_message_iter_recurse(&variant_iter, &array_iter);
- dbus_message_iter_get_fixed_array(&array_iter, &params->bssid, &len);
- if (len != ETH_ALEN) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Stsrt - Wrong Bssid length "
- "%d", len);
- *reply = wpas_dbus_error_invalid_args(message,
- "Bssid is wrong length");
- return -1;
- }
- return 0;
-}
-
-
-static int wpas_dbus_handler_wps_pin(DBusMessage *message,
- DBusMessageIter *entry_iter,
- struct wps_start_params *params,
- DBusMessage **reply)
-{
- DBusMessageIter variant_iter;
-
- dbus_message_iter_recurse(entry_iter, &variant_iter);
- if (dbus_message_iter_get_arg_type(&variant_iter) !=
- DBUS_TYPE_STRING) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong Pin type, "
- "string required");
- *reply = wpas_dbus_error_invalid_args(message,
- "Pin must be a string");
- return -1;
- }
- dbus_message_iter_get_basic(&variant_iter, &params->pin);
- return 0;
-}
-
-
-#ifdef CONFIG_P2P
-static int wpas_dbus_handler_wps_p2p_dev_addr(DBusMessage *message,
- DBusMessageIter *entry_iter,
- struct wps_start_params *params,
- DBusMessage **reply)
-{
- DBusMessageIter variant_iter, array_iter;
- int len;
-
- dbus_message_iter_recurse(entry_iter, &variant_iter);
- if (dbus_message_iter_get_arg_type(&variant_iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&variant_iter) !=
- DBUS_TYPE_BYTE) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong "
- "P2PDeviceAddress type, byte array required");
- *reply = wpas_dbus_error_invalid_args(
- message, "P2PDeviceAddress must be a byte array");
- return -1;
- }
- dbus_message_iter_recurse(&variant_iter, &array_iter);
- dbus_message_iter_get_fixed_array(&array_iter, &params->p2p_dev_addr,
- &len);
- if (len != ETH_ALEN) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Wrong "
- "P2PDeviceAddress length %d", len);
- *reply = wpas_dbus_error_invalid_args(message,
- "P2PDeviceAddress "
- "has wrong length");
- return -1;
- }
- return 0;
-}
-#endif /* CONFIG_P2P */
-
-
-static int wpas_dbus_handler_wps_start_entry(DBusMessage *message, char *key,
- DBusMessageIter *entry_iter,
- struct wps_start_params *params,
- DBusMessage **reply)
-{
- if (os_strcmp(key, "Role") == 0)
- return wpas_dbus_handler_wps_role(message, entry_iter,
- params, reply);
- else if (os_strcmp(key, "Type") == 0)
- return wpas_dbus_handler_wps_type(message, entry_iter,
- params, reply);
- else if (os_strcmp(key, "Bssid") == 0)
- return wpas_dbus_handler_wps_bssid(message, entry_iter,
- params, reply);
- else if (os_strcmp(key, "Pin") == 0)
- return wpas_dbus_handler_wps_pin(message, entry_iter,
- params, reply);
-#ifdef CONFIG_P2P
- else if (os_strcmp(key, "P2PDeviceAddress") == 0)
- return wpas_dbus_handler_wps_p2p_dev_addr(message, entry_iter,
- params, reply);
-#endif /* CONFIG_P2P */
-
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - unknown key %s", key);
- *reply = wpas_dbus_error_invalid_args(message, key);
- return -1;
-}
-
-
-/**
- * wpas_dbus_handler_wps_start - Start WPS configuration
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: DBus message dictionary on success or DBus error on failure
- *
- * Handler for "Start" method call. DBus dictionary argument contains
- * information about role (enrollee or registrar), authorization method
- * (pin or push button) and optionally pin and bssid. Returned message
- * has a dictionary argument which may contain newly generated pin (optional).
- */
-DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- DBusMessageIter iter, dict_iter, entry_iter;
- struct wps_start_params params;
- char *key;
- char npin[9] = { '\0' };
- int ret;
-
- os_memset(&params, 0, sizeof(params));
- dbus_message_iter_init(message, &iter);
-
- dbus_message_iter_recurse(&iter, &dict_iter);
- while (dbus_message_iter_get_arg_type(&dict_iter) ==
- DBUS_TYPE_DICT_ENTRY) {
- dbus_message_iter_recurse(&dict_iter, &entry_iter);
-
- dbus_message_iter_get_basic(&entry_iter, &key);
- dbus_message_iter_next(&entry_iter);
-
- if (wpas_dbus_handler_wps_start_entry(message, key,
- &entry_iter,
- &params, &reply))
- return reply;
-
- dbus_message_iter_next(&dict_iter);
- }
-
- if (params.role == 0) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Role not specified");
- return wpas_dbus_error_invalid_args(message,
- "Role not specified");
- } else if (params.role == 1 && params.type == 0) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Type not specified");
- return wpas_dbus_error_invalid_args(message,
- "Type not specified");
- } else if (params.role == 2 && params.pin == NULL) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start - Pin required for "
- "registrar role");
- return wpas_dbus_error_invalid_args(
- message, "Pin required for registrar role.");
- }
-
- if (params.role == 2)
- ret = wpas_wps_start_reg(wpa_s, params.bssid, params.pin,
- NULL);
- else if (params.type == 1) {
-#ifdef CONFIG_AP
- if (wpa_s->ap_iface)
- ret = wpa_supplicant_ap_wps_pin(wpa_s,
- params.bssid,
- params.pin,
- npin, sizeof(npin), 0);
- else
-#endif /* CONFIG_AP */
- {
- ret = wpas_wps_start_pin(wpa_s, params.bssid,
- params.pin, 0,
- DEV_PW_DEFAULT);
- if (ret > 0)
- os_snprintf(npin, sizeof(npin), "%08d", ret);
- }
- } else {
-#ifdef CONFIG_AP
- if (wpa_s->ap_iface)
- ret = wpa_supplicant_ap_wps_pbc(wpa_s,
- params.bssid,
- params.p2p_dev_addr);
- else
-#endif /* CONFIG_AP */
- ret = wpas_wps_start_pbc(wpa_s, params.bssid, 0);
- }
-
- if (ret < 0) {
- wpa_printf(MSG_DEBUG, "dbus: WPS.Start wpas_wps_failed in "
- "role %s and key %s",
- (params.role == 1 ? "enrollee" : "registrar"),
- (params.type == 0 ? "" :
- (params.type == 1 ? "pin" : "pbc")));
- return wpas_dbus_error_unknown_error(message,
- "WPS start failed");
- }
-
- reply = dbus_message_new_method_return(message);
- if (!reply) {
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- }
-
- dbus_message_iter_init_append(reply, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) {
- dbus_message_unref(reply);
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- }
-
- if (os_strlen(npin) > 0) {
- if (!wpa_dbus_dict_append_string(&dict_iter, "Pin", npin)) {
- dbus_message_unref(reply);
- return dbus_message_new_error(message,
- DBUS_ERROR_NO_MEMORY,
- NULL);
- }
- }
-
- if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
- dbus_message_unref(reply);
- return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- NULL);
- }
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_getter_process_credentials - Check if credentials are processed
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: TRUE on success, FALSE on failure
- *
- * Getter for "ProcessCredentials" property. Returns returned boolean will be
- * true if wps_cred_processing configuration field is not equal to 1 or false
- * if otherwise.
- */
-dbus_bool_t wpas_dbus_getter_process_credentials(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_bool_t process = (wpa_s->conf->wps_cred_processing != 1);
- return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
- &process, error);
-}
-
-
-/**
- * wpas_dbus_setter_process_credentials - Set credentials_processed conf param
- * @iter: Pointer to incoming dbus message iter
- * @error: Location to store error on failure
- * @user_data: Function specific data
- * Returns: TRUE on success, FALSE on failure
- *
- * Setter for "ProcessCredentials" property. Sets credentials_processed on 2
- * if boolean argument is true or on 1 if otherwise.
- */
-dbus_bool_t wpas_dbus_setter_process_credentials(DBusMessageIter *iter,
- DBusError *error,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- dbus_bool_t process_credentials, old_pc;
-
- if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
- &process_credentials))
- return FALSE;
-
- old_pc = (wpa_s->conf->wps_cred_processing != 1);
- wpa_s->conf->wps_cred_processing = (process_credentials ? 2 : 1);
-
- if ((wpa_s->conf->wps_cred_processing != 1) != old_pc)
- wpa_dbus_mark_property_changed(wpa_s->global->dbus,
- wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_WPS,
- "ProcessCredentials");
-
- return TRUE;
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c b/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c
deleted file mode 100644
index cfa6a15..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.c
+++ /dev/null
@@ -1,1061 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "utils/includes.h"
-
-#include "utils/common.h"
-#include "utils/eloop.h"
-#include "dbus_common.h"
-#include "dbus_common_i.h"
-#include "dbus_new.h"
-#include "dbus_new_helpers.h"
-#include "dbus_dict_helpers.h"
-
-
-static dbus_bool_t fill_dict_with_properties(
- DBusMessageIter *dict_iter,
- const struct wpa_dbus_property_desc *props,
- const char *interface, void *user_data, DBusError *error)
-{
- DBusMessageIter entry_iter;
- const struct wpa_dbus_property_desc *dsc;
-
- for (dsc = props; dsc && dsc->dbus_property; dsc++) {
- /* Only return properties for the requested D-Bus interface */
- if (os_strncmp(dsc->dbus_interface, interface,
- WPAS_DBUS_INTERFACE_MAX) != 0)
- continue;
-
- /* Skip write-only properties */
- if (dsc->getter == NULL)
- continue;
-
- if (!dbus_message_iter_open_container(dict_iter,
- DBUS_TYPE_DICT_ENTRY,
- NULL, &entry_iter)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY,
- "no memory");
- return FALSE;
- }
- if (!dbus_message_iter_append_basic(&entry_iter,
- DBUS_TYPE_STRING,
- &dsc->dbus_property)) {
- dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY,
- "no memory");
- return FALSE;
- }
-
- /* An error getting a property fails the request entirely */
- if (!dsc->getter(&entry_iter, error, user_data))
- return FALSE;
-
- dbus_message_iter_close_container(dict_iter, &entry_iter);
- }
-
- return TRUE;
-}
-
-
-/**
- * get_all_properties - Responds for GetAll properties calls on object
- * @message: Message with GetAll call
- * @interface: interface name which properties will be returned
- * @property_dsc: list of object's properties
- * Returns: Message with dict of variants as argument with properties values
- *
- * Iterates over all properties registered with object and execute getters
- * of those, which are readable and which interface matches interface
- * specified as argument. Returned message contains one dict argument
- * with properties names as keys and theirs values as values.
- */
-static DBusMessage * get_all_properties(DBusMessage *message, char *interface,
- struct wpa_dbus_object_desc *obj_dsc)
-{
- DBusMessage *reply;
- DBusMessageIter iter, dict_iter;
- DBusError error;
-
- reply = dbus_message_new_method_return(message);
- if (reply == NULL) {
- wpa_printf(MSG_ERROR, "%s: out of memory creating dbus reply",
- __func__);
- return NULL;
- }
-
- dbus_message_iter_init_append(reply, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) {
- wpa_printf(MSG_ERROR, "%s: out of memory creating reply",
- __func__);
- dbus_message_unref(reply);
- reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
- "out of memory");
- return reply;
- }
-
- dbus_error_init(&error);
- if (!fill_dict_with_properties(&dict_iter, obj_dsc->properties,
- interface, obj_dsc->user_data, &error))
- {
- dbus_message_unref(reply);
- reply = wpas_dbus_reply_new_from_error(message, &error,
- DBUS_ERROR_INVALID_ARGS,
- "No readable properties"
- " in this interface");
- dbus_error_free(&error);
- return reply;
- }
-
- wpa_dbus_dict_close_write(&iter, &dict_iter);
- return reply;
-}
-
-
-static int is_signature_correct(DBusMessage *message,
- const struct wpa_dbus_method_desc *method_dsc)
-{
- /* According to DBus documentation max length of signature is 255 */
-#define MAX_SIG_LEN 256
- char registered_sig[MAX_SIG_LEN], *pos;
- const char *sig = dbus_message_get_signature(message);
- int ret;
- const struct wpa_dbus_argument *arg;
-
- pos = registered_sig;
- *pos = '\0';
-
- for (arg = method_dsc->args; arg && arg->name; arg++) {
- if (arg->dir == ARG_IN) {
- size_t blen = registered_sig + MAX_SIG_LEN - pos;
- ret = os_snprintf(pos, blen, "%s", arg->type);
- if (ret < 0 || (size_t) ret >= blen)
- return 0;
- pos += ret;
- }
- }
-
- return !os_strncmp(registered_sig, sig, MAX_SIG_LEN);
-}
-
-
-static DBusMessage * properties_get_all(DBusMessage *message, char *interface,
- struct wpa_dbus_object_desc *obj_dsc)
-{
- if (os_strcmp(dbus_message_get_signature(message), "s") != 0)
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- NULL);
-
- return get_all_properties(message, interface, obj_dsc);
-}
-
-
-static DBusMessage * properties_get(DBusMessage *message,
- const struct wpa_dbus_property_desc *dsc,
- void *user_data)
-{
- DBusMessage *reply;
- DBusMessageIter iter;
- DBusError error;
-
- if (os_strcmp(dbus_message_get_signature(message), "ss")) {
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- NULL);
- }
-
- if (dsc->getter == NULL) {
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- "Property is write-only");
- }
-
- reply = dbus_message_new_method_return(message);
- dbus_message_iter_init_append(reply, &iter);
-
- dbus_error_init(&error);
- if (dsc->getter(&iter, &error, user_data) == FALSE) {
- dbus_message_unref(reply);
- reply = wpas_dbus_reply_new_from_error(
- message, &error, DBUS_ERROR_FAILED,
- "Failed to read property");
- dbus_error_free(&error);
- }
-
- return reply;
-}
-
-
-static DBusMessage * properties_set(DBusMessage *message,
- const struct wpa_dbus_property_desc *dsc,
- void *user_data)
-{
- DBusMessage *reply;
- DBusMessageIter iter;
- DBusError error;
-
- if (os_strcmp(dbus_message_get_signature(message), "ssv")) {
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- NULL);
- }
-
- if (dsc->setter == NULL) {
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- "Property is read-only");
- }
-
- dbus_message_iter_init(message, &iter);
- /* Skip the interface name and the property name */
- dbus_message_iter_next(&iter);
- dbus_message_iter_next(&iter);
-
- /* Iter will now point to the property's new value */
- dbus_error_init(&error);
- if (dsc->setter(&iter, &error, user_data) == TRUE) {
- /* Success */
- reply = dbus_message_new_method_return(message);
- } else {
- reply = wpas_dbus_reply_new_from_error(
- message, &error, DBUS_ERROR_FAILED,
- "Failed to set property");
- dbus_error_free(&error);
- }
-
- return reply;
-}
-
-
-static DBusMessage *
-properties_get_or_set(DBusMessage *message, DBusMessageIter *iter,
- char *interface,
- struct wpa_dbus_object_desc *obj_dsc)
-{
- const struct wpa_dbus_property_desc *property_dsc;
- char *property;
- const char *method;
-
- method = dbus_message_get_member(message);
- property_dsc = obj_dsc->properties;
-
- /* Second argument: property name (DBUS_TYPE_STRING) */
- if (!dbus_message_iter_next(iter) ||
- dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING) {
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- NULL);
- }
- dbus_message_iter_get_basic(iter, &property);
-
- while (property_dsc && property_dsc->dbus_property) {
- /* compare property names and
- * interfaces */
- if (!os_strncmp(property_dsc->dbus_property, property,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX) &&
- !os_strncmp(property_dsc->dbus_interface, interface,
- WPAS_DBUS_INTERFACE_MAX))
- break;
-
- property_dsc++;
- }
- if (property_dsc == NULL || property_dsc->dbus_property == NULL) {
- wpa_printf(MSG_DEBUG, "no property handler for %s.%s on %s",
- interface, property,
- dbus_message_get_path(message));
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- "No such property");
- }
-
- if (os_strncmp(WPA_DBUS_PROPERTIES_GET, method,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX) == 0)
- return properties_get(message, property_dsc,
- obj_dsc->user_data);
-
- return properties_set(message, property_dsc, obj_dsc->user_data);
-}
-
-
-static DBusMessage * properties_handler(DBusMessage *message,
- struct wpa_dbus_object_desc *obj_dsc)
-{
- DBusMessageIter iter;
- char *interface;
- const char *method;
-
- method = dbus_message_get_member(message);
- dbus_message_iter_init(message, &iter);
-
- if (!os_strncmp(WPA_DBUS_PROPERTIES_GET, method,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX) ||
- !os_strncmp(WPA_DBUS_PROPERTIES_SET, method,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX) ||
- !os_strncmp(WPA_DBUS_PROPERTIES_GETALL, method,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX)) {
- /* First argument: interface name (DBUS_TYPE_STRING) */
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- {
- return dbus_message_new_error(message,
- DBUS_ERROR_INVALID_ARGS,
- NULL);
- }
-
- dbus_message_iter_get_basic(&iter, &interface);
-
- if (!os_strncmp(WPA_DBUS_PROPERTIES_GETALL, method,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX)) {
- /* GetAll */
- return properties_get_all(message, interface, obj_dsc);
- }
- /* Get or Set */
- return properties_get_or_set(message, &iter, interface,
- obj_dsc);
- }
- return dbus_message_new_error(message, DBUS_ERROR_UNKNOWN_METHOD,
- NULL);
-}
-
-
-static DBusMessage * msg_method_handler(DBusMessage *message,
- struct wpa_dbus_object_desc *obj_dsc)
-{
- const struct wpa_dbus_method_desc *method_dsc = obj_dsc->methods;
- const char *method;
- const char *msg_interface;
-
- method = dbus_message_get_member(message);
- msg_interface = dbus_message_get_interface(message);
-
- /* try match call to any registered method */
- while (method_dsc && method_dsc->dbus_method) {
- /* compare method names and interfaces */
- if (!os_strncmp(method_dsc->dbus_method, method,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX) &&
- !os_strncmp(method_dsc->dbus_interface, msg_interface,
- WPAS_DBUS_INTERFACE_MAX))
- break;
-
- method_dsc++;
- }
- if (method_dsc == NULL || method_dsc->dbus_method == NULL) {
- wpa_printf(MSG_DEBUG, "no method handler for %s.%s on %s",
- msg_interface, method,
- dbus_message_get_path(message));
- return dbus_message_new_error(message,
- DBUS_ERROR_UNKNOWN_METHOD, NULL);
- }
-
- if (!is_signature_correct(message, method_dsc)) {
- return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
- NULL);
- }
-
- return method_dsc->method_handler(message,
- obj_dsc->user_data);
-}
-
-
-/**
- * message_handler - Handles incoming DBus messages
- * @connection: DBus connection on which message was received
- * @message: Received message
- * @user_data: pointer to description of object to which message was sent
- * Returns: Returns information whether message was handled or not
- *
- * Reads message interface and method name, then checks if they matches one
- * of the special cases i.e. introspection call or properties get/getall/set
- * methods and handles it. Else it iterates over registered methods list
- * and tries to match method's name and interface to those read from message
- * If appropriate method was found its handler function is called and
- * response is sent. Otherwise, the DBUS_ERROR_UNKNOWN_METHOD error message
- * will be sent.
- */
-static DBusHandlerResult message_handler(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct wpa_dbus_object_desc *obj_dsc = user_data;
- const char *method;
- const char *path;
- const char *msg_interface;
- DBusMessage *reply;
-
- /* get method, interface and path the message is addressed to */
- method = dbus_message_get_member(message);
- path = dbus_message_get_path(message);
- msg_interface = dbus_message_get_interface(message);
- if (!method || !path || !msg_interface)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- wpa_printf(MSG_MSGDUMP, "dbus: %s.%s (%s)",
- msg_interface, method, path);
-
- /* if message is introspection method call */
- if (!os_strncmp(WPA_DBUS_INTROSPECTION_METHOD, method,
- WPAS_DBUS_METHOD_SIGNAL_PROP_MAX) &&
- !os_strncmp(WPA_DBUS_INTROSPECTION_INTERFACE, msg_interface,
- WPAS_DBUS_INTERFACE_MAX)) {
-#ifdef CONFIG_CTRL_IFACE_DBUS_INTRO
- reply = wpa_dbus_introspect(message, obj_dsc);
-#else /* CONFIG_CTRL_IFACE_DBUS_INTRO */
- reply = dbus_message_new_error(
- message, DBUS_ERROR_UNKNOWN_METHOD,
- "wpa_supplicant was compiled without "
- "introspection support.");
-#endif /* CONFIG_CTRL_IFACE_DBUS_INTRO */
- } else if (!os_strncmp(WPA_DBUS_PROPERTIES_INTERFACE, msg_interface,
- WPAS_DBUS_INTERFACE_MAX)) {
- /* if message is properties method call */
- reply = properties_handler(message, obj_dsc);
- } else {
- reply = msg_method_handler(message, obj_dsc);
- }
-
- /* If handler succeed returning NULL, reply empty message */
- if (!reply)
- reply = dbus_message_new_method_return(message);
- if (reply) {
- if (!dbus_message_get_no_reply(message))
- dbus_connection_send(connection, reply, NULL);
- dbus_message_unref(reply);
- }
-
- wpa_dbus_flush_all_changed_properties(connection);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-
-/**
- * free_dbus_object_desc - Frees object description data structure
- * @connection: DBus connection
- * @obj_dsc: Object description to free
- *
- * Frees each of properties, methods and signals description lists and
- * the object description structure itself.
- */
-void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc)
-{
- if (!obj_dsc)
- return;
-
- /* free handler's argument */
- if (obj_dsc->user_data_free_func)
- obj_dsc->user_data_free_func(obj_dsc->user_data);
-
- os_free(obj_dsc->path);
- os_free(obj_dsc->prop_changed_flags);
- os_free(obj_dsc);
-}
-
-
-static void free_dbus_object_desc_cb(DBusConnection *connection, void *obj_dsc)
-{
- free_dbus_object_desc(obj_dsc);
-}
-
-/**
- * wpa_dbus_ctrl_iface_init - Initialize dbus control interface
- * @application_data: Pointer to application specific data structure
- * @dbus_path: DBus path to interface object
- * @dbus_service: DBus service name to register with
- * @messageHandler: a pointer to function which will handle dbus messages
- * coming on interface
- * Returns: 0 on success, -1 on failure
- *
- * Initialize the dbus control interface and start receiving commands from
- * external programs over the bus.
- */
-int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface,
- char *dbus_path, char *dbus_service,
- struct wpa_dbus_object_desc *obj_desc)
-{
- DBusError error;
- int ret = -1;
- DBusObjectPathVTable wpa_vtable = {
- &free_dbus_object_desc_cb, &message_handler,
- NULL, NULL, NULL, NULL
- };
-
- obj_desc->connection = iface->con;
- obj_desc->path = os_strdup(dbus_path);
-
- /* Register the message handler for the global dbus interface */
- if (!dbus_connection_register_object_path(iface->con,
- dbus_path, &wpa_vtable,
- obj_desc)) {
- wpa_printf(MSG_ERROR, "dbus: Could not set up message "
- "handler");
- return -1;
- }
-
- /* Register our service with the message bus */
- dbus_error_init(&error);
- switch (dbus_bus_request_name(iface->con, dbus_service,
- 0, &error)) {
- case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
- ret = 0;
- break;
- case DBUS_REQUEST_NAME_REPLY_EXISTS:
- case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
- case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
- wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
- "already registered");
- break;
- default:
- wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
- "%s %s", error.name, error.message);
- break;
- }
- dbus_error_free(&error);
-
- if (ret != 0)
- return -1;
-
- wpa_printf(MSG_DEBUG, "Providing DBus service '%s'.", dbus_service);
-
- return 0;
-}
-
-
-/**
- * wpa_dbus_register_object_per_iface - Register a new object with dbus
- * @ctrl_iface: pointer to dbus private data
- * @path: DBus path to object
- * @ifname: interface name
- * @obj_desc: description of object's methods, signals and properties
- * Returns: 0 on success, -1 on error
- *
- * Registers a new interface with dbus and assigns it a dbus object path.
- */
-int wpa_dbus_register_object_per_iface(
- struct wpas_dbus_priv *ctrl_iface,
- const char *path, const char *ifname,
- struct wpa_dbus_object_desc *obj_desc)
-{
- DBusConnection *con;
- DBusError error;
-
- DBusObjectPathVTable vtable = {
- &free_dbus_object_desc_cb, &message_handler,
- NULL, NULL, NULL, NULL
- };
-
- /* Do nothing if the control interface is not turned on */
- if (ctrl_iface == NULL)
- return 0;
-
- con = ctrl_iface->con;
- obj_desc->connection = con;
- obj_desc->path = os_strdup(path);
-
- dbus_error_init(&error);
- /* Register the message handler for the interface functions */
- if (!dbus_connection_try_register_object_path(con, path, &vtable,
- obj_desc, &error)) {
- if (!os_strcmp(error.name, DBUS_ERROR_OBJECT_PATH_IN_USE)) {
- wpa_printf(MSG_DEBUG, "dbus: %s", error.message);
- } else {
- wpa_printf(MSG_ERROR, "dbus: Could not set up message "
- "handler for interface %s object %s",
- ifname, path);
- wpa_printf(MSG_ERROR, "dbus error: %s", error.name);
- wpa_printf(MSG_ERROR, "dbus: %s", error.message);
- }
- dbus_error_free(&error);
- return -1;
- }
-
- dbus_error_free(&error);
- return 0;
-}
-
-
-static void flush_object_timeout_handler(void *eloop_ctx, void *timeout_ctx);
-
-
-/**
- * wpa_dbus_unregister_object_per_iface - Unregisters DBus object
- * @ctrl_iface: Pointer to dbus private data
- * @path: DBus path to object which will be unregistered
- * Returns: Zero on success and -1 on failure
- *
- * Unregisters DBus object given by its path
- */
-int wpa_dbus_unregister_object_per_iface(
- struct wpas_dbus_priv *ctrl_iface, const char *path)
-{
- DBusConnection *con = ctrl_iface->con;
- struct wpa_dbus_object_desc *obj_desc = NULL;
-
- dbus_connection_get_object_path_data(con, path, (void **) &obj_desc);
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "dbus: %s: Could not obtain object's "
- "private data: %s", __func__, path);
- } else {
- eloop_cancel_timeout(flush_object_timeout_handler, con,
- obj_desc);
- }
-
- if (!dbus_connection_unregister_object_path(con, path))
- return -1;
-
- return 0;
-}
-
-
-static dbus_bool_t put_changed_properties(
- const struct wpa_dbus_object_desc *obj_dsc, const char *interface,
- DBusMessageIter *dict_iter, int clear_changed)
-{
- DBusMessageIter entry_iter;
- const struct wpa_dbus_property_desc *dsc;
- int i;
- DBusError error;
-
- for (dsc = obj_dsc->properties, i = 0; dsc && dsc->dbus_property;
- dsc++, i++) {
- if (obj_dsc->prop_changed_flags == NULL ||
- !obj_dsc->prop_changed_flags[i])
- continue;
- if (os_strcmp(dsc->dbus_interface, interface) != 0)
- continue;
- if (clear_changed)
- obj_dsc->prop_changed_flags[i] = 0;
-
- if (!dbus_message_iter_open_container(dict_iter,
- DBUS_TYPE_DICT_ENTRY,
- NULL, &entry_iter))
- return FALSE;
-
- if (!dbus_message_iter_append_basic(&entry_iter,
- DBUS_TYPE_STRING,
- &dsc->dbus_property))
- return FALSE;
-
- dbus_error_init(&error);
- if (!dsc->getter(&entry_iter, &error, obj_dsc->user_data)) {
- if (dbus_error_is_set (&error)) {
- wpa_printf(MSG_ERROR, "dbus: %s: Cannot get "
- "new value of property %s: (%s) %s",
- __func__, dsc->dbus_property,
- error.name, error.message);
- } else {
- wpa_printf(MSG_ERROR, "dbus: %s: Cannot get "
- "new value of property %s",
- __func__, dsc->dbus_property);
- }
- dbus_error_free(&error);
- return FALSE;
- }
-
- if (!dbus_message_iter_close_container(dict_iter, &entry_iter))
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static void do_send_prop_changed_signal(
- DBusConnection *con, const char *path, const char *interface,
- const struct wpa_dbus_object_desc *obj_dsc)
-{
- DBusMessage *msg;
- DBusMessageIter signal_iter, dict_iter;
-
- msg = dbus_message_new_signal(path, DBUS_INTERFACE_PROPERTIES,
- "PropertiesChanged");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &signal_iter);
-
- if (!dbus_message_iter_append_basic(&signal_iter, DBUS_TYPE_STRING,
- &interface))
- goto err;
-
- /* Changed properties dict */
- if (!dbus_message_iter_open_container(&signal_iter, DBUS_TYPE_ARRAY,
- "{sv}", &dict_iter))
- goto err;
-
- if (!put_changed_properties(obj_dsc, interface, &dict_iter, 0))
- goto err;
-
- if (!dbus_message_iter_close_container(&signal_iter, &dict_iter))
- goto err;
-
- /* Invalidated properties array (empty) */
- if (!dbus_message_iter_open_container(&signal_iter, DBUS_TYPE_ARRAY,
- "s", &dict_iter))
- goto err;
-
- if (!dbus_message_iter_close_container(&signal_iter, &dict_iter))
- goto err;
-
- dbus_connection_send(con, msg, NULL);
-
-out:
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_DEBUG, "dbus: %s: Failed to construct signal",
- __func__);
- goto out;
-}
-
-
-static void do_send_deprecated_prop_changed_signal(
- DBusConnection *con, const char *path, const char *interface,
- const struct wpa_dbus_object_desc *obj_dsc)
-{
- DBusMessage *msg;
- DBusMessageIter signal_iter, dict_iter;
-
- msg = dbus_message_new_signal(path, interface, "PropertiesChanged");
- if (msg == NULL)
- return;
-
- dbus_message_iter_init_append(msg, &signal_iter);
-
- if (!dbus_message_iter_open_container(&signal_iter, DBUS_TYPE_ARRAY,
- "{sv}", &dict_iter))
- goto err;
-
- if (!put_changed_properties(obj_dsc, interface, &dict_iter, 1))
- goto err;
-
- if (!dbus_message_iter_close_container(&signal_iter, &dict_iter))
- goto err;
-
- dbus_connection_send(con, msg, NULL);
-
-out:
- dbus_message_unref(msg);
- return;
-
-err:
- wpa_printf(MSG_DEBUG, "dbus: %s: Failed to construct signal",
- __func__);
- goto out;
-}
-
-
-static void send_prop_changed_signal(
- DBusConnection *con, const char *path, const char *interface,
- const struct wpa_dbus_object_desc *obj_dsc)
-{
- /*
- * First, send property change notification on the standardized
- * org.freedesktop.DBus.Properties interface. This call will not
- * clear the property change bits, so that they are preserved for
- * the call that follows.
- */
- do_send_prop_changed_signal(con, path, interface, obj_dsc);
-
- /*
- * Now send PropertiesChanged on our own interface for backwards
- * compatibility. This is deprecated and will be removed in a future
- * release.
- */
- do_send_deprecated_prop_changed_signal(con, path, interface, obj_dsc);
-
- /* Property change bits have now been cleared. */
-}
-
-
-static void flush_object_timeout_handler(void *eloop_ctx, void *timeout_ctx)
-{
- DBusConnection *con = eloop_ctx;
- struct wpa_dbus_object_desc *obj_desc = timeout_ctx;
-
- wpa_printf(MSG_DEBUG, "dbus: %s: Timeout - sending changed properties "
- "of object %s", __func__, obj_desc->path);
- wpa_dbus_flush_object_changed_properties(con, obj_desc->path);
-}
-
-
-static void recursive_flush_changed_properties(DBusConnection *con,
- const char *path)
-{
- char **objects = NULL;
- char subobj_path[WPAS_DBUS_OBJECT_PATH_MAX];
- int i;
-
- wpa_dbus_flush_object_changed_properties(con, path);
-
- if (!dbus_connection_list_registered(con, path, &objects))
- goto out;
-
- for (i = 0; objects[i]; i++) {
- os_snprintf(subobj_path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/%s", path, objects[i]);
- recursive_flush_changed_properties(con, subobj_path);
- }
-
-out:
- dbus_free_string_array(objects);
-}
-
-
-/**
- * wpa_dbus_flush_all_changed_properties - Send all PropertiesChanged signals
- * @con: DBus connection
- *
- * Traverses through all registered objects and sends PropertiesChanged for
- * each properties.
- */
-void wpa_dbus_flush_all_changed_properties(DBusConnection *con)
-{
- recursive_flush_changed_properties(con, WPAS_DBUS_NEW_PATH);
-}
-
-
-/**
- * wpa_dbus_flush_object_changed_properties - Send PropertiesChanged for object
- * @con: DBus connection
- * @path: path to a DBus object for which PropertiesChanged will be sent.
- *
- * Iterates over all properties registered with object and for each interface
- * containing properties marked as changed, sends a PropertiesChanged signal
- * containing names and new values of properties that have changed.
- *
- * You need to call this function after wpa_dbus_mark_property_changed()
- * if you want to send PropertiesChanged signal immediately (i.e., without
- * waiting timeout to expire). PropertiesChanged signal for an object is sent
- * automatically short time after first marking property as changed. All
- * PropertiesChanged signals are sent automatically after responding on DBus
- * message, so if you marked a property changed as a result of DBus call
- * (e.g., param setter), you usually do not need to call this function.
- */
-void wpa_dbus_flush_object_changed_properties(DBusConnection *con,
- const char *path)
-{
- struct wpa_dbus_object_desc *obj_desc = NULL;
- const struct wpa_dbus_property_desc *dsc;
- int i;
-
- dbus_connection_get_object_path_data(con, path, (void **) &obj_desc);
- if (!obj_desc)
- return;
- eloop_cancel_timeout(flush_object_timeout_handler, con, obj_desc);
-
- dsc = obj_desc->properties;
- for (dsc = obj_desc->properties, i = 0; dsc && dsc->dbus_property;
- dsc++, i++) {
- if (obj_desc->prop_changed_flags == NULL ||
- !obj_desc->prop_changed_flags[i])
- continue;
- send_prop_changed_signal(con, path, dsc->dbus_interface,
- obj_desc);
- }
-}
-
-
-#define WPA_DBUS_SEND_PROP_CHANGED_TIMEOUT 5000
-
-
-/**
- * wpa_dbus_mark_property_changed - Mark a property as changed and
- * @iface: dbus priv struct
- * @path: path to DBus object which property has changed
- * @interface: interface containing changed property
- * @property: property name which has changed
- *
- * Iterates over all properties registered with an object and marks the one
- * given in parameters as changed. All parameters registered for an object
- * within a single interface will be aggregated together and sent in one
- * PropertiesChanged signal when function
- * wpa_dbus_flush_object_changed_properties() is called.
- */
-void wpa_dbus_mark_property_changed(struct wpas_dbus_priv *iface,
- const char *path, const char *interface,
- const char *property)
-{
- struct wpa_dbus_object_desc *obj_desc = NULL;
- const struct wpa_dbus_property_desc *dsc;
- int i = 0;
-
- if (iface == NULL)
- return;
-
- dbus_connection_get_object_path_data(iface->con, path,
- (void **) &obj_desc);
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "dbus: wpa_dbus_property_changed: "
- "could not obtain object's private data: %s", path);
- return;
- }
-
- for (dsc = obj_desc->properties; dsc && dsc->dbus_property; dsc++, i++)
- if (os_strcmp(property, dsc->dbus_property) == 0 &&
- os_strcmp(interface, dsc->dbus_interface) == 0) {
- if (obj_desc->prop_changed_flags)
- obj_desc->prop_changed_flags[i] = 1;
- break;
- }
-
- if (!dsc || !dsc->dbus_property) {
- wpa_printf(MSG_ERROR, "dbus: wpa_dbus_property_changed: "
- "no property %s in object %s", property, path);
- return;
- }
-
- if (!eloop_is_timeout_registered(flush_object_timeout_handler,
- iface->con, obj_desc->path)) {
- eloop_register_timeout(0, WPA_DBUS_SEND_PROP_CHANGED_TIMEOUT,
- flush_object_timeout_handler,
- iface->con, obj_desc);
- }
-}
-
-
-/**
- * wpa_dbus_get_object_properties - Put object's properties into dictionary
- * @iface: dbus priv struct
- * @path: path to DBus object which properties will be obtained
- * @interface: interface name which properties will be obtained
- * @iter: DBus message iter at which to append property dictionary.
- *
- * Iterates over all properties registered with object and execute getters
- * of those, which are readable and which interface matches interface
- * specified as argument. Obtained properties values are stored in
- * dict_iter dictionary.
- */
-dbus_bool_t wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
- const char *path,
- const char *interface,
- DBusMessageIter *iter)
-{
- struct wpa_dbus_object_desc *obj_desc = NULL;
- DBusMessageIter dict_iter;
- DBusError error;
-
- dbus_connection_get_object_path_data(iface->con, path,
- (void **) &obj_desc);
- if (!obj_desc) {
- wpa_printf(MSG_ERROR, "dbus: %s: could not obtain object's "
- "private data: %s", __func__, path);
- return FALSE;
- }
-
- if (!wpa_dbus_dict_open_write(iter, &dict_iter)) {
- wpa_printf(MSG_ERROR, "dbus: %s: failed to open message dict",
- __func__);
- return FALSE;
- }
-
- dbus_error_init(&error);
- if (!fill_dict_with_properties(&dict_iter, obj_desc->properties,
- interface, obj_desc->user_data,
- &error)) {
- wpa_printf(MSG_ERROR, "dbus: %s: failed to get object"
- " properties: (%s) %s", __func__,
- dbus_error_is_set(&error) ? error.name : "none",
- dbus_error_is_set(&error) ? error.message : "none");
- dbus_error_free(&error);
- return FALSE;
- }
-
- return wpa_dbus_dict_close_write(iter, &dict_iter);
-}
-
-/**
- * wpas_dbus_new_decompose_object_path - Decompose an interface object path into parts
- * @path: The dbus object path
- * @p2p_persistent_group: indicates whether to parse the path as a P2P
- * persistent group object
- * @network: (out) the configured network this object path refers to, if any
- * @bssid: (out) the scanned bssid this object path refers to, if any
- * Returns: The object path of the network interface this path refers to
- *
- * For a given object path, decomposes the object path into object id, network,
- * and BSSID parts, if those parts exist.
- */
-char *wpas_dbus_new_decompose_object_path(const char *path,
- int p2p_persistent_group,
- char **network,
- char **bssid)
-{
- const unsigned int dev_path_prefix_len =
- os_strlen(WPAS_DBUS_NEW_PATH_INTERFACES "/");
- char *obj_path_only;
- char *next_sep;
-
- /* Be a bit paranoid about path */
- if (!path || os_strncmp(path, WPAS_DBUS_NEW_PATH_INTERFACES "/",
- dev_path_prefix_len))
- return NULL;
-
- /* Ensure there's something at the end of the path */
- if ((path + dev_path_prefix_len)[0] == '\0')
- return NULL;
-
- obj_path_only = os_strdup(path);
- if (obj_path_only == NULL)
- return NULL;
-
- next_sep = os_strchr(obj_path_only + dev_path_prefix_len, '/');
- if (next_sep != NULL) {
- const char *net_part = os_strstr(
- next_sep, p2p_persistent_group ?
- WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/" :
- WPAS_DBUS_NEW_NETWORKS_PART "/");
- const char *bssid_part = os_strstr(
- next_sep, WPAS_DBUS_NEW_BSSIDS_PART "/");
-
- if (network && net_part) {
- /* Deal with a request for a configured network */
- const char *net_name = net_part +
- os_strlen(p2p_persistent_group ?
- WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART
- "/" :
- WPAS_DBUS_NEW_NETWORKS_PART "/");
- *network = NULL;
- if (os_strlen(net_name))
- *network = os_strdup(net_name);
- } else if (bssid && bssid_part) {
- /* Deal with a request for a scanned BSSID */
- const char *bssid_name = bssid_part +
- os_strlen(WPAS_DBUS_NEW_BSSIDS_PART "/");
- if (os_strlen(bssid_name))
- *bssid = os_strdup(bssid_name);
- else
- *bssid = NULL;
- }
-
- /* Cut off interface object path before "/" */
- *next_sep = '\0';
- }
-
- return obj_path_only;
-}
-
-
-/**
- * wpas_dbus_reply_new_from_error - Create a new D-Bus error message from a
- * dbus error structure
- * @message: The original request message for which the error is a reply
- * @error: The error containing a name and a descriptive error cause
- * @fallback_name: A generic error name if @error was not set
- * @fallback_string: A generic error string if @error was not set
- * Returns: A new D-Bus error message
- *
- * Given a DBusMessage structure, creates a new D-Bus error message using
- * the error name and string contained in that structure.
- */
-DBusMessage * wpas_dbus_reply_new_from_error(DBusMessage *message,
- DBusError *error,
- const char *fallback_name,
- const char *fallback_string)
-{
- if (error && error->name && error->message) {
- return dbus_message_new_error(message, error->name,
- error->message);
- }
- if (fallback_name && fallback_string) {
- return dbus_message_new_error(message, fallback_name,
- fallback_string);
- }
- return NULL;
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.h b/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.h
deleted file mode 100644
index 6d31ad5..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_helpers.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef WPA_DBUS_CTRL_H
-#define WPA_DBUS_CTRL_H
-
-#include <dbus/dbus.h>
-
-typedef DBusMessage * (* WPADBusMethodHandler)(DBusMessage *message,
- void *user_data);
-typedef void (* WPADBusArgumentFreeFunction)(void *handler_arg);
-
-typedef dbus_bool_t (* WPADBusPropertyAccessor)(DBusMessageIter *iter,
- DBusError *error,
- void *user_data);
-
-struct wpa_dbus_object_desc {
- DBusConnection *connection;
- char *path;
-
- /* list of methods, properties and signals registered with object */
- const struct wpa_dbus_method_desc *methods;
- const struct wpa_dbus_signal_desc *signals;
- const struct wpa_dbus_property_desc *properties;
-
- /* property changed flags */
- u8 *prop_changed_flags;
-
- /* argument for method handlers and properties
- * getter and setter functions */
- void *user_data;
- /* function used to free above argument */
- WPADBusArgumentFreeFunction user_data_free_func;
-};
-
-enum dbus_arg_direction { ARG_IN, ARG_OUT };
-
-struct wpa_dbus_argument {
- char *name;
- char *type;
- enum dbus_arg_direction dir;
-};
-
-#define END_ARGS { NULL, NULL, ARG_IN }
-
-/**
- * struct wpa_dbus_method_desc - DBus method description
- */
-struct wpa_dbus_method_desc {
- /* method name */
- const char *dbus_method;
- /* method interface */
- const char *dbus_interface;
- /* method handling function */
- WPADBusMethodHandler method_handler;
- /* array of arguments */
- struct wpa_dbus_argument args[4];
-};
-
-/**
- * struct wpa_dbus_signal_desc - DBus signal description
- */
-struct wpa_dbus_signal_desc {
- /* signal name */
- const char *dbus_signal;
- /* signal interface */
- const char *dbus_interface;
- /* array of arguments */
- struct wpa_dbus_argument args[4];
-};
-
-/**
- * struct wpa_dbus_property_desc - DBus property description
- */
-struct wpa_dbus_property_desc {
- /* property name */
- const char *dbus_property;
- /* property interface */
- const char *dbus_interface;
- /* property type signature in DBus type notation */
- const char *type;
- /* property getter function */
- WPADBusPropertyAccessor getter;
- /* property setter function */
- WPADBusPropertyAccessor setter;
-};
-
-
-#define WPAS_DBUS_OBJECT_PATH_MAX 150
-#define WPAS_DBUS_INTERFACE_MAX 150
-#define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
-#define WPAS_DBUS_AUTH_MODE_MAX 64
-
-#define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
-#define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
-#define WPA_DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
-#define WPA_DBUS_PROPERTIES_GET "Get"
-#define WPA_DBUS_PROPERTIES_SET "Set"
-#define WPA_DBUS_PROPERTIES_GETALL "GetAll"
-
-void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
-
-int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
- char *dbus_service,
- struct wpa_dbus_object_desc *obj_desc);
-
-int wpa_dbus_register_object_per_iface(
- struct wpas_dbus_priv *ctrl_iface,
- const char *path, const char *ifname,
- struct wpa_dbus_object_desc *obj_desc);
-
-int wpa_dbus_unregister_object_per_iface(
- struct wpas_dbus_priv *ctrl_iface,
- const char *path);
-
-dbus_bool_t wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
- const char *path,
- const char *interface,
- DBusMessageIter *iter);
-
-
-void wpa_dbus_flush_all_changed_properties(DBusConnection *con);
-
-void wpa_dbus_flush_object_changed_properties(DBusConnection *con,
- const char *path);
-
-void wpa_dbus_mark_property_changed(struct wpas_dbus_priv *iface,
- const char *path, const char *interface,
- const char *property);
-
-DBusMessage * wpa_dbus_introspect(DBusMessage *message,
- struct wpa_dbus_object_desc *obj_dsc);
-
-char *wpas_dbus_new_decompose_object_path(const char *path,
- int p2p_persistent_group,
- char **network,
- char **bssid);
-
-DBusMessage *wpas_dbus_reply_new_from_error(DBusMessage *message,
- DBusError *error,
- const char *fallback_name,
- const char *fallback_string);
-
-#endif /* WPA_DBUS_CTRL_H */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_new_introspect.c b/contrib/wpa/wpa_supplicant/dbus/dbus_new_introspect.c
deleted file mode 100644
index 3b090c0..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_new_introspect.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * wpa_supplicant - D-Bus introspection
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- * Copyright (c) 2009, Witold Sowa <witold.sowa@gmail.com>
- * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "utils/includes.h"
-
-#include "utils/common.h"
-#include "utils/list.h"
-#include "utils/wpabuf.h"
-#include "dbus_common_i.h"
-#include "dbus_new_helpers.h"
-
-
-struct interfaces {
- struct dl_list list;
- char *dbus_interface;
- struct wpabuf *xml;
-};
-
-
-static struct interfaces * add_interface(struct dl_list *list,
- const char *dbus_interface)
-{
- struct interfaces *iface;
-
- dl_list_for_each(iface, list, struct interfaces, list) {
- if (os_strcmp(iface->dbus_interface, dbus_interface) == 0)
- return iface; /* already in the list */
- }
-
- iface = os_zalloc(sizeof(struct interfaces));
- if (!iface)
- return NULL;
- iface->xml = wpabuf_alloc(6000);
- if (iface->xml == NULL) {
- os_free(iface);
- return NULL;
- }
- wpabuf_printf(iface->xml, "<interface name=\"%s\">", dbus_interface);
- dl_list_add_tail(list, &iface->list);
- iface->dbus_interface = os_strdup(dbus_interface);
- return iface;
-}
-
-
-static void add_arg(struct wpabuf *xml, const char *name, const char *type,
- const char *direction)
-{
- wpabuf_printf(xml, "<arg name=\"%s\"", name);
- if (type)
- wpabuf_printf(xml, " type=\"%s\"", type);
- if (direction)
- wpabuf_printf(xml, " direction=\"%s\"", direction);
- wpabuf_put_str(xml, "/>");
-}
-
-
-static void add_entry(struct wpabuf *xml, const char *type, const char *name,
- const struct wpa_dbus_argument *args, int include_dir)
-{
- const struct wpa_dbus_argument *arg;
-
- if (args == NULL || args->name == NULL) {
- wpabuf_printf(xml, "<%s name=\"%s\"/>", type, name);
- return;
- }
- wpabuf_printf(xml, "<%s name=\"%s\">", type, name);
- for (arg = args; arg && arg->name; arg++) {
- add_arg(xml, arg->name, arg->type,
- include_dir ? (arg->dir == ARG_IN ? "in" : "out") :
- NULL);
- }
- wpabuf_printf(xml, "</%s>", type);
-}
-
-
-static void add_property(struct wpabuf *xml,
- const struct wpa_dbus_property_desc *dsc)
-{
- wpabuf_printf(xml, "<property name=\"%s\" type=\"%s\" "
- "access=\"%s%s\"/>",
- dsc->dbus_property, dsc->type,
- dsc->getter ? "read" : "",
- dsc->setter ? "write" : "");
-}
-
-
-static void extract_interfaces_methods(
- struct dl_list *list, const struct wpa_dbus_method_desc *methods)
-{
- const struct wpa_dbus_method_desc *dsc;
- struct interfaces *iface;
- for (dsc = methods; dsc && dsc->dbus_method; dsc++) {
- iface = add_interface(list, dsc->dbus_interface);
- if (iface)
- add_entry(iface->xml, "method", dsc->dbus_method,
- dsc->args, 1);
- }
-}
-
-
-static void extract_interfaces_signals(
- struct dl_list *list, const struct wpa_dbus_signal_desc *signals)
-{
- const struct wpa_dbus_signal_desc *dsc;
- struct interfaces *iface;
- for (dsc = signals; dsc && dsc->dbus_signal; dsc++) {
- iface = add_interface(list, dsc->dbus_interface);
- if (iface)
- add_entry(iface->xml, "signal", dsc->dbus_signal,
- dsc->args, 0);
- }
-}
-
-
-static void extract_interfaces_properties(
- struct dl_list *list, const struct wpa_dbus_property_desc *properties)
-{
- const struct wpa_dbus_property_desc *dsc;
- struct interfaces *iface;
- for (dsc = properties; dsc && dsc->dbus_property; dsc++) {
- iface = add_interface(list, dsc->dbus_interface);
- if (iface)
- add_property(iface->xml, dsc);
- }
-}
-
-
-/**
- * extract_interfaces - Extract interfaces from methods, signals and props
- * @list: Interface list to be filled
- * @obj_dsc: Description of object from which interfaces will be extracted
- *
- * Iterates over all methods, signals, and properties registered with an
- * object and collects all declared DBus interfaces and create interfaces'
- * node in XML root node for each. Returned list elements contain interface
- * name and XML node of corresponding interface.
- */
-static void extract_interfaces(struct dl_list *list,
- struct wpa_dbus_object_desc *obj_dsc)
-{
- extract_interfaces_methods(list, obj_dsc->methods);
- extract_interfaces_signals(list, obj_dsc->signals);
- extract_interfaces_properties(list, obj_dsc->properties);
-}
-
-
-static void add_interfaces(struct dl_list *list, struct wpabuf *xml)
-{
- struct interfaces *iface, *n;
- dl_list_for_each_safe(iface, n, list, struct interfaces, list) {
- if (wpabuf_len(iface->xml) + 20 < wpabuf_tailroom(xml)) {
- wpabuf_put_buf(xml, iface->xml);
- wpabuf_put_str(xml, "</interface>");
- } else {
- wpa_printf(MSG_DEBUG, "dbus: Not enough room for "
- "add_interfaces inspect data: tailroom %u, "
- "add %u",
- (unsigned int) wpabuf_tailroom(xml),
- (unsigned int) wpabuf_len(iface->xml));
- }
- dl_list_del(&iface->list);
- wpabuf_free(iface->xml);
- os_free(iface->dbus_interface);
- os_free(iface);
- }
-}
-
-
-static void add_child_nodes(struct wpabuf *xml, DBusConnection *con,
- const char *path)
-{
- char **children;
- int i;
-
- /* add child nodes to introspection tree */
- dbus_connection_list_registered(con, path, &children);
- for (i = 0; children[i]; i++)
- wpabuf_printf(xml, "<node name=\"%s\"/>", children[i]);
- dbus_free_string_array(children);
-}
-
-
-static void add_introspectable_interface(struct wpabuf *xml)
-{
- wpabuf_printf(xml, "<interface name=\"%s\">"
- "<method name=\"%s\">"
- "<arg name=\"data\" type=\"s\" direction=\"out\"/>"
- "</method>"
- "</interface>",
- WPA_DBUS_INTROSPECTION_INTERFACE,
- WPA_DBUS_INTROSPECTION_METHOD);
-}
-
-
-static void add_properties_interface(struct wpabuf *xml)
-{
- wpabuf_printf(xml, "<interface name=\"%s\">",
- WPA_DBUS_PROPERTIES_INTERFACE);
-
- wpabuf_printf(xml, "<method name=\"%s\">", WPA_DBUS_PROPERTIES_GET);
- add_arg(xml, "interface", "s", "in");
- add_arg(xml, "propname", "s", "in");
- add_arg(xml, "value", "v", "out");
- wpabuf_put_str(xml, "</method>");
-
- wpabuf_printf(xml, "<method name=\"%s\">", WPA_DBUS_PROPERTIES_GETALL);
- add_arg(xml, "interface", "s", "in");
- add_arg(xml, "props", "a{sv}", "out");
- wpabuf_put_str(xml, "</method>");
-
- wpabuf_printf(xml, "<method name=\"%s\">", WPA_DBUS_PROPERTIES_SET);
- add_arg(xml, "interface", "s", "in");
- add_arg(xml, "propname", "s", "in");
- add_arg(xml, "value", "v", "in");
- wpabuf_put_str(xml, "</method>");
-
- wpabuf_put_str(xml, "</interface>");
-}
-
-
-static void add_wpas_interfaces(struct wpabuf *xml,
- struct wpa_dbus_object_desc *obj_dsc)
-{
- struct dl_list ifaces;
- dl_list_init(&ifaces);
- extract_interfaces(&ifaces, obj_dsc);
- add_interfaces(&ifaces, xml);
-}
-
-
-/**
- * wpa_dbus_introspect - Responds for Introspect calls on object
- * @message: Message with Introspect call
- * @obj_dsc: Object description on which Introspect was called
- * Returns: Message with introspection result XML string as only argument
- *
- * Iterates over all methods, signals and properties registered with
- * object and generates introspection data for the object as XML string.
- */
-DBusMessage * wpa_dbus_introspect(DBusMessage *message,
- struct wpa_dbus_object_desc *obj_dsc)
-{
-
- DBusMessage *reply;
- struct wpabuf *xml;
-
- xml = wpabuf_alloc(10000);
- if (xml == NULL)
- return NULL;
-
- wpabuf_put_str(xml, "<?xml version=\"1.0\"?>\n");
- wpabuf_put_str(xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE);
- wpabuf_put_str(xml, "<node>");
-
- add_introspectable_interface(xml);
- add_properties_interface(xml);
- add_wpas_interfaces(xml, obj_dsc);
- add_child_nodes(xml, obj_dsc->connection,
- dbus_message_get_path(message));
-
- wpabuf_put_str(xml, "</node>\n");
-
- reply = dbus_message_new_method_return(message);
- if (reply) {
- const char *intro_str = wpabuf_head(xml);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &intro_str,
- DBUS_TYPE_INVALID);
- }
- wpabuf_free(xml);
-
- return reply;
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_old.c b/contrib/wpa/wpa_supplicant/dbus/dbus_old.c
deleted file mode 100644
index 5f298e7..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_old.c
+++ /dev/null
@@ -1,743 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-#include <dbus/dbus.h>
-
-#include "common.h"
-#include "eloop.h"
-#include "wps/wps.h"
-#include "../config.h"
-#include "../wpa_supplicant_i.h"
-#include "../bss.h"
-#include "dbus_old.h"
-#include "dbus_old_handlers.h"
-#include "dbus_common_i.h"
-
-
-/**
- * wpas_dbus_decompose_object_path - Decompose an interface object path into parts
- * @path: The dbus object path
- * @network: (out) the configured network this object path refers to, if any
- * @bssid: (out) the scanned bssid this object path refers to, if any
- * Returns: The object path of the network interface this path refers to
- *
- * For a given object path, decomposes the object path into object id, network,
- * and BSSID parts, if those parts exist.
- */
-char * wpas_dbus_decompose_object_path(const char *path, char **network,
- char **bssid)
-{
- const unsigned int dev_path_prefix_len =
- strlen(WPAS_DBUS_PATH_INTERFACES "/");
- char *obj_path_only;
- char *next_sep;
-
- /* Be a bit paranoid about path */
- if (!path || strncmp(path, WPAS_DBUS_PATH_INTERFACES "/",
- dev_path_prefix_len))
- return NULL;
-
- /* Ensure there's something at the end of the path */
- if ((path + dev_path_prefix_len)[0] == '\0')
- return NULL;
-
- obj_path_only = os_strdup(path);
- if (obj_path_only == NULL)
- return NULL;
-
- next_sep = strchr(obj_path_only + dev_path_prefix_len, '/');
- if (next_sep != NULL) {
- const char *net_part = strstr(next_sep,
- WPAS_DBUS_NETWORKS_PART "/");
- const char *bssid_part = strstr(next_sep,
- WPAS_DBUS_BSSIDS_PART "/");
-
- if (network && net_part) {
- /* Deal with a request for a configured network */
- const char *net_name = net_part +
- strlen(WPAS_DBUS_NETWORKS_PART "/");
- *network = NULL;
- if (strlen(net_name))
- *network = os_strdup(net_name);
- } else if (bssid && bssid_part) {
- /* Deal with a request for a scanned BSSID */
- const char *bssid_name = bssid_part +
- strlen(WPAS_DBUS_BSSIDS_PART "/");
- if (strlen(bssid_name))
- *bssid = os_strdup(bssid_name);
- else
- *bssid = NULL;
- }
-
- /* Cut off interface object path before "/" */
- *next_sep = '\0';
- }
-
- return obj_path_only;
-}
-
-
-/**
- * wpas_dbus_new_invalid_iface_error - Return a new invalid interface error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: A dbus error message
- *
- * Convenience function to create and return an invalid interface error
- */
-DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message)
-{
- return dbus_message_new_error(message, WPAS_ERROR_INVALID_IFACE,
- "wpa_supplicant knows nothing about "
- "this interface.");
-}
-
-
-/**
- * wpas_dbus_new_invalid_network_error - Return a new invalid network error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: a dbus error message
- *
- * Convenience function to create and return an invalid network error
- */
-DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message)
-{
- return dbus_message_new_error(message, WPAS_ERROR_INVALID_NETWORK,
- "The requested network does not exist.");
-}
-
-
-/**
- * wpas_dbus_new_invalid_bssid_error - Return a new invalid bssid error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: a dbus error message
- *
- * Convenience function to create and return an invalid bssid error
- */
-static DBusMessage * wpas_dbus_new_invalid_bssid_error(DBusMessage *message)
-{
- return dbus_message_new_error(message, WPAS_ERROR_INVALID_BSSID,
- "The BSSID requested was invalid.");
-}
-
-
-/**
- * wpas_dispatch_network_method - dispatch messages for configured networks
- * @message: the incoming dbus message
- * @wpa_s: a network interface's data
- * @network_id: id of the configured network we're interested in
- * Returns: a reply dbus message, or a dbus error message
- *
- * This function dispatches all incoming dbus messages for configured networks.
- */
-static DBusMessage * wpas_dispatch_network_method(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- int network_id)
-{
- DBusMessage *reply = NULL;
- const char *method = dbus_message_get_member(message);
- struct wpa_ssid *ssid;
-
- ssid = wpa_config_get_network(wpa_s->conf, network_id);
- if (ssid == NULL)
- return wpas_dbus_new_invalid_network_error(message);
-
- if (!strcmp(method, "set"))
- reply = wpas_dbus_iface_set_network(message, wpa_s, ssid);
- else if (!strcmp(method, "enable"))
- reply = wpas_dbus_iface_enable_network(message, wpa_s, ssid);
- else if (!strcmp(method, "disable"))
- reply = wpas_dbus_iface_disable_network(message, wpa_s, ssid);
-
- return reply;
-}
-
-
-/**
- * wpas_dispatch_bssid_method - dispatch messages for scanned networks
- * @message: the incoming dbus message
- * @wpa_s: a network interface's data
- * @bssid: bssid of the scanned network we're interested in
- * Returns: a reply dbus message, or a dbus error message
- *
- * This function dispatches all incoming dbus messages for scanned networks.
- */
-static DBusMessage * wpas_dispatch_bssid_method(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- const char *bssid_txt)
-{
- u8 bssid[ETH_ALEN];
- struct wpa_bss *bss;
-
- if (hexstr2bin(bssid_txt, bssid, ETH_ALEN) < 0)
- return wpas_dbus_new_invalid_bssid_error(message);
-
- bss = wpa_bss_get_bssid(wpa_s, bssid);
- if (bss == NULL)
- return wpas_dbus_new_invalid_bssid_error(message);
-
- /* Dispatch the method call against the scanned bssid */
- if (os_strcmp(dbus_message_get_member(message), "properties") == 0)
- return wpas_dbus_bssid_properties(message, wpa_s, bss);
-
- return NULL;
-}
-
-
-/**
- * wpas_iface_message_handler - Dispatch messages for interfaces or networks
- * @connection: Connection to the system message bus
- * @message: An incoming dbus message
- * @user_data: A pointer to a dbus control interface data structure
- * Returns: Whether or not the message was handled
- *
- * This function dispatches all incoming dbus messages for network interfaces,
- * or objects owned by them, such as scanned BSSIDs and configured networks.
- */
-static DBusHandlerResult wpas_iface_message_handler(DBusConnection *connection,
- DBusMessage *message,
- void *user_data)
-{
- struct wpa_supplicant *wpa_s = user_data;
- const char *method = dbus_message_get_member(message);
- const char *path = dbus_message_get_path(message);
- const char *msg_interface = dbus_message_get_interface(message);
- char *iface_obj_path = NULL;
- char *network = NULL;
- char *bssid = NULL;
- DBusMessage *reply = NULL;
-
- /* Caller must specify a message interface */
- if (!msg_interface)
- goto out;
-
- iface_obj_path = wpas_dbus_decompose_object_path(path, &network,
- &bssid);
- if (iface_obj_path == NULL) {
- reply = wpas_dbus_new_invalid_iface_error(message);
- goto out;
- }
-
- /* Make sure the message's object path actually refers to the
- * wpa_supplicant structure it's supposed to (which is wpa_s)
- */
- if (wpa_supplicant_get_iface_by_dbus_path(wpa_s->global,
- iface_obj_path) != wpa_s) {
- reply = wpas_dbus_new_invalid_iface_error(message);
- goto out;
- }
-
- if (network && !strcmp(msg_interface, WPAS_DBUS_IFACE_NETWORK)) {
- /* A method for one of this interface's configured networks */
- int nid = strtoul(network, NULL, 10);
- if (errno != EINVAL)
- reply = wpas_dispatch_network_method(message, wpa_s,
- nid);
- else
- reply = wpas_dbus_new_invalid_network_error(message);
- } else if (bssid && !strcmp(msg_interface, WPAS_DBUS_IFACE_BSSID)) {
- /* A method for one of this interface's scanned BSSIDs */
- reply = wpas_dispatch_bssid_method(message, wpa_s, bssid);
- } else if (!strcmp(msg_interface, WPAS_DBUS_IFACE_INTERFACE)) {
- /* A method for an interface only. */
- if (!strcmp(method, "scan"))
- reply = wpas_dbus_iface_scan(message, wpa_s);
- else if (!strcmp(method, "scanResults"))
- reply = wpas_dbus_iface_scan_results(message, wpa_s);
- else if (!strcmp(method, "addNetwork"))
- reply = wpas_dbus_iface_add_network(message, wpa_s);
- else if (!strcmp(method, "removeNetwork"))
- reply = wpas_dbus_iface_remove_network(message, wpa_s);
- else if (!strcmp(method, "selectNetwork"))
- reply = wpas_dbus_iface_select_network(message, wpa_s);
- else if (!strcmp(method, "capabilities"))
- reply = wpas_dbus_iface_capabilities(message, wpa_s);
- else if (!strcmp(method, "disconnect"))
- reply = wpas_dbus_iface_disconnect(message, wpa_s);
- else if (!strcmp(method, "setAPScan"))
- reply = wpas_dbus_iface_set_ap_scan(message, wpa_s);
- else if (!strcmp(method, "setSmartcardModules"))
- reply = wpas_dbus_iface_set_smartcard_modules(message,
- wpa_s);
- else if (!strcmp(method, "state"))
- reply = wpas_dbus_iface_get_state(message, wpa_s);
- else if (!strcmp(method, "scanning"))
- reply = wpas_dbus_iface_get_scanning(message, wpa_s);
- else if (!strcmp(method, "setBlobs"))
- reply = wpas_dbus_iface_set_blobs(message, wpa_s);
- else if (!strcmp(method, "removeBlobs"))
- reply = wpas_dbus_iface_remove_blobs(message, wpa_s);
-#ifdef CONFIG_WPS
- else if (!os_strcmp(method, "wpsPbc"))
- reply = wpas_dbus_iface_wps_pbc(message, wpa_s);
- else if (!os_strcmp(method, "wpsPin"))
- reply = wpas_dbus_iface_wps_pin(message, wpa_s);
- else if (!os_strcmp(method, "wpsReg"))
- reply = wpas_dbus_iface_wps_reg(message, wpa_s);
-#endif /* CONFIG_WPS */
- else if (!os_strcmp(method, "flush"))
- reply = wpas_dbus_iface_flush(message, wpa_s);
- }
-
- /* If the message was handled, send back the reply */
- if (reply) {
- if (!dbus_message_get_no_reply(message))
- dbus_connection_send(connection, reply, NULL);
- dbus_message_unref(reply);
- }
-
-out:
- os_free(iface_obj_path);
- os_free(network);
- os_free(bssid);
- return reply ? DBUS_HANDLER_RESULT_HANDLED :
- DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-/**
- * wpas_message_handler - dispatch incoming dbus messages
- * @connection: connection to the system message bus
- * @message: an incoming dbus message
- * @user_data: a pointer to a dbus control interface data structure
- * Returns: whether or not the message was handled
- *
- * This function dispatches all incoming dbus messages to the correct
- * handlers, depending on what the message's target object path is,
- * and what the method call is.
- */
-static DBusHandlerResult wpas_message_handler(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct wpas_dbus_priv *ctrl_iface = user_data;
- const char *method;
- const char *path;
- const char *msg_interface;
- DBusMessage *reply = NULL;
-
- method = dbus_message_get_member(message);
- path = dbus_message_get_path(message);
- msg_interface = dbus_message_get_interface(message);
- if (!method || !path || !ctrl_iface || !msg_interface)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- /* Validate the method interface */
- if (strcmp(msg_interface, WPAS_DBUS_INTERFACE) != 0)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (!strcmp(path, WPAS_DBUS_PATH)) {
- /* dispatch methods against our global dbus interface here */
- if (!strcmp(method, "addInterface")) {
- reply = wpas_dbus_global_add_interface(
- message, ctrl_iface->global);
- } else if (!strcmp(method, "removeInterface")) {
- reply = wpas_dbus_global_remove_interface(
- message, ctrl_iface->global);
- } else if (!strcmp(method, "getInterface")) {
- reply = wpas_dbus_global_get_interface(
- message, ctrl_iface->global);
- } else if (!strcmp(method, "setDebugParams")) {
- reply = wpas_dbus_global_set_debugparams(
- message, ctrl_iface->global);
- }
- }
-
- /* If the message was handled, send back the reply */
- if (reply) {
- if (!dbus_message_get_no_reply(message))
- dbus_connection_send(connection, reply, NULL);
- dbus_message_unref(reply);
- }
-
- return reply ? DBUS_HANDLER_RESULT_HANDLED :
- DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-/**
- * wpa_supplicant_dbus_notify_scan_results - Send a scan results signal
- * @wpa_s: %wpa_supplicant network interface data
- * Returns: 0 on success, -1 on failure
- *
- * Notify listeners that this interface has updated scan results.
- */
-void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
-{
- struct wpas_dbus_priv *iface = wpa_s->global->dbus;
- DBusMessage *_signal;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- _signal = dbus_message_new_signal(wpa_s->dbus_path,
- WPAS_DBUS_IFACE_INTERFACE,
- "ScanResultsAvailable");
- if (_signal == NULL) {
- wpa_printf(MSG_ERROR, "dbus: Not enough memory to send scan "
- "results signal");
- return;
- }
- dbus_connection_send(iface->con, _signal, NULL);
- dbus_message_unref(_signal);
-}
-
-
-/**
- * wpa_supplicant_dbus_notify_state_change - Send a state change signal
- * @wpa_s: %wpa_supplicant network interface data
- * @new_state: new state wpa_supplicant is entering
- * @old_state: old state wpa_supplicant is leaving
- * Returns: 0 on success, -1 on failure
- *
- * Notify listeners that wpa_supplicant has changed state
- */
-void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
- enum wpa_states new_state,
- enum wpa_states old_state)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *_signal = NULL;
- const char *new_state_str, *old_state_str;
-
- if (wpa_s->dbus_path == NULL)
- return; /* Skip signal since D-Bus setup is not yet ready */
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s->global == NULL)
- return;
- iface = wpa_s->global->dbus;
- if (iface == NULL)
- return;
-
- /* Only send signal if state really changed */
- if (new_state == old_state)
- return;
-
- _signal = dbus_message_new_signal(wpa_s->dbus_path,
- WPAS_DBUS_IFACE_INTERFACE,
- "StateChange");
- if (_signal == NULL) {
- wpa_printf(MSG_ERROR,
- "dbus: wpa_supplicant_dbus_notify_state_change: "
- "could not create dbus signal; likely out of "
- "memory");
- return;
- }
-
- new_state_str = wpa_supplicant_state_txt(new_state);
- old_state_str = wpa_supplicant_state_txt(old_state);
- if (new_state_str == NULL || old_state_str == NULL) {
- wpa_printf(MSG_ERROR,
- "dbus: wpa_supplicant_dbus_notify_state_change: "
- "Could not convert state strings");
- goto out;
- }
-
- if (!dbus_message_append_args(_signal,
- DBUS_TYPE_STRING, &new_state_str,
- DBUS_TYPE_STRING, &old_state_str,
- DBUS_TYPE_INVALID)) {
- wpa_printf(MSG_ERROR,
- "dbus: wpa_supplicant_dbus_notify_state_change: "
- "Not enough memory to construct state change "
- "signal");
- goto out;
- }
-
- dbus_connection_send(iface->con, _signal, NULL);
-
-out:
- dbus_message_unref(_signal);
-}
-
-
-/**
- * wpa_supplicant_dbus_notify_scanning - send scanning status
- * @wpa_s: %wpa_supplicant network interface data
- * Returns: 0 on success, -1 on failure
- *
- * Notify listeners of interface scanning state changes
- */
-void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
-{
- struct wpas_dbus_priv *iface = wpa_s->global->dbus;
- DBusMessage *_signal;
- dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
-
- /* Do nothing if the control interface is not turned on */
- if (iface == NULL)
- return;
-
- _signal = dbus_message_new_signal(wpa_s->dbus_path,
- WPAS_DBUS_IFACE_INTERFACE,
- "Scanning");
- if (_signal == NULL) {
- wpa_printf(MSG_ERROR, "dbus: Not enough memory to send scan "
- "results signal");
- return;
- }
-
- if (dbus_message_append_args(_signal,
- DBUS_TYPE_BOOLEAN, &scanning,
- DBUS_TYPE_INVALID)) {
- dbus_connection_send(iface->con, _signal, NULL);
- } else {
- wpa_printf(MSG_ERROR, "dbus: Not enough memory to construct "
- "signal");
- }
- dbus_message_unref(_signal);
-}
-
-
-#ifdef CONFIG_WPS
-void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *_signal = NULL;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s->global == NULL)
- return;
- iface = wpa_s->global->dbus;
- if (iface == NULL)
- return;
-
- _signal = dbus_message_new_signal(wpa_s->dbus_path,
- WPAS_DBUS_IFACE_INTERFACE,
- "WpsCred");
- if (_signal == NULL) {
- wpa_printf(MSG_ERROR,
- "dbus: wpa_supplicant_dbus_notify_wps_cred: "
- "Could not create dbus signal; likely out of "
- "memory");
- return;
- }
-
- if (!dbus_message_append_args(_signal,
- DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
- &cred->cred_attr, cred->cred_attr_len,
- DBUS_TYPE_INVALID)) {
- wpa_printf(MSG_ERROR,
- "dbus: wpa_supplicant_dbus_notify_wps_cred: "
- "Not enough memory to construct signal");
- goto out;
- }
-
- dbus_connection_send(iface->con, _signal, NULL);
-
-out:
- dbus_message_unref(_signal);
-}
-#else /* CONFIG_WPS */
-void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred)
-{
-}
-#endif /* CONFIG_WPS */
-
-void wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s,
- int depth, const char *subject,
- const char *cert_hash,
- const struct wpabuf *cert)
-{
- struct wpas_dbus_priv *iface;
- DBusMessage *_signal = NULL;
- const char *hash;
- const char *cert_hex;
- int cert_hex_len;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s->global == NULL)
- return;
- iface = wpa_s->global->dbus;
- if (iface == NULL)
- return;
-
- _signal = dbus_message_new_signal(wpa_s->dbus_path,
- WPAS_DBUS_IFACE_INTERFACE,
- "Certification");
- if (_signal == NULL) {
- wpa_printf(MSG_ERROR,
- "dbus: wpa_supplicant_dbus_notify_certification: "
- "Could not create dbus signal; likely out of "
- "memory");
- return;
- }
-
- hash = cert_hash ? cert_hash : "";
- cert_hex = cert ? wpabuf_head(cert) : "";
- cert_hex_len = cert ? wpabuf_len(cert) : 0;
-
- if (!dbus_message_append_args(_signal,
- DBUS_TYPE_INT32,&depth,
- DBUS_TYPE_STRING, &subject,
- DBUS_TYPE_STRING, &hash,
- DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
- &cert_hex, cert_hex_len,
- DBUS_TYPE_INVALID)) {
- wpa_printf(MSG_ERROR,
- "dbus: wpa_supplicant_dbus_notify_certification: "
- "Not enough memory to construct signal");
- goto out;
- }
-
- dbus_connection_send(iface->con, _signal, NULL);
-
-out:
- dbus_message_unref(_signal);
-
-}
-
-
-/**
- * wpa_supplicant_dbus_ctrl_iface_init - Initialize dbus control interface
- * @global: Pointer to global data from wpa_supplicant_init()
- * Returns: 0 on success, -1 on failure
- *
- * Initialize the dbus control interface and start receiving commands from
- * external programs over the bus.
- */
-int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface)
-{
- DBusError error;
- int ret = -1;
- DBusObjectPathVTable wpas_vtable = {
- NULL, &wpas_message_handler, NULL, NULL, NULL, NULL
- };
-
- /* Register the message handler for the global dbus interface */
- if (!dbus_connection_register_object_path(iface->con,
- WPAS_DBUS_PATH, &wpas_vtable,
- iface)) {
- wpa_printf(MSG_ERROR, "dbus: Could not set up message "
- "handler");
- return -1;
- }
-
- /* Register our service with the message bus */
- dbus_error_init(&error);
- switch (dbus_bus_request_name(iface->con, WPAS_DBUS_SERVICE,
- 0, &error)) {
- case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
- ret = 0;
- break;
- case DBUS_REQUEST_NAME_REPLY_EXISTS:
- case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
- case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
- wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
- "already registered");
- break;
- default:
- wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
- "%s %s", error.name, error.message);
- break;
- }
- dbus_error_free(&error);
-
- if (ret != 0)
- return -1;
-
- wpa_printf(MSG_DEBUG, "Providing DBus service '" WPAS_DBUS_SERVICE
- "'.");
-
- return 0;
-}
-
-
-/**
- * wpas_dbus_register_new_iface - Register a new interface with dbus
- * @wpa_s: %wpa_supplicant interface description structure to register
- * Returns: 0 on success, -1 on error
- *
- * Registers a new interface with dbus and assigns it a dbus object path.
- */
-int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
-{
- struct wpas_dbus_priv *ctrl_iface = wpa_s->global->dbus;
- DBusConnection * con;
- u32 next;
- DBusObjectPathVTable vtable = {
- NULL, &wpas_iface_message_handler, NULL, NULL, NULL, NULL
- };
-
- /* Do nothing if the control interface is not turned on */
- if (ctrl_iface == NULL)
- return 0;
-
- con = ctrl_iface->con;
- next = ctrl_iface->next_objid++;
-
- /* Create and set the interface's object path */
- wpa_s->dbus_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- if (wpa_s->dbus_path == NULL)
- return -1;
- os_snprintf(wpa_s->dbus_path, WPAS_DBUS_OBJECT_PATH_MAX,
- WPAS_DBUS_PATH_INTERFACES "/%u",
- next);
-
- /* Register the message handler for the interface functions */
- if (!dbus_connection_register_fallback(con, wpa_s->dbus_path, &vtable,
- wpa_s)) {
- wpa_printf(MSG_ERROR, "dbus: Could not set up message "
- "handler for interface %s", wpa_s->ifname);
- return -1;
- }
-
- return 0;
-}
-
-
-/**
- * wpas_dbus_unregister_iface - Unregister an interface from dbus
- * @wpa_s: wpa_supplicant interface structure
- * Returns: 0 on success, -1 on failure
- *
- * Unregisters the interface with dbus
- */
-int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
-{
- struct wpas_dbus_priv *ctrl_iface;
- DBusConnection *con;
-
- /* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
- return 0;
- ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
- return 0;
-
- con = ctrl_iface->con;
- if (!dbus_connection_unregister_object_path(con, wpa_s->dbus_path))
- return -1;
-
- os_free(wpa_s->dbus_path);
- wpa_s->dbus_path = NULL;
-
- return 0;
-}
-
-
-/**
- * wpa_supplicant_get_iface_by_dbus_path - Get a new network interface
- * @global: Pointer to global data from wpa_supplicant_init()
- * @path: Pointer to a dbus object path representing an interface
- * Returns: Pointer to the interface or %NULL if not found
- */
-struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
- struct wpa_global *global, const char *path)
-{
- struct wpa_supplicant *wpa_s;
-
- for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
- if (strcmp(wpa_s->dbus_path, path) == 0)
- return wpa_s;
- }
- return NULL;
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_old.h b/contrib/wpa/wpa_supplicant/dbus/dbus_old.h
deleted file mode 100644
index e668231..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_old.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef CTRL_IFACE_DBUS_H
-#define CTRL_IFACE_DBUS_H
-
-struct wps_credential;
-
-#ifdef CONFIG_CTRL_IFACE_DBUS
-
-#define WPAS_DBUS_OBJECT_PATH_MAX 150
-
-#define WPAS_DBUS_SERVICE "fi.epitest.hostap.WPASupplicant"
-#define WPAS_DBUS_PATH "/fi/epitest/hostap/WPASupplicant"
-#define WPAS_DBUS_INTERFACE "fi.epitest.hostap.WPASupplicant"
-
-#define WPAS_DBUS_PATH_INTERFACES WPAS_DBUS_PATH "/Interfaces"
-#define WPAS_DBUS_IFACE_INTERFACE WPAS_DBUS_INTERFACE ".Interface"
-
-#define WPAS_DBUS_NETWORKS_PART "Networks"
-#define WPAS_DBUS_IFACE_NETWORK WPAS_DBUS_INTERFACE ".Network"
-
-#define WPAS_DBUS_BSSIDS_PART "BSSIDs"
-#define WPAS_DBUS_IFACE_BSSID WPAS_DBUS_INTERFACE ".BSSID"
-
-
-/* Errors */
-#define WPAS_ERROR_INVALID_NETWORK \
- WPAS_DBUS_IFACE_INTERFACE ".InvalidNetwork"
-#define WPAS_ERROR_INVALID_BSSID \
- WPAS_DBUS_IFACE_INTERFACE ".InvalidBSSID"
-
-#define WPAS_ERROR_INVALID_OPTS \
- WPAS_DBUS_INTERFACE ".InvalidOptions"
-#define WPAS_ERROR_INVALID_IFACE \
- WPAS_DBUS_INTERFACE ".InvalidInterface"
-
-#define WPAS_ERROR_ADD_ERROR \
- WPAS_DBUS_INTERFACE ".AddError"
-#define WPAS_ERROR_EXISTS_ERROR \
- WPAS_DBUS_INTERFACE ".ExistsError"
-#define WPAS_ERROR_REMOVE_ERROR \
- WPAS_DBUS_INTERFACE ".RemoveError"
-
-#define WPAS_ERROR_SCAN_ERROR \
- WPAS_DBUS_IFACE_INTERFACE ".ScanError"
-#define WPAS_ERROR_ADD_NETWORK_ERROR \
- WPAS_DBUS_IFACE_INTERFACE ".AddNetworkError"
-#define WPAS_ERROR_INTERNAL_ERROR \
- WPAS_DBUS_IFACE_INTERFACE ".InternalError"
-#define WPAS_ERROR_REMOVE_NETWORK_ERROR \
- WPAS_DBUS_IFACE_INTERFACE ".RemoveNetworkError"
-
-#define WPAS_ERROR_WPS_PBC_ERROR \
- WPAS_DBUS_IFACE_INTERFACE ".WpsPbcError"
-#define WPAS_ERROR_WPS_PIN_ERROR \
- WPAS_DBUS_IFACE_INTERFACE ".WpsPinError"
-#define WPAS_ERROR_WPS_REG_ERROR \
- WPAS_DBUS_IFACE_INTERFACE ".WpsRegError"
-
-#define WPAS_DBUS_BSSID_FORMAT "%02x%02x%02x%02x%02x%02x"
-
-struct wpa_global;
-struct wpa_supplicant;
-
-int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface);
-void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s);
-void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s);
-void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
- enum wpa_states new_state,
- enum wpa_states old_state);
-void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred);
-void wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s,
- int depth, const char *subject,
- const char *cert_hash,
- const struct wpabuf *cert);
-
-char * wpas_dbus_decompose_object_path(const char *path, char **network,
- char **bssid);
-
-int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s);
-int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s);
-
-
-/* Methods internal to the dbus control interface */
-struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
- struct wpa_global *global, const char *path);
-
-#else /* CONFIG_CTRL_IFACE_DBUS */
-
-static inline void
-wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
-{
-}
-
-static inline void
-wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
-{
-}
-
-#define wpa_supplicant_dbus_notify_state_change(w,n,o) do { } while (0)
-
-static inline void
-wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
- const struct wps_credential *cred)
-{
-}
-
-static inline void
-wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s,
- int depth, const char *subject,
- const char *cert_hash,
- const struct wpabuf *cert)
-{
-}
-
-static inline int
-wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
-{
- return 0;
-}
-
-static inline int
-wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
-{
- return 0;
-}
-
-#endif /* CONFIG_CTRL_IFACE_DBUS */
-
-#endif /* CTRL_IFACE_DBUS_H */
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c b/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c
deleted file mode 100644
index 68e5515..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c
+++ /dev/null
@@ -1,1462 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-#include <dbus/dbus.h>
-
-#include "common.h"
-#include "eap_peer/eap_methods.h"
-#include "common/ieee802_11_defs.h"
-#include "eapol_supp/eapol_supp_sm.h"
-#include "rsn_supp/wpa.h"
-#include "../config.h"
-#include "../wpa_supplicant_i.h"
-#include "../driver_i.h"
-#include "../notify.h"
-#include "../wpas_glue.h"
-#include "../bss.h"
-#include "../scan.h"
-#include "dbus_old.h"
-#include "dbus_old_handlers.h"
-#include "dbus_dict_helpers.h"
-
-extern int wpa_debug_level;
-extern int wpa_debug_show_keys;
-extern int wpa_debug_timestamp;
-
-/**
- * wpas_dbus_new_invalid_opts_error - Return a new invalid options error message
- * @message: Pointer to incoming dbus message this error refers to
- * Returns: a dbus error message
- *
- * Convenience function to create and return an invalid options error
- */
-DBusMessage * wpas_dbus_new_invalid_opts_error(DBusMessage *message,
- const char *arg)
-{
- DBusMessage *reply;
-
- reply = dbus_message_new_error(message, WPAS_ERROR_INVALID_OPTS,
- "Did not receive correct message "
- "arguments.");
- if (arg != NULL)
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &arg,
- DBUS_TYPE_INVALID);
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_new_success_reply - Return a new success reply message
- * @message: Pointer to incoming dbus message this reply refers to
- * Returns: a dbus message containing a single UINT32 that indicates
- * success (ie, a value of 1)
- *
- * Convenience function to create and return a success reply message
- */
-DBusMessage * wpas_dbus_new_success_reply(DBusMessage *message)
-{
- DBusMessage *reply;
- unsigned int success = 1;
-
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_UINT32, &success,
- DBUS_TYPE_INVALID);
- return reply;
-}
-
-
-/**
- * wpas_dbus_global_add_interface - Request registration of a network interface
- * @message: Pointer to incoming dbus message
- * @global: %wpa_supplicant global data structure
- * Returns: The object path of the new interface object,
- * or a dbus error message with more information
- *
- * Handler function for "addInterface" method call. Handles requests
- * by dbus clients to register a network interface that wpa_supplicant
- * will manage.
- */
-DBusMessage * wpas_dbus_global_add_interface(DBusMessage *message,
- struct wpa_global *global)
-{
- char *ifname = NULL;
- char *driver = NULL;
- char *driver_param = NULL;
- char *confname = NULL;
- char *bridge_ifname = NULL;
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
-
- dbus_message_iter_init(message, &iter);
-
- /* First argument: interface name (DBUS_TYPE_STRING)
- * Required; must be non-zero length
- */
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- goto error;
- dbus_message_iter_get_basic(&iter, &ifname);
- if (!os_strlen(ifname))
- goto error;
-
- /* Second argument: dict of options */
- if (dbus_message_iter_next(&iter)) {
- DBusMessageIter iter_dict;
- struct wpa_dbus_dict_entry entry;
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
- if (!strcmp(entry.key, "driver") &&
- (entry.type == DBUS_TYPE_STRING)) {
- driver = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (driver == NULL)
- goto error;
- } else if (!strcmp(entry.key, "driver-params") &&
- (entry.type == DBUS_TYPE_STRING)) {
- driver_param = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (driver_param == NULL)
- goto error;
- } else if (!strcmp(entry.key, "config-file") &&
- (entry.type == DBUS_TYPE_STRING)) {
- confname = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (confname == NULL)
- goto error;
- } else if (!strcmp(entry.key, "bridge-ifname") &&
- (entry.type == DBUS_TYPE_STRING)) {
- bridge_ifname = os_strdup(entry.str_value);
- wpa_dbus_dict_entry_clear(&entry);
- if (bridge_ifname == NULL)
- goto error;
- } else {
- wpa_dbus_dict_entry_clear(&entry);
- goto error;
- }
- }
- }
-
- /*
- * Try to get the wpa_supplicant record for this iface, return
- * an error if we already control it.
- */
- if (wpa_supplicant_get_iface(global, ifname) != NULL) {
- reply = dbus_message_new_error(message,
- WPAS_ERROR_EXISTS_ERROR,
- "wpa_supplicant already "
- "controls this interface.");
- } else {
- struct wpa_supplicant *wpa_s;
- struct wpa_interface iface;
- os_memset(&iface, 0, sizeof(iface));
- iface.ifname = ifname;
- iface.driver = driver;
- iface.driver_param = driver_param;
- iface.confname = confname;
- iface.bridge_ifname = bridge_ifname;
- /* Otherwise, have wpa_supplicant attach to it. */
- if ((wpa_s = wpa_supplicant_add_iface(global, &iface))) {
- const char *path = wpa_s->dbus_path;
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
- &path, DBUS_TYPE_INVALID);
- } else {
- reply = dbus_message_new_error(message,
- WPAS_ERROR_ADD_ERROR,
- "wpa_supplicant "
- "couldn't grab this "
- "interface.");
- }
- }
-
-out:
- os_free(driver);
- os_free(driver_param);
- os_free(confname);
- os_free(bridge_ifname);
- return reply;
-
-error:
- reply = wpas_dbus_new_invalid_opts_error(message, NULL);
- goto out;
-}
-
-
-/**
- * wpas_dbus_global_remove_interface - Request deregistration of an interface
- * @message: Pointer to incoming dbus message
- * @global: wpa_supplicant global data structure
- * Returns: a dbus message containing a UINT32 indicating success (1) or
- * failure (0), or returns a dbus error message with more information
- *
- * Handler function for "removeInterface" method call. Handles requests
- * by dbus clients to deregister a network interface that wpa_supplicant
- * currently manages.
- */
-DBusMessage * wpas_dbus_global_remove_interface(DBusMessage *message,
- struct wpa_global *global)
-{
- struct wpa_supplicant *wpa_s;
- char *path;
- DBusMessage *reply = NULL;
-
- if (!dbus_message_get_args(message, NULL,
- DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID)) {
- reply = wpas_dbus_new_invalid_opts_error(message, NULL);
- goto out;
- }
-
- wpa_s = wpa_supplicant_get_iface_by_dbus_path(global, path);
- if (wpa_s == NULL) {
- reply = wpas_dbus_new_invalid_iface_error(message);
- goto out;
- }
-
- if (!wpa_supplicant_remove_iface(global, wpa_s, 0)) {
- reply = wpas_dbus_new_success_reply(message);
- } else {
- reply = dbus_message_new_error(message,
- WPAS_ERROR_REMOVE_ERROR,
- "wpa_supplicant couldn't "
- "remove this interface.");
- }
-
-out:
- return reply;
-}
-
-
-/**
- * wpas_dbus_global_get_interface - Get the object path for an interface name
- * @message: Pointer to incoming dbus message
- * @global: %wpa_supplicant global data structure
- * Returns: The object path of the interface object,
- * or a dbus error message with more information
- *
- * Handler function for "getInterface" method call. Handles requests
- * by dbus clients for the object path of an specific network interface.
- */
-DBusMessage * wpas_dbus_global_get_interface(DBusMessage *message,
- struct wpa_global *global)
-{
- DBusMessage *reply = NULL;
- const char *ifname;
- const char *path;
- struct wpa_supplicant *wpa_s;
-
- if (!dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &ifname,
- DBUS_TYPE_INVALID)) {
- reply = wpas_dbus_new_invalid_opts_error(message, NULL);
- goto out;
- }
-
- wpa_s = wpa_supplicant_get_iface(global, ifname);
- if (wpa_s == NULL) {
- reply = wpas_dbus_new_invalid_iface_error(message);
- goto out;
- }
-
- path = wpa_s->dbus_path;
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply,
- DBUS_TYPE_OBJECT_PATH, &path,
- DBUS_TYPE_INVALID);
-
-out:
- return reply;
-}
-
-
-/**
- * wpas_dbus_global_set_debugparams- Set the debug params
- * @message: Pointer to incoming dbus message
- * @global: %wpa_supplicant global data structure
- * Returns: a dbus message containing a UINT32 indicating success (1) or
- * failure (0), or returns a dbus error message with more information
- *
- * Handler function for "setDebugParams" method call. Handles requests
- * by dbus clients for the object path of an specific network interface.
- */
-DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
- struct wpa_global *global)
-{
- DBusMessage *reply = NULL;
- int debug_level;
- dbus_bool_t debug_timestamp;
- dbus_bool_t debug_show_keys;
-
- if (!dbus_message_get_args(message, NULL,
- DBUS_TYPE_INT32, &debug_level,
- DBUS_TYPE_BOOLEAN, &debug_timestamp,
- DBUS_TYPE_BOOLEAN, &debug_show_keys,
- DBUS_TYPE_INVALID)) {
- return wpas_dbus_new_invalid_opts_error(message, NULL);
- }
-
- if (wpa_supplicant_set_debug_params(global, debug_level,
- debug_timestamp ? 1 : 0,
- debug_show_keys ? 1 : 0)) {
- return wpas_dbus_new_invalid_opts_error(message, NULL);
- }
-
- reply = wpas_dbus_new_success_reply(message);
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_scan - Request a wireless scan on an interface
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: a dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "scan" method call of a network device. Requests
- * that wpa_supplicant perform a wireless scan as soon as possible
- * on a particular wireless interface.
- */
-DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- wpa_s->scan_req = MANUAL_SCAN_REQ;
- wpa_supplicant_req_scan(wpa_s, 0, 0);
- return wpas_dbus_new_success_reply(message);
-}
-
-
-/**
- * wpas_dbus_iface_scan_results - Get the results of a recent scan request
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: a dbus message containing a dbus array of objects paths, or returns
- * a dbus error message if not scan results could be found
- *
- * Handler function for "scanResults" method call of a network device. Returns
- * a dbus message containing the object paths of wireless networks found.
- */
-DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- DBusMessageIter iter;
- DBusMessageIter sub_iter;
- struct wpa_bss *bss;
-
- /* Create and initialize the return message */
- reply = dbus_message_new_method_return(message);
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- DBUS_TYPE_OBJECT_PATH_AS_STRING,
- &sub_iter);
-
- /* Loop through scan results and append each result's object path */
- dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
- char path_buf[WPAS_DBUS_OBJECT_PATH_MAX];
- char *path = path_buf;
-
- /* Construct the object path for this network. Note that ':'
- * is not a valid character in dbus object paths.
- */
- os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_BSSIDS_PART "/"
- WPAS_DBUS_BSSID_FORMAT,
- wpa_s->dbus_path, MAC2STR(bss->bssid));
- dbus_message_iter_append_basic(&sub_iter,
- DBUS_TYPE_OBJECT_PATH, &path);
- }
-
- dbus_message_iter_close_container(&iter, &sub_iter);
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_bssid_properties - Return the properties of a scanned network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * @res: wpa_supplicant scan result for which to get properties
- * Returns: a dbus message containing the properties for the requested network
- *
- * Handler function for "properties" method call of a scanned network.
- * Returns a dbus message containing the the properties.
- */
-DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_bss *bss)
-{
- DBusMessage *reply;
- DBusMessageIter iter, iter_dict;
- const u8 *ie;
-
- /* Dump the properties into a dbus message */
- reply = dbus_message_new_method_return(message);
-
- dbus_message_iter_init_append(reply, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &iter_dict))
- goto error;
-
- if (!wpa_dbus_dict_append_byte_array(&iter_dict, "bssid",
- (const char *) bss->bssid,
- ETH_ALEN))
- goto error;
-
- ie = wpa_bss_get_ie(bss, WLAN_EID_SSID);
- if (ie) {
- if (!wpa_dbus_dict_append_byte_array(&iter_dict, "ssid",
- (const char *) (ie + 2),
- ie[1]))
- goto error;
- }
-
- ie = wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
- if (ie) {
- if (!wpa_dbus_dict_append_byte_array(&iter_dict, "wpaie",
- (const char *) ie,
- ie[1] + 2))
- goto error;
- }
-
- ie = wpa_bss_get_ie(bss, WLAN_EID_RSN);
- if (ie) {
- if (!wpa_dbus_dict_append_byte_array(&iter_dict, "rsnie",
- (const char *) ie,
- ie[1] + 2))
- goto error;
- }
-
- ie = wpa_bss_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE);
- if (ie) {
- if (!wpa_dbus_dict_append_byte_array(&iter_dict, "wpsie",
- (const char *) ie,
- ie[1] + 2))
- goto error;
- }
-
- if (bss->freq) {
- if (!wpa_dbus_dict_append_int32(&iter_dict, "frequency",
- bss->freq))
- goto error;
- }
- if (!wpa_dbus_dict_append_uint16(&iter_dict, "capabilities",
- bss->caps))
- goto error;
- if (!(bss->flags & WPA_BSS_QUAL_INVALID) &&
- !wpa_dbus_dict_append_int32(&iter_dict, "quality", bss->qual))
- goto error;
- if (!(bss->flags & WPA_BSS_NOISE_INVALID) &&
- !wpa_dbus_dict_append_int32(&iter_dict, "noise", bss->noise))
- goto error;
- if (!(bss->flags & WPA_BSS_LEVEL_INVALID) &&
- !wpa_dbus_dict_append_int32(&iter_dict, "level", bss->level))
- goto error;
- if (!wpa_dbus_dict_append_int32(&iter_dict, "maxrate",
- wpa_bss_get_max_rate(bss) * 500000))
- goto error;
-
- if (!wpa_dbus_dict_close_write(&iter, &iter_dict))
- goto error;
-
- return reply;
-
-error:
- if (reply)
- dbus_message_unref(reply);
- return dbus_message_new_error(message, WPAS_ERROR_INTERNAL_ERROR,
- "an internal error occurred returning "
- "BSSID properties.");
-}
-
-
-/**
- * wpas_dbus_iface_capabilities - Return interface capabilities
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing a dict of strings
- *
- * Handler function for "capabilities" method call of an interface.
- */
-DBusMessage * wpas_dbus_iface_capabilities(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- struct wpa_driver_capa capa;
- int res;
- DBusMessageIter iter, iter_dict;
- char **eap_methods;
- size_t num_items;
- dbus_bool_t strict = FALSE;
- DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
-
- if (!dbus_message_get_args(message, NULL,
- DBUS_TYPE_BOOLEAN, &strict,
- DBUS_TYPE_INVALID))
- strict = FALSE;
-
- reply = dbus_message_new_method_return(message);
-
- dbus_message_iter_init_append(reply, &iter);
- if (!wpa_dbus_dict_open_write(&iter, &iter_dict))
- goto error;
-
- /* EAP methods */
- eap_methods = eap_get_names_as_string_array(&num_items);
- if (eap_methods) {
- dbus_bool_t success = FALSE;
- size_t i = 0;
-
- success = wpa_dbus_dict_append_string_array(
- &iter_dict, "eap", (const char **) eap_methods,
- num_items);
-
- /* free returned method array */
- while (eap_methods[i])
- os_free(eap_methods[i++]);
- os_free(eap_methods);
-
- if (!success)
- goto error;
- }
-
- res = wpa_drv_get_capa(wpa_s, &capa);
-
- /***** pairwise cipher */
- if (res < 0) {
- if (!strict) {
- const char *args[] = {"CCMP", "TKIP", "NONE"};
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "pairwise", args,
- sizeof(args) / sizeof(char*)))
- goto error;
- }
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "pairwise",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_CCMP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "CCMP"))
- goto error;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_TKIP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "TKIP"))
- goto error;
- }
-
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "NONE"))
- goto error;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
- }
-
- /***** group cipher */
- if (res < 0) {
- if (!strict) {
- const char *args[] = {
- "CCMP", "TKIP", "WEP104", "WEP40"
- };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "group", args,
- sizeof(args) / sizeof(char*)))
- goto error;
- }
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "group",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_CCMP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "CCMP"))
- goto error;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_TKIP) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "TKIP"))
- goto error;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_WEP104) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "WEP104"))
- goto error;
- }
-
- if (capa.enc & WPA_DRIVER_CAPA_ENC_WEP40) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "WEP40"))
- goto error;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
- }
-
- /***** key management */
- if (res < 0) {
- if (!strict) {
- const char *args[] = {
- "WPA-PSK", "WPA-EAP", "IEEE8021X", "WPA-NONE",
- "NONE"
- };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "key_mgmt", args,
- sizeof(args) / sizeof(char*)))
- goto error;
- }
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "key_mgmt",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
-
- if (!wpa_dbus_dict_string_array_add_element(&iter_array,
- "NONE"))
- goto error;
-
- if (!wpa_dbus_dict_string_array_add_element(&iter_array,
- "IEEE8021X"))
- goto error;
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA2)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "WPA-EAP"))
- goto error;
- }
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "WPA-PSK"))
- goto error;
- }
-
- if (capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "WPA-NONE"))
- goto error;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
- }
-
- /***** WPA protocol */
- if (res < 0) {
- if (!strict) {
- const char *args[] = { "RSN", "WPA" };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "proto", args,
- sizeof(args) / sizeof(char*)))
- goto error;
- }
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "proto",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA2 |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "RSN"))
- goto error;
- }
-
- if (capa.key_mgmt & (WPA_DRIVER_CAPA_KEY_MGMT_WPA |
- WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "WPA"))
- goto error;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
- }
-
- /***** auth alg */
- if (res < 0) {
- if (!strict) {
- const char *args[] = { "OPEN", "SHARED", "LEAP" };
- if (!wpa_dbus_dict_append_string_array(
- &iter_dict, "auth_alg", args,
- sizeof(args) / sizeof(char*)))
- goto error;
- }
- } else {
- if (!wpa_dbus_dict_begin_string_array(&iter_dict, "auth_alg",
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
-
- if (capa.auth & (WPA_DRIVER_AUTH_OPEN)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "OPEN"))
- goto error;
- }
-
- if (capa.auth & (WPA_DRIVER_AUTH_SHARED)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "SHARED"))
- goto error;
- }
-
- if (capa.auth & (WPA_DRIVER_AUTH_LEAP)) {
- if (!wpa_dbus_dict_string_array_add_element(
- &iter_array, "LEAP"))
- goto error;
- }
-
- if (!wpa_dbus_dict_end_string_array(&iter_dict,
- &iter_dict_entry,
- &iter_dict_val,
- &iter_array))
- goto error;
- }
-
- if (!wpa_dbus_dict_close_write(&iter, &iter_dict))
- goto error;
-
- return reply;
-
-error:
- if (reply)
- dbus_message_unref(reply);
- return dbus_message_new_error(message, WPAS_ERROR_INTERNAL_ERROR,
- "an internal error occurred returning "
- "interface capabilities.");
-}
-
-
-/**
- * wpas_dbus_iface_add_network - Add a new configured network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing the object path of the new network
- *
- * Handler function for "addNetwork" method call of a network interface.
- */
-DBusMessage * wpas_dbus_iface_add_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- struct wpa_ssid *ssid;
- char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *path = path_buf;
-
- ssid = wpa_config_add_network(wpa_s->conf);
- if (ssid == NULL) {
- reply = dbus_message_new_error(message,
- WPAS_ERROR_ADD_NETWORK_ERROR,
- "wpa_supplicant could not add "
- "a network on this interface.");
- goto out;
- }
- wpas_notify_network_added(wpa_s, ssid);
- ssid->disabled = 1;
- wpa_config_set_network_defaults(ssid);
-
- /* Construct the object path for this network. */
- os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
- "%s/" WPAS_DBUS_NETWORKS_PART "/%d",
- wpa_s->dbus_path, ssid->id);
-
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
- &path, DBUS_TYPE_INVALID);
-
-out:
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_remove_network - Remove a configured network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "removeNetwork" method call of a network interface.
- */
-DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- const char *op;
- char *iface = NULL, *net_id = NULL;
- int id;
- struct wpa_ssid *ssid;
-
- if (!dbus_message_get_args(message, NULL,
- DBUS_TYPE_OBJECT_PATH, &op,
- DBUS_TYPE_INVALID)) {
- reply = wpas_dbus_new_invalid_opts_error(message, NULL);
- goto out;
- }
-
- /* Extract the network ID */
- iface = wpas_dbus_decompose_object_path(op, &net_id, NULL);
- if (iface == NULL) {
- reply = wpas_dbus_new_invalid_network_error(message);
- goto out;
- }
-
- /* Ensure the network is actually a child of this interface */
- if (os_strcmp(iface, wpa_s->dbus_path) != 0) {
- reply = wpas_dbus_new_invalid_network_error(message);
- goto out;
- }
-
- id = strtoul(net_id, NULL, 10);
- ssid = wpa_config_get_network(wpa_s->conf, id);
- if (ssid == NULL) {
- reply = wpas_dbus_new_invalid_network_error(message);
- goto out;
- }
-
- wpas_notify_network_removed(wpa_s, ssid);
-
- if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
- reply = dbus_message_new_error(message,
- WPAS_ERROR_REMOVE_NETWORK_ERROR,
- "error removing the specified "
- "on this interface.");
- goto out;
- }
-
- if (ssid == wpa_s->current_ssid)
- wpa_supplicant_deauthenticate(wpa_s,
- WLAN_REASON_DEAUTH_LEAVING);
- reply = wpas_dbus_new_success_reply(message);
-
-out:
- os_free(iface);
- os_free(net_id);
- return reply;
-}
-
-
-static const char *dont_quote[] = {
- "key_mgmt", "proto", "pairwise", "auth_alg", "group", "eap",
- "opensc_engine_path", "pkcs11_engine_path", "pkcs11_module_path",
- "bssid", NULL
-};
-
-
-static dbus_bool_t should_quote_opt(const char *key)
-{
- int i = 0;
- while (dont_quote[i] != NULL) {
- if (strcmp(key, dont_quote[i]) == 0)
- return FALSE;
- i++;
- }
- return TRUE;
-}
-
-
-/**
- * wpas_dbus_iface_set_network - Set options for a configured network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * @ssid: wpa_ssid structure for a configured network
- * Returns: a dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "set" method call of a configured network.
- */
-DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- DBusMessage *reply = NULL;
- struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
- DBusMessageIter iter, iter_dict;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) {
- reply = wpas_dbus_new_invalid_opts_error(message, NULL);
- goto out;
- }
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- char *value = NULL;
- size_t size = 50;
- int ret;
-
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) {
- reply = wpas_dbus_new_invalid_opts_error(message,
- NULL);
- goto out;
- }
-
- /* Type conversions, since wpa_supplicant wants strings */
- if (entry.type == DBUS_TYPE_ARRAY &&
- entry.array_type == DBUS_TYPE_BYTE) {
- if (entry.array_len <= 0)
- goto error;
-
- size = entry.array_len * 2 + 1;
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
- ret = wpa_snprintf_hex(value, size,
- (u8 *) entry.bytearray_value,
- entry.array_len);
- if (ret <= 0)
- goto error;
- } else if (entry.type == DBUS_TYPE_STRING) {
- if (should_quote_opt(entry.key)) {
- size = os_strlen(entry.str_value);
- /* Zero-length option check */
- if (size <= 0)
- goto error;
- size += 3; /* For quotes and terminator */
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
- ret = os_snprintf(value, size, "\"%s\"",
- entry.str_value);
- if (ret < 0 || (size_t) ret != (size - 1))
- goto error;
- } else {
- value = os_strdup(entry.str_value);
- if (value == NULL)
- goto error;
- }
- } else if (entry.type == DBUS_TYPE_UINT32) {
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
- ret = os_snprintf(value, size, "%u",
- entry.uint32_value);
- if (ret <= 0)
- goto error;
- } else if (entry.type == DBUS_TYPE_INT32) {
- value = os_zalloc(size);
- if (value == NULL)
- goto error;
- ret = os_snprintf(value, size, "%d",
- entry.int32_value);
- if (ret <= 0)
- goto error;
- } else
- goto error;
-
- if (wpa_config_set(ssid, entry.key, value, 0) < 0)
- goto error;
-
- if ((os_strcmp(entry.key, "psk") == 0 &&
- value[0] == '"' && ssid->ssid_len) ||
- (os_strcmp(entry.key, "ssid") == 0 && ssid->passphrase))
- wpa_config_update_psk(ssid);
- else if (os_strcmp(entry.key, "priority") == 0)
- wpa_config_update_prio_list(wpa_s->conf);
-
- os_free(value);
- wpa_dbus_dict_entry_clear(&entry);
- continue;
-
- error:
- os_free(value);
- reply = wpas_dbus_new_invalid_opts_error(message, entry.key);
- wpa_dbus_dict_entry_clear(&entry);
- break;
- }
-
- if (!reply)
- reply = wpas_dbus_new_success_reply(message);
-
-out:
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_enable_network - Mark a configured network as enabled
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * @ssid: wpa_ssid structure for a configured network
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "enable" method call of a configured network.
- */
-DBusMessage * wpas_dbus_iface_enable_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- wpa_supplicant_enable_network(wpa_s, ssid);
- return wpas_dbus_new_success_reply(message);
-}
-
-
-/**
- * wpas_dbus_iface_disable_network - Mark a configured network as disabled
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * @ssid: wpa_ssid structure for a configured network
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "disable" method call of a configured network.
- */
-DBusMessage * wpas_dbus_iface_disable_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
-{
- wpa_supplicant_disable_network(wpa_s, ssid);
- return wpas_dbus_new_success_reply(message);
-}
-
-
-/**
- * wpas_dbus_iface_select_network - Attempt association with a configured network
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "selectNetwork" method call of network interface.
- */
-DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- const char *op;
- struct wpa_ssid *ssid;
- char *iface_obj_path = NULL;
- char *network = NULL;
-
- if (os_strlen(dbus_message_get_signature(message)) == 0) {
- /* Any network */
- ssid = NULL;
- } else {
- int nid;
-
- if (!dbus_message_get_args(message, NULL,
- DBUS_TYPE_OBJECT_PATH, &op,
- DBUS_TYPE_INVALID)) {
- reply = wpas_dbus_new_invalid_opts_error(message,
- NULL);
- goto out;
- }
-
- /* Extract the network number */
- iface_obj_path = wpas_dbus_decompose_object_path(op,
- &network,
- NULL);
- if (iface_obj_path == NULL) {
- reply = wpas_dbus_new_invalid_iface_error(message);
- goto out;
- }
- /* Ensure the object path really points to this interface */
- if (os_strcmp(iface_obj_path, wpa_s->dbus_path) != 0) {
- reply = wpas_dbus_new_invalid_network_error(message);
- goto out;
- }
-
- nid = strtoul(network, NULL, 10);
- if (errno == EINVAL) {
- reply = wpas_dbus_new_invalid_network_error(message);
- goto out;
- }
-
- ssid = wpa_config_get_network(wpa_s->conf, nid);
- if (ssid == NULL) {
- reply = wpas_dbus_new_invalid_network_error(message);
- goto out;
- }
- }
-
- /* Finally, associate with the network */
- wpa_supplicant_select_network(wpa_s, ssid);
-
- reply = wpas_dbus_new_success_reply(message);
-
-out:
- os_free(iface_obj_path);
- os_free(network);
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_disconnect - Terminate the current connection
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "disconnect" method call of network interface.
- */
-DBusMessage * wpas_dbus_iface_disconnect(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- wpa_s->disconnected = 1;
- wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
-
- return wpas_dbus_new_success_reply(message);
-}
-
-
-/**
- * wpas_dbus_iface_set_ap_scan - Control roaming mode
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "setAPScan" method call.
- */
-DBusMessage * wpas_dbus_iface_set_ap_scan(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- dbus_uint32_t ap_scan = 1;
-
- if (!dbus_message_get_args(message, NULL, DBUS_TYPE_UINT32, &ap_scan,
- DBUS_TYPE_INVALID)) {
- reply = wpas_dbus_new_invalid_opts_error(message, NULL);
- goto out;
- }
-
- if (wpa_supplicant_set_ap_scan(wpa_s, ap_scan)) {
- reply = wpas_dbus_new_invalid_opts_error(message, NULL);
- goto out;
- }
-
- reply = wpas_dbus_new_success_reply(message);
-
-out:
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_set_smartcard_modules - Set smartcard related module paths
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "setSmartcardModules" method call.
- */
-DBusMessage * wpas_dbus_iface_set_smartcard_modules(
- DBusMessage *message, struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter, iter_dict;
- char *opensc_engine_path = NULL;
- char *pkcs11_engine_path = NULL;
- char *pkcs11_module_path = NULL;
- struct wpa_dbus_dict_entry entry;
-
- if (!dbus_message_iter_init(message, &iter))
- goto error;
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- goto error;
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry))
- goto error;
- if (!strcmp(entry.key, "opensc_engine_path") &&
- (entry.type == DBUS_TYPE_STRING)) {
- opensc_engine_path = os_strdup(entry.str_value);
- if (opensc_engine_path == NULL)
- goto error;
- } else if (!strcmp(entry.key, "pkcs11_engine_path") &&
- (entry.type == DBUS_TYPE_STRING)) {
- pkcs11_engine_path = os_strdup(entry.str_value);
- if (pkcs11_engine_path == NULL)
- goto error;
- } else if (!strcmp(entry.key, "pkcs11_module_path") &&
- (entry.type == DBUS_TYPE_STRING)) {
- pkcs11_module_path = os_strdup(entry.str_value);
- if (pkcs11_module_path == NULL)
- goto error;
- } else {
- wpa_dbus_dict_entry_clear(&entry);
- goto error;
- }
- wpa_dbus_dict_entry_clear(&entry);
- }
-
- os_free(wpa_s->conf->opensc_engine_path);
- wpa_s->conf->opensc_engine_path = opensc_engine_path;
- os_free(wpa_s->conf->pkcs11_engine_path);
- wpa_s->conf->pkcs11_engine_path = pkcs11_engine_path;
- os_free(wpa_s->conf->pkcs11_module_path);
- wpa_s->conf->pkcs11_module_path = pkcs11_module_path;
-
- wpa_sm_set_eapol(wpa_s->wpa, NULL);
- eapol_sm_deinit(wpa_s->eapol);
- wpa_s->eapol = NULL;
- wpa_supplicant_init_eapol(wpa_s);
- wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
-
- return wpas_dbus_new_success_reply(message);
-
-error:
- os_free(opensc_engine_path);
- os_free(pkcs11_engine_path);
- os_free(pkcs11_module_path);
- return wpas_dbus_new_invalid_opts_error(message, NULL);
-}
-
-
-/**
- * wpas_dbus_iface_get_state - Get interface state
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing a STRING representing the current
- * interface state
- *
- * Handler function for "state" method call.
- */
-DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- const char *str_state;
-
- reply = dbus_message_new_method_return(message);
- if (reply != NULL) {
- str_state = wpa_supplicant_state_txt(wpa_s->wpa_state);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &str_state,
- DBUS_TYPE_INVALID);
- }
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_get_scanning - Get interface scanning state
- * @message: Pointer to incoming dbus message
- * @wpa_s: wpa_supplicant structure for a network interface
- * Returns: A dbus message containing whether the interface is scanning
- *
- * Handler function for "scanning" method call.
- */
-DBusMessage * wpas_dbus_iface_get_scanning(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
-
- reply = dbus_message_new_method_return(message);
- if (reply != NULL) {
- dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &scanning,
- DBUS_TYPE_INVALID);
- } else {
- wpa_printf(MSG_ERROR, "dbus: Not enough memory to return "
- "scanning state");
- }
-
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_set_blobs - Store named binary blobs (ie, for certificates)
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Asks wpa_supplicant to internally store a one or more binary blobs.
- */
-DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
- DBusMessageIter iter, iter_dict;
-
- dbus_message_iter_init(message, &iter);
-
- if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL))
- return wpas_dbus_new_invalid_opts_error(message, NULL);
-
- while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
- struct wpa_config_blob *blob;
-
- if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) {
- reply = wpas_dbus_new_invalid_opts_error(message,
- NULL);
- break;
- }
-
- if (entry.type != DBUS_TYPE_ARRAY ||
- entry.array_type != DBUS_TYPE_BYTE) {
- reply = wpas_dbus_new_invalid_opts_error(
- message, "Byte array expected.");
- break;
- }
-
- if ((entry.array_len <= 0) || (entry.array_len > 65536) ||
- !strlen(entry.key)) {
- reply = wpas_dbus_new_invalid_opts_error(
- message, "Invalid array size.");
- break;
- }
-
- blob = os_zalloc(sizeof(*blob));
- if (blob == NULL) {
- reply = dbus_message_new_error(
- message, WPAS_ERROR_ADD_ERROR,
- "Not enough memory to add blob.");
- break;
- }
- blob->data = os_zalloc(entry.array_len);
- if (blob->data == NULL) {
- reply = dbus_message_new_error(
- message, WPAS_ERROR_ADD_ERROR,
- "Not enough memory to add blob data.");
- os_free(blob);
- break;
- }
-
- blob->name = os_strdup(entry.key);
- blob->len = entry.array_len;
- os_memcpy(blob->data, (u8 *) entry.bytearray_value,
- entry.array_len);
- if (blob->name == NULL || blob->data == NULL) {
- wpa_config_free_blob(blob);
- reply = dbus_message_new_error(
- message, WPAS_ERROR_ADD_ERROR,
- "Error adding blob.");
- break;
- }
-
- /* Success */
- if (!wpa_config_remove_blob(wpa_s->conf, blob->name))
- wpas_notify_blob_removed(wpa_s, blob->name);
- wpa_config_set_blob(wpa_s->conf, blob);
- wpas_notify_blob_added(wpa_s, blob->name);
-
- wpa_dbus_dict_entry_clear(&entry);
- }
- wpa_dbus_dict_entry_clear(&entry);
-
- return reply ? reply : wpas_dbus_new_success_reply(message);
-}
-
-
-/**
- * wpas_dbus_iface_remove_blob - Remove named binary blobs
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Asks wpa_supplicant to remove one or more previously stored binary blobs.
- */
-DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessageIter iter, array;
- char *err_msg = NULL;
-
- dbus_message_iter_init(message, &iter);
-
- if ((dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY) ||
- (dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_STRING))
- return wpas_dbus_new_invalid_opts_error(message, NULL);
-
- dbus_message_iter_recurse(&iter, &array);
- while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_STRING) {
- const char *name;
-
- dbus_message_iter_get_basic(&array, &name);
- if (!os_strlen(name))
- err_msg = "Invalid blob name.";
-
- if (wpa_config_remove_blob(wpa_s->conf, name) != 0)
- err_msg = "Error removing blob.";
- else
- wpas_notify_blob_removed(wpa_s, name);
- dbus_message_iter_next(&array);
- }
-
- if (err_msg)
- return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR,
- err_msg);
-
- return wpas_dbus_new_success_reply(message);
-}
-
-
-/**
- * wpas_dbus_iface_flush - Clear BSS of old or all inactive entries
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: a dbus message containing a UINT32 indicating success (1) or
- * failure (0), or returns a dbus error message with more information
- *
- * Handler function for "flush" method call. Handles requests for an
- * interface with an optional "age" parameter that specifies the minimum
- * age of a BSS to be flushed.
- */
-DBusMessage * wpas_dbus_iface_flush(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- int flush_age = 0;
-
- if (os_strlen(dbus_message_get_signature(message)) != 0 &&
- !dbus_message_get_args(message, NULL,
- DBUS_TYPE_INT32, &flush_age,
- DBUS_TYPE_INVALID)) {
- return wpas_dbus_new_invalid_opts_error(message, NULL);
- }
-
- if (flush_age == 0)
- wpa_bss_flush(wpa_s);
- else
- wpa_bss_flush_by_age(wpa_s, flush_age);
-
- return wpas_dbus_new_success_reply(message);
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.h b/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.h
deleted file mode 100644
index 825bc6d..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef CTRL_IFACE_DBUS_HANDLERS_H
-#define CTRL_IFACE_DBUS_HANDLERS_H
-
-struct wpa_bss;
-
-DBusMessage * wpas_dbus_new_invalid_iface_error(DBusMessage *message);
-DBusMessage * wpas_dbus_new_invalid_network_error(DBusMessage *message);
-
-DBusMessage * wpas_dbus_global_add_interface(DBusMessage *message,
- struct wpa_global *global);
-
-DBusMessage * wpas_dbus_global_remove_interface(DBusMessage *message,
- struct wpa_global *global);
-
-DBusMessage * wpas_dbus_global_get_interface(DBusMessage *message,
- struct wpa_global *global);
-
-DBusMessage * wpas_dbus_global_set_debugparams(DBusMessage *message,
- struct wpa_global *global);
-
-DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_bss *bss);
-
-DBusMessage * wpas_dbus_iface_capabilities(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_add_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_set_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
-
-DBusMessage * wpas_dbus_iface_enable_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
-
-DBusMessage * wpas_dbus_iface_disable_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
-
-DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_disconnect(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_set_ap_scan(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_set_smartcard_modules(
- DBusMessage *message, struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_get_scanning(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_wps_pbc(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_wps_pin(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_wps_reg(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_iface_flush(DBusMessage *message,
- struct wpa_supplicant *wpa_s);
-
-DBusMessage * wpas_dbus_new_success_reply(DBusMessage *message);
-DBusMessage * wpas_dbus_new_invalid_opts_error(DBusMessage *message,
- const char *arg);
-
-#endif /* CTRL_IFACE_DBUS_HANDLERS_H */
-
diff --git a/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers_wps.c b/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers_wps.c
deleted file mode 100644
index bb79382..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers_wps.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * WPA Supplicant / dbus-based control interface (WPS)
- * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "includes.h"
-#include <dbus/dbus.h>
-
-#include "common.h"
-#include "../config.h"
-#include "../wpa_supplicant_i.h"
-#include "../wps_supplicant.h"
-#include "dbus_old.h"
-#include "dbus_old_handlers.h"
-
-/**
- * wpas_dbus_iface_wps_pbc - Request credentials using WPS PBC method
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "wpsPbc" method call
- */
-DBusMessage * wpas_dbus_iface_wps_pbc(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- char *arg_bssid = NULL;
- u8 bssid[ETH_ALEN];
- int ret = 0;
-
- if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg_bssid,
- DBUS_TYPE_INVALID))
- return wpas_dbus_new_invalid_opts_error(message, NULL);
-
- if (!os_strcmp(arg_bssid, "any"))
- ret = wpas_wps_start_pbc(wpa_s, NULL, 0);
- else if (!hwaddr_aton(arg_bssid, bssid))
- ret = wpas_wps_start_pbc(wpa_s, bssid, 0);
- else {
- return wpas_dbus_new_invalid_opts_error(message,
- "Invalid BSSID");
- }
-
- if (ret < 0) {
- return dbus_message_new_error(message,
- WPAS_ERROR_WPS_PBC_ERROR,
- "Could not start PBC "
- "negotiation");
- }
-
- return wpas_dbus_new_success_reply(message);
-}
-
-
-/**
- * wpas_dbus_iface_wps_pin - Establish the PIN number of the enrollee
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "wpsPin" method call
- */
-DBusMessage * wpas_dbus_iface_wps_pin(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- DBusMessage *reply = NULL;
- char *arg_bssid;
- char *pin = NULL;
- u8 bssid[ETH_ALEN], *_bssid = NULL;
- int ret = 0;
-
- if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg_bssid,
- DBUS_TYPE_STRING, &pin, DBUS_TYPE_INVALID))
- return wpas_dbus_new_invalid_opts_error(message, NULL);
-
- if (!os_strcmp(arg_bssid, "any"))
- _bssid = NULL;
- else if (!hwaddr_aton(arg_bssid, bssid))
- _bssid = bssid;
- else {
- return wpas_dbus_new_invalid_opts_error(message,
- "Invalid BSSID");
- }
-
- if (os_strlen(pin) > 0)
- ret = wpas_wps_start_pin(wpa_s, _bssid, pin, 0,
- DEV_PW_DEFAULT);
- else
- ret = wpas_wps_start_pin(wpa_s, _bssid, NULL, 0,
- DEV_PW_DEFAULT);
-
- if (ret < 0) {
- return dbus_message_new_error(message,
- WPAS_ERROR_WPS_PIN_ERROR,
- "Could not init PIN");
- }
-
- reply = dbus_message_new_method_return(message);
- if (reply == NULL)
- return NULL;
-
- if (ret == 0) {
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &pin,
- DBUS_TYPE_INVALID);
- } else {
- char npin[9];
- os_snprintf(npin, sizeof(npin), "%08d", ret);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &npin,
- DBUS_TYPE_INVALID);
- }
- return reply;
-}
-
-
-/**
- * wpas_dbus_iface_wps_reg - Request credentials using the PIN of the AP
- * @message: Pointer to incoming dbus message
- * @wpa_s: %wpa_supplicant data structure
- * Returns: A dbus message containing a UINT32 indicating success (1) or
- * failure (0)
- *
- * Handler function for "wpsReg" method call
- */
-DBusMessage * wpas_dbus_iface_wps_reg(DBusMessage *message,
- struct wpa_supplicant *wpa_s)
-{
- char *arg_bssid;
- char *pin = NULL;
- u8 bssid[ETH_ALEN];
- int ret = 0;
-
- if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg_bssid,
- DBUS_TYPE_STRING, &pin, DBUS_TYPE_INVALID))
- return wpas_dbus_new_invalid_opts_error(message, NULL);
-
- if (!os_strcmp(arg_bssid, "any"))
- ret = wpas_wps_start_reg(wpa_s, NULL, pin, NULL);
- else if (!hwaddr_aton(arg_bssid, bssid))
- ret = wpas_wps_start_reg(wpa_s, bssid, pin, NULL);
- else {
- return wpas_dbus_new_invalid_opts_error(message,
- "Invalid BSSID");
- }
-
- if (ret < 0) {
- return dbus_message_new_error(message,
- WPAS_ERROR_WPS_PBC_ERROR,
- "Could not request credentials");
- }
-
- return wpas_dbus_new_success_reply(message);
-}
diff --git a/contrib/wpa/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in b/contrib/wpa/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in
deleted file mode 100644
index a75918f..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in
+++ /dev/null
@@ -1,5 +0,0 @@
-[D-BUS Service]
-Name=fi.epitest.hostap.WPASupplicant
-Exec=@BINDIR@/wpa_supplicant -u
-User=root
-SystemdService=wpa_supplicant.service
diff --git a/contrib/wpa/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in b/contrib/wpa/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in
deleted file mode 100644
index d97ff39..0000000
--- a/contrib/wpa/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in
+++ /dev/null
@@ -1,5 +0,0 @@
-[D-BUS Service]
-Name=fi.w1.wpa_supplicant1
-Exec=@BINDIR@/wpa_supplicant -u
-User=root
-SystemdService=wpa_supplicant.service
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/.gitignore b/contrib/wpa/wpa_supplicant/doc/docbook/.gitignore
deleted file mode 100644
index 8c3945c..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-manpage.links
-manpage.refs
-*.8
-*.5
-*.html
-*.pdf
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/Makefile b/contrib/wpa/wpa_supplicant/doc/docbook/Makefile
deleted file mode 100644
index aaeee2e..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-all: man html pdf
-
-FILES += wpa_background
-FILES += wpa_cli
-FILES += wpa_gui
-FILES += wpa_passphrase
-FILES += wpa_priv
-FILES += wpa_supplicant.conf
-FILES += wpa_supplicant
-
-man:
- for i in $(FILES); do docbook2man $$i.sgml; done
-
-html:
- for i in $(FILES); do docbook2html $$i.sgml && \
- mv index.html $$i.html; done
-
-pdf:
- for i in $(FILES); do docbook2pdf $$i.sgml; done
-
-
-clean:
- rm -f wpa_background.8 wpa_cli.8 wpa_gui.8 wpa_passphrase.8 wpa_priv.8 wpa_supplicant.8
- rm -f wpa_supplicant.conf.5
- rm -f manpage.links manpage.refs
- rm -f $(FILES:%=%.pdf)
- rm -f $(FILES:%=%.html)
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/manpage.links b/contrib/wpa/wpa_supplicant/doc/docbook/manpage.links
deleted file mode 100644
index e69de29..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/manpage.links
+++ /dev/null
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/manpage.refs b/contrib/wpa/wpa_supplicant/doc/docbook/manpage.refs
deleted file mode 100644
index 16ffc79..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/manpage.refs
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- '' => '',
- '' => ''
-}
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.8 b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.8
deleted file mode 100644
index ba838cd..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.8
+++ /dev/null
@@ -1,84 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "WPA_BACKGROUND" "8" "12 January 2013" "" ""
-
-.SH NAME
-wpa_background \- Background information on Wi-Fi Protected Access and IEEE 802.11i
-.SH "WPA"
-.PP
-The original security mechanism of IEEE 802.11 standard was
-not designed to be strong and has proven to be insufficient for
-most networks that require some kind of security. Task group I
-(Security) of IEEE 802.11 working group
-(http://www.ieee802.org/11/) has worked to address the flaws of
-the base standard and has in practice completed its work in May
-2004. The IEEE 802.11i amendment to the IEEE 802.11 standard was
-approved in June 2004 and published in July 2004.
-.PP
-Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version
-of the IEEE 802.11i work (draft 3.0) to define a subset of the
-security enhancements that can be implemented with existing wlan
-hardware. This is called Wi-Fi Protected Access<TM> (WPA). This
-has now become a mandatory component of interoperability testing
-and certification done by Wi-Fi Alliance. Wi-Fi provides
-information about WPA at its web site
-(http://www.wi-fi.org/OpenSection/protected_access.asp).
-.PP
-IEEE 802.11 standard defined wired equivalent privacy (WEP)
-algorithm for protecting wireless networks. WEP uses RC4 with
-40-bit keys, 24-bit initialization vector (IV), and CRC32 to
-protect against packet forgery. All these choices have proven to
-be insufficient: key space is too small against current attacks,
-RC4 key scheduling is insufficient (beginning of the pseudorandom
-stream should be skipped), IV space is too small and IV reuse
-makes attacks easier, there is no replay protection, and non-keyed
-authentication does not protect against bit flipping packet
-data.
-.PP
-WPA is an intermediate solution for the security issues. It
-uses Temporal Key Integrity Protocol (TKIP) to replace WEP. TKIP
-is a compromise on strong security and possibility to use existing
-hardware. It still uses RC4 for the encryption like WEP, but with
-per-packet RC4 keys. In addition, it implements replay protection,
-keyed packet authentication mechanism (Michael MIC).
-.PP
-Keys can be managed using two different mechanisms. WPA can
-either use an external authentication server (e.g., RADIUS) and
-EAP just like IEEE 802.1X is using or pre-shared keys without need
-for additional servers. Wi-Fi calls these "WPA-Enterprise" and
-"WPA-Personal", respectively. Both mechanisms will generate a
-master session key for the Authenticator (AP) and Supplicant
-(client station).
-.PP
-WPA implements a new key handshake (4-Way Handshake and
-Group Key Handshake) for generating and exchanging data encryption
-keys between the Authenticator and Supplicant. This handshake is
-also used to verify that both Authenticator and Supplicant know
-the master session key. These handshakes are identical regardless
-of the selected key management mechanism (only the method for
-generating master session key changes).
-.SH "IEEE 802.11I / WPA2"
-.PP
-The design for parts of IEEE 802.11i that were not included
-in WPA has finished (May 2004) and this amendment to IEEE 802.11
-was approved in June 2004. Wi-Fi Alliance is using the final IEEE
-802.11i as a new version of WPA called WPA2. This includes, e.g.,
-support for more robust encryption algorithm (CCMP: AES in Counter
-mode with CBC-MAC) to replace TKIP and optimizations for handoff
-(reduced number of messages in initial key handshake,
-pre-authentication, and PMKSA caching).
-.SH "SEE ALSO"
-.PP
-\fBwpa_supplicant\fR(8)
-.SH "LEGAL"
-.PP
-wpa_supplicant is copyright (c) 2003-2012,
-Jouni Malinen <j@w1.fi> and
-contributors.
-All Rights Reserved.
-.PP
-This program is licensed under the BSD license (the one with
-advertisement clause removed).
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.sgml b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.sgml
deleted file mode 100644
index eb3a089..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_background.sgml
+++ /dev/null
@@ -1,101 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<refentry>
- <refmeta>
- <refentrytitle>wpa_background</refentrytitle>
- <manvolnum>8</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>wpa_background</refname>
- <refpurpose>Background information on Wi-Fi Protected Access and IEEE 802.11i</refpurpose>
- </refnamediv>
- <refsect1>
- <title>WPA</title>
-
- <para>The original security mechanism of IEEE 802.11 standard was
- not designed to be strong and has proven to be insufficient for
- most networks that require some kind of security. Task group I
- (Security) of IEEE 802.11 working group
- (http://www.ieee802.org/11/) has worked to address the flaws of
- the base standard and has in practice completed its work in May
- 2004. The IEEE 802.11i amendment to the IEEE 802.11 standard was
- approved in June 2004 and published in July 2004.</para>
-
- <para>Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version
- of the IEEE 802.11i work (draft 3.0) to define a subset of the
- security enhancements that can be implemented with existing wlan
- hardware. This is called Wi-Fi Protected Access&lt;TM&gt; (WPA). This
- has now become a mandatory component of interoperability testing
- and certification done by Wi-Fi Alliance. Wi-Fi provides
- information about WPA at its web site
- (http://www.wi-fi.org/OpenSection/protected_access.asp).</para>
-
- <para>IEEE 802.11 standard defined wired equivalent privacy (WEP)
- algorithm for protecting wireless networks. WEP uses RC4 with
- 40-bit keys, 24-bit initialization vector (IV), and CRC32 to
- protect against packet forgery. All these choices have proven to
- be insufficient: key space is too small against current attacks,
- RC4 key scheduling is insufficient (beginning of the pseudorandom
- stream should be skipped), IV space is too small and IV reuse
- makes attacks easier, there is no replay protection, and non-keyed
- authentication does not protect against bit flipping packet
- data.</para>
-
- <para>WPA is an intermediate solution for the security issues. It
- uses Temporal Key Integrity Protocol (TKIP) to replace WEP. TKIP
- is a compromise on strong security and possibility to use existing
- hardware. It still uses RC4 for the encryption like WEP, but with
- per-packet RC4 keys. In addition, it implements replay protection,
- keyed packet authentication mechanism (Michael MIC).</para>
-
- <para>Keys can be managed using two different mechanisms. WPA can
- either use an external authentication server (e.g., RADIUS) and
- EAP just like IEEE 802.1X is using or pre-shared keys without need
- for additional servers. Wi-Fi calls these "WPA-Enterprise" and
- "WPA-Personal", respectively. Both mechanisms will generate a
- master session key for the Authenticator (AP) and Supplicant
- (client station).</para>
-
- <para>WPA implements a new key handshake (4-Way Handshake and
- Group Key Handshake) for generating and exchanging data encryption
- keys between the Authenticator and Supplicant. This handshake is
- also used to verify that both Authenticator and Supplicant know
- the master session key. These handshakes are identical regardless
- of the selected key management mechanism (only the method for
- generating master session key changes).</para>
- </refsect1>
-
- <refsect1>
- <title>IEEE 802.11i / WPA2</title>
-
- <para>The design for parts of IEEE 802.11i that were not included
- in WPA has finished (May 2004) and this amendment to IEEE 802.11
- was approved in June 2004. Wi-Fi Alliance is using the final IEEE
- 802.11i as a new version of WPA called WPA2. This includes, e.g.,
- support for more robust encryption algorithm (CCMP: AES in Counter
- mode with CBC-MAC) to replace TKIP and optimizations for handoff
- (reduced number of messages in initial key handshake,
- pre-authentication, and PMKSA caching).</para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry>
- <refentrytitle>wpa_supplicant</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
-
- <refsect1>
- <title>Legal</title>
- <para>wpa_supplicant is copyright (c) 2003-2012,
- Jouni Malinen <email>j@w1.fi</email> and
- contributors.
- All Rights Reserved.</para>
-
- <para>This program is licensed under the BSD license (the one with
- advertisement clause removed).</para>
- </refsect1>
-</refentry>
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.8 b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.8
deleted file mode 100644
index 886e9b0..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.8
+++ /dev/null
@@ -1,210 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "WPA_CLI" "8" "12 January 2013" "" ""
-
-.SH NAME
-wpa_cli \- WPA command line client
-.SH SYNOPSIS
-
-\fBwpa_cli\fR [ \fB-p \fIpath to ctrl sockets\fB\fR ] [ \fB-i \fIifname\fB\fR ] [ \fB-hvB\fR ] [ \fB-a \fIaction file\fB\fR ] [ \fB-P \fIpid file\fB\fR ] [ \fB\fIcommand ...\fB\fR ]
-
-.SH "OVERVIEW"
-.PP
-wpa_cli is a text-based frontend program for interacting
-with wpa_supplicant. It is used to query current status, change
-configuration, trigger events, and request interactive user
-input.
-.PP
-wpa_cli can show the current authentication status, selected
-security mode, dot11 and dot1x MIBs, etc. In addition, it can
-configure some variables like EAPOL state machine parameters and
-trigger events like reassociation and IEEE 802.1X
-logoff/logon. wpa_cli provides a user interface to request
-authentication information, like username and password, if these
-are not included in the configuration. This can be used to
-implement, e.g., one-time-passwords or generic token card
-authentication where the authentication is based on a
-challenge-response that uses an external device for generating the
-response.
-.PP
-The control interface of wpa_supplicant can be configured to
-allow non-root user access (ctrl_interface GROUP= parameter in the
-configuration file). This makes it possible to run wpa_cli with a
-normal user account.
-.PP
-wpa_cli supports two modes: interactive and command
-line. Both modes share the same command set and the main
-difference is in interactive mode providing access to unsolicited
-messages (event messages, username/password requests).
-.PP
-Interactive mode is started when wpa_cli is executed without
-including the command as a command line parameter. Commands are
-then entered on the wpa_cli prompt. In command line mode, the same
-commands are entered as command line arguments for wpa_cli.
-.SH "INTERACTIVE AUTHENTICATION PARAMETERS REQUEST"
-.PP
-When wpa_supplicant need authentication parameters, like
-username and password, which are not present in the configuration
-file, it sends a request message to all attached frontend programs,
-e.g., wpa_cli in interactive mode. wpa_cli shows these requests
-with "CTRL-REQ-<type>-<id>:<text>"
-prefix. <type> is IDENTITY, PASSWORD, or OTP
-(one-time-password). <id> is a unique identifier for the
-current network. <text> is description of the request. In
-case of OTP request, it includes the challenge from the
-authentication server.
-.PP
-The reply to these requests can be given with
-\fBidentity\fR, \fBpassword\fR, and
-\fBotp\fR commands. <id> needs to be copied from
-the matching request. \fBpassword\fR and
-\fBotp\fR commands can be used regardless of whether
-the request was for PASSWORD or OTP. The main difference between these
-two commands is that values given with \fBpassword\fR are
-remembered as long as wpa_supplicant is running whereas values given
-with \fBotp\fR are used only once and then forgotten,
-i.e., wpa_supplicant will ask frontend for a new value for every use.
-This can be used to implement one-time-password lists and generic token
-card -based authentication.
-.PP
-Example request for password and a matching reply:
-.sp
-.RS
-
-.nf
-CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
-> password 1 mysecretpassword
-.fi
-.RE
-.PP
-Example request for generic token card challenge-response:
-.sp
-.RS
-
-.nf
-CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
-> otp 2 9876
-.fi
-.RE
-.SH "COMMAND ARGUMENTS"
-.TP
-\fB-p path\fR
-Change the path where control sockets should
-be found.
-.TP
-\fB-i ifname\fR
-Specify the interface that is being
-configured. By default, choose the first interface found with
-a control socket in the socket path.
-.TP
-\fB-h\fR
-Help. Show a usage message.
-.TP
-\fB-v\fR
-Show version information.
-.TP
-\fB-B\fR
-Run as a daemon in the background.
-.TP
-\fB-a file\fR
-Run in daemon mode executing the action file
-based on events from wpa_supplicant. The specified file will
-be executed with the first argument set to interface name and
-second to "CONNECTED" or "DISCONNECTED" depending on the event.
-This can be used to execute networking tools required to configure
-the interface.
-
-Additionally, three environmental variables are available to
-the file: WPA_CTRL_DIR, WPA_ID, and WPA_ID_STR. WPA_CTRL_DIR
-contains the absolute path to the ctrl_interface socket. WPA_ID
-contains the unique network_id identifier assigned to the active
-network, and WPA_ID_STR contains the content of the id_str option.
-.TP
-\fB-P file\fR
-Set the location of the PID
-file.
-.TP
-\fBcommand\fR
-Run a command. The available commands are
-listed in the next section.
-.SH "COMMANDS"
-.PP
-The following commands are available:
-.TP
-\fBstatus\fR
-get current WPA/EAPOL/EAP status
-.TP
-\fBmib\fR
-get MIB variables (dot1x, dot11)
-.TP
-\fBhelp\fR
-show this usage help
-.TP
-\fBinterface [ifname]\fR
-show interfaces/select interface
-.TP
-\fBlevel <debug level>\fR
-change debug level
-.TP
-\fBlicense\fR
-show full wpa_cli license
-.TP
-\fBlogoff\fR
-IEEE 802.1X EAPOL state machine logoff
-.TP
-\fBlogon\fR
-IEEE 802.1X EAPOL state machine logon
-.TP
-\fBset\fR
-set variables (shows list of variables when run without arguments)
-.TP
-\fBpmksa\fR
-show PMKSA cache
-.TP
-\fBreassociate\fR
-force reassociation
-.TP
-\fBreconfigure\fR
-force wpa_supplicant to re-read its configuration file
-.TP
-\fBpreauthenticate <BSSID>\fR
-force preauthentication
-.TP
-\fBidentity <network id> <identity>\fR
-configure identity for an SSID
-.TP
-\fBpassword <network id> <password>\fR
-configure password for an SSID
-.TP
-\fBpin <network id> <pin>\fR
-configure pin for an SSID
-.TP
-\fBotp <network id> <password>\fR
-configure one-time-password for an SSID
-.TP
-\fBbssid <network id> <BSSID>\fR
-set preferred BSSID for an SSID
-.TP
-\fBlist_networks\fR
-list configured networks
-.TP
-\fBterminate\fR
-terminate \fBwpa_supplicant\fR
-.TP
-\fBquit\fR
-exit wpa_cli
-.SH "SEE ALSO"
-.PP
-\fBwpa_supplicant\fR(8)
-.SH "LEGAL"
-.PP
-wpa_supplicant is copyright (c) 2003-2012,
-Jouni Malinen <j@w1.fi> and
-contributors.
-All Rights Reserved.
-.PP
-This program is licensed under the BSD license (the one with
-advertisement clause removed).
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.sgml b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.sgml
deleted file mode 100644
index c080c07..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_cli.sgml
+++ /dev/null
@@ -1,339 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<refentry>
- <refmeta>
- <refentrytitle>wpa_cli</refentrytitle>
- <manvolnum>8</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>wpa_cli</refname>
-
- <refpurpose>WPA command line client</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>wpa_cli</command>
- <arg>-p <replaceable>path to ctrl sockets</replaceable></arg>
- <arg>-i <replaceable>ifname</replaceable></arg>
- <arg>-hvB</arg>
- <arg>-a <replaceable>action file</replaceable></arg>
- <arg>-P <replaceable>pid file</replaceable></arg>
- <arg><replaceable>command ...</replaceable></arg>
- </cmdsynopsis>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Overview</title>
-
- <para>wpa_cli is a text-based frontend program for interacting
- with wpa_supplicant. It is used to query current status, change
- configuration, trigger events, and request interactive user
- input.</para>
-
- <para>wpa_cli can show the current authentication status, selected
- security mode, dot11 and dot1x MIBs, etc. In addition, it can
- configure some variables like EAPOL state machine parameters and
- trigger events like reassociation and IEEE 802.1X
- logoff/logon. wpa_cli provides a user interface to request
- authentication information, like username and password, if these
- are not included in the configuration. This can be used to
- implement, e.g., one-time-passwords or generic token card
- authentication where the authentication is based on a
- challenge-response that uses an external device for generating the
- response.</para>
-
- <para>The control interface of wpa_supplicant can be configured to
- allow non-root user access (ctrl_interface GROUP= parameter in the
- configuration file). This makes it possible to run wpa_cli with a
- normal user account.</para>
-
- <para>wpa_cli supports two modes: interactive and command
- line. Both modes share the same command set and the main
- difference is in interactive mode providing access to unsolicited
- messages (event messages, username/password requests).</para>
-
- <para>Interactive mode is started when wpa_cli is executed without
- including the command as a command line parameter. Commands are
- then entered on the wpa_cli prompt. In command line mode, the same
- commands are entered as command line arguments for wpa_cli.</para>
- </refsect1>
- <refsect1>
- <title>Interactive authentication parameters request</title>
-
- <para>When wpa_supplicant need authentication parameters, like
- username and password, which are not present in the configuration
- file, it sends a request message to all attached frontend programs,
- e.g., wpa_cli in interactive mode. wpa_cli shows these requests
- with "CTRL-REQ-&lt;type&gt;-&lt;id&gt;:&lt;text&gt;"
- prefix. &lt;type&gt; is IDENTITY, PASSWORD, or OTP
- (one-time-password). &lt;id&gt; is a unique identifier for the
- current network. &lt;text&gt; is description of the request. In
- case of OTP request, it includes the challenge from the
- authentication server.</para>
-
- <para>The reply to these requests can be given with
- <emphasis>identity</emphasis>, <emphasis>password</emphasis>, and
- <emphasis>otp</emphasis> commands. &lt;id&gt; needs to be copied from
- the matching request. <emphasis>password</emphasis> and
- <emphasis>otp</emphasis> commands can be used regardless of whether
- the request was for PASSWORD or OTP. The main difference between these
- two commands is that values given with <emphasis>password</emphasis> are
- remembered as long as wpa_supplicant is running whereas values given
- with <emphasis>otp</emphasis> are used only once and then forgotten,
- i.e., wpa_supplicant will ask frontend for a new value for every use.
- This can be used to implement one-time-password lists and generic token
- card -based authentication.</para>
-
- <para>Example request for password and a matching reply:</para>
-
-<blockquote><programlisting>
-CTRL-REQ-PASSWORD-1:Password needed for SSID foobar
-> password 1 mysecretpassword
-</programlisting></blockquote>
-
- <para>Example request for generic token card challenge-response:</para>
-
-<blockquote><programlisting>
-CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
-> otp 2 9876
-</programlisting></blockquote>
-
- </refsect1>
- <refsect1>
- <title>Command Arguments</title>
- <variablelist>
- <varlistentry>
- <term>-p path</term>
-
- <listitem><para>Change the path where control sockets should
- be found.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-i ifname</term>
-
- <listitem><para>Specify the interface that is being
- configured. By default, choose the first interface found with
- a control socket in the socket path.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-h</term>
- <listitem><para>Help. Show a usage message.</para></listitem>
- </varlistentry>
-
-
- <varlistentry>
- <term>-v</term>
- <listitem><para>Show version information.</para></listitem>
- </varlistentry>
-
-
- <varlistentry>
- <term>-B</term>
- <listitem><para>Run as a daemon in the background.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-a file</term>
-
- <listitem><para>Run in daemon mode executing the action file
- based on events from wpa_supplicant. The specified file will
- be executed with the first argument set to interface name and
- second to "CONNECTED" or "DISCONNECTED" depending on the event.
- This can be used to execute networking tools required to configure
- the interface.</para>
-
- <para>Additionally, three environmental variables are available to
- the file: WPA_CTRL_DIR, WPA_ID, and WPA_ID_STR. WPA_CTRL_DIR
- contains the absolute path to the ctrl_interface socket. WPA_ID
- contains the unique network_id identifier assigned to the active
- network, and WPA_ID_STR contains the content of the id_str option.
- </para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-P file</term>
-
- <listitem><para>Set the location of the PID
- file.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>command</term>
-
- <listitem><para>Run a command. The available commands are
- listed in the next section.</para></listitem>
-
- </varlistentry>
- </variablelist>
- </refsect1>
- <refsect1>
- <title>Commands</title>
- <para>The following commands are available:</para>
-
- <variablelist>
- <varlistentry>
- <term>status</term>
- <listitem>
- <para>get current WPA/EAPOL/EAP status</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>mib</term>
- <listitem>
- <para>get MIB variables (dot1x, dot11)</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>help</term>
- <listitem>
- <para>show this usage help</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>interface [ifname]</term>
- <listitem>
- <para>show interfaces/select interface</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>level &lt;debug level&gt;</term>
- <listitem>
- <para>change debug level</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>license</term>
- <listitem>
- <para>show full wpa_cli license</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>logoff</term>
- <listitem>
- <para>IEEE 802.1X EAPOL state machine logoff</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>logon</term>
- <listitem>
- <para>IEEE 802.1X EAPOL state machine logon</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>set</term>
- <listitem>
- <para>set variables (shows list of variables when run without arguments)</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>pmksa</term>
- <listitem>
- <para>show PMKSA cache</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>reassociate</term>
- <listitem>
- <para>force reassociation</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>reconfigure</term>
- <listitem>
- <para>force wpa_supplicant to re-read its configuration file</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>preauthenticate &lt;BSSID&gt;</term>
- <listitem>
- <para>force preauthentication</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>identity &lt;network id&gt; &lt;identity&gt;</term>
- <listitem>
- <para>configure identity for an SSID</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>password &lt;network id&gt; &lt;password&gt;</term>
- <listitem>
- <para>configure password for an SSID</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>pin &lt;network id&gt; &lt;pin&gt;</term>
- <listitem>
- <para>configure pin for an SSID</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>otp &lt;network id&gt; &lt;password&gt;</term>
- <listitem>
- <para>configure one-time-password for an SSID</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>bssid &lt;network id&gt; &lt;BSSID&gt;</term>
- <listitem>
- <para>set preferred BSSID for an SSID</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>list_networks</term>
- <listitem>
- <para>list configured networks</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>terminate</term>
- <listitem>
- <para>terminate <command>wpa_supplicant</command></para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>quit</term>
- <listitem><para>exit wpa_cli</para></listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry>
- <refentrytitle>wpa_supplicant</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
- <refsect1>
- <title>Legal</title>
- <para>wpa_supplicant is copyright (c) 2003-2012,
- Jouni Malinen <email>j@w1.fi</email> and
- contributors.
- All Rights Reserved.</para>
-
- <para>This program is licensed under the BSD license (the one with
- advertisement clause removed).</para>
- </refsect1>
-</refentry>
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.8 b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.8
deleted file mode 100644
index f94beb3..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.8
+++ /dev/null
@@ -1,51 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "WPA_GUI" "8" "12 January 2013" "" ""
-
-.SH NAME
-wpa_gui \- WPA Graphical User Interface
-.SH SYNOPSIS
-
-\fBwpa_gui\fR [ \fB-p \fIpath to ctrl sockets\fB\fR ] [ \fB-i \fIifname\fB\fR ] [ \fB-t\fR ]
-
-.SH "OVERVIEW"
-.PP
-wpa_gui is a QT graphical frontend program for interacting
-with wpa_supplicant. It is used to query current status, change
-configuration and request interactive user input.
-.PP
-wpa_gui supports (almost) all of the interactive status and
-configuration features of the command line client, wpa_cli. Refer
-to the wpa_cli manpage for a comprehensive list of the
-interactive mode features.
-.SH "COMMAND ARGUMENTS"
-.TP
-\fB-p path\fR
-Change the path where control sockets should
-be found.
-.TP
-\fB-i ifname\fR
-Specify the interface that is being
-configured. By default, choose the first interface found with
-a control socket in the socket path.
-.TP
-\fB-t\fR
-Start program in the system tray only (if the window
-manager supports it). By default the main status window is
-shown.
-.SH "SEE ALSO"
-.PP
-\fBwpa_cli\fR(8)
-\fBwpa_supplicant\fR(8)
-.SH "LEGAL"
-.PP
-wpa_supplicant is copyright (c) 2003-2012,
-Jouni Malinen <j@w1.fi> and
-contributors.
-All Rights Reserved.
-.PP
-This program is licensed under the BSD license (the one with
-advertisement clause removed).
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.sgml b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.sgml
deleted file mode 100644
index 0ab6419..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_gui.sgml
+++ /dev/null
@@ -1,85 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<refentry>
- <refmeta>
- <refentrytitle>wpa_gui</refentrytitle>
- <manvolnum>8</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>wpa_gui</refname>
-
- <refpurpose>WPA Graphical User Interface</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>wpa_gui</command>
- <arg>-p <replaceable>path to ctrl sockets</replaceable></arg>
- <arg>-i <replaceable>ifname</replaceable></arg>
- <arg>-t</arg>
- </cmdsynopsis>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Overview</title>
-
- <para>wpa_gui is a QT graphical frontend program for interacting
- with wpa_supplicant. It is used to query current status, change
- configuration and request interactive user input.</para>
-
- <para>wpa_gui supports (almost) all of the interactive status and
- configuration features of the command line client, wpa_cli. Refer
- to the wpa_cli manpage for a comprehensive list of the
- interactive mode features.</para>
- </refsect1>
- <refsect1>
- <title>Command Arguments</title>
- <variablelist>
- <varlistentry>
- <term>-p path</term>
-
- <listitem><para>Change the path where control sockets should
- be found.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-i ifname</term>
-
- <listitem><para>Specify the interface that is being
- configured. By default, choose the first interface found with
- a control socket in the socket path.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-t</term>
-
- <listitem><para>Start program in the system tray only (if the window
- manager supports it). By default the main status window is
- shown.</para></listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry>
- <refentrytitle>wpa_cli</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>wpa_supplicant</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
- <refsect1>
- <title>Legal</title>
- <para>wpa_supplicant is copyright (c) 2003-2012,
- Jouni Malinen <email>j@w1.fi</email> and
- contributors.
- All Rights Reserved.</para>
-
- <para>This program is licensed under the BSD license (the one with
- advertisement clause removed).</para>
- </refsect1>
-</refentry>
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.8 b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.8
deleted file mode 100644
index d9c1e6c..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.8
+++ /dev/null
@@ -1,40 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "WPA_PASSPHRASE" "8" "12 January 2013" "" ""
-
-.SH NAME
-wpa_passphrase \- Generate a WPA PSK from an ASCII passphrase for a SSID
-.SH SYNOPSIS
-
-\fBwpa_passphrase\fR [ \fB\fIssid\fB\fR ] [ \fB\fIpassphrase\fB\fR ]
-
-.SH "OVERVIEW"
-.PP
-\fBwpa_passphrase\fR pre-computes PSK entries for
-network configuration blocks of a
-\fIwpa_supplicant.conf\fR file. An ASCII passphrase
-and SSID are used to generate a 256-bit PSK.
-.SH "OPTIONS"
-.TP
-\fBssid\fR
-The SSID whose passphrase should be derived.
-.TP
-\fBpassphrase\fR
-The passphrase to use. If not included on the command line,
-passphrase will be read from standard input.
-.SH "SEE ALSO"
-.PP
-\fBwpa_supplicant.conf\fR(5)
-\fBwpa_supplicant\fR(8)
-.SH "LEGAL"
-.PP
-wpa_supplicant is copyright (c) 2003-2012,
-Jouni Malinen <j@w1.fi> and
-contributors.
-All Rights Reserved.
-.PP
-This program is licensed under the BSD license (the one with
-advertisement clause removed).
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.sgml b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.sgml
deleted file mode 100644
index 336c03b..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_passphrase.sgml
+++ /dev/null
@@ -1,73 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<refentry>
- <refmeta>
- <refentrytitle>wpa_passphrase</refentrytitle>
- <manvolnum>8</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>wpa_passphrase</refname>
- <refpurpose>Generate a WPA PSK from an ASCII passphrase for a SSID</refpurpose>
- </refnamediv>
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>wpa_passphrase</command>
- <arg><replaceable>ssid</replaceable></arg>
- <arg><replaceable>passphrase</replaceable></arg>
- </cmdsynopsis>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Overview</title>
-
- <para><command>wpa_passphrase</command> pre-computes PSK entries for
- network configuration blocks of a
- <filename>wpa_supplicant.conf</filename> file. An ASCII passphrase
- and SSID are used to generate a 256-bit PSK.</para>
- </refsect1>
-
- <refsect1>
- <title>Options</title>
- <variablelist>
- <varlistentry>
- <term>ssid</term>
- <listitem>
- <para>The SSID whose passphrase should be derived.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>passphrase</term>
- <listitem>
- <para>The passphrase to use. If not included on the command line,
- passphrase will be read from standard input.</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry>
- <refentrytitle>wpa_supplicant.conf</refentrytitle>
- <manvolnum>5</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>wpa_supplicant</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- </para>
-
- </refsect1>
- <refsect1>
- <title>Legal</title>
- <para>wpa_supplicant is copyright (c) 2003-2012,
- Jouni Malinen <email>j@w1.fi</email> and
- contributors.
- All Rights Reserved.</para>
-
- <para>This program is licensed under the BSD license (the one with
- advertisement clause removed).</para>
- </refsect1>
-</refentry>
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.8 b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.8
deleted file mode 100644
index 108f7ee..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.8
+++ /dev/null
@@ -1,120 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "WPA_PRIV" "8" "12 January 2013" "" ""
-
-.SH NAME
-wpa_priv \- wpa_supplicant privilege separation helper
-.SH SYNOPSIS
-
-\fBwpa_priv\fR [ \fB-c \fIctrl path\fB\fR ] [ \fB-Bdd\fR ] [ \fB-P \fIpid file\fB\fR ] [ \fBdriver:ifname \fI[driver:ifname ...]\fB\fR ]
-
-.SH "OVERVIEW"
-.PP
-\fBwpa_priv\fR is a privilege separation helper that
-minimizes the size of \fBwpa_supplicant\fR code that needs
-to be run with root privileges.
-.PP
-If enabled, privileged operations are done in the wpa_priv process
-while leaving rest of the code (e.g., EAP authentication and WPA
-handshakes) to operate in an unprivileged process (wpa_supplicant) that
-can be run as non-root user. Privilege separation restricts the effects
-of potential software errors by containing the majority of the code in an
-unprivileged process to avoid the possibility of a full system
-compromise.
-.PP
-\fBwpa_priv\fR needs to be run with network admin
-privileges (usually, root user). It opens a UNIX domain socket for each
-interface that is included on the command line; any other interface will
-be off limits for \fBwpa_supplicant\fR in this kind of
-configuration. After this, \fBwpa_supplicant\fR can be run as
-a non-root user (e.g., all standard users on a laptop or as a special
-non-privileged user account created just for this purpose to limit access
-to user files even further).
-.SH "EXAMPLE CONFIGURATION"
-.PP
-The following steps are an example of how to configure
-\fBwpa_priv\fR to allow users in the
-\fBwpapriv\fR group to communicate with
-\fBwpa_supplicant\fR with privilege separation:
-.PP
-Create user group (e.g., wpapriv) and assign users that
-should be able to use wpa_supplicant into that group.
-.PP
-Create /var/run/wpa_priv directory for UNIX domain sockets and
-control user access by setting it accessible only for the wpapriv
-group:
-.sp
-.RS
-
-.nf
-mkdir /var/run/wpa_priv
-chown root:wpapriv /var/run/wpa_priv
-chmod 0750 /var/run/wpa_priv
-.fi
-.RE
-.PP
-Start \fBwpa_priv\fR as root (e.g., from system
-startup scripts) with the enabled interfaces configured on the
-command line:
-.sp
-.RS
-
-.nf
-wpa_priv -B -c /var/run/wpa_priv -P /var/run/wpa_priv.pid wext:wlan0
-.fi
-.RE
-.PP
-Run \fBwpa_supplicant\fR as non-root with a user
-that is in the wpapriv group:
-.sp
-.RS
-
-.nf
-wpa_supplicant -i ath0 -c wpa_supplicant.conf
-.fi
-.RE
-.SH "COMMAND ARGUMENTS"
-.TP
-\fB-c ctrl path\fR
-Specify the path to wpa_priv control directory
-(Default: /var/run/wpa_priv/).
-.TP
-\fB-B\fR
-Run as a daemon in the background.
-.TP
-\fB-P file\fR
-Set the location of the PID
-file.
-.TP
-\fBdriver:ifname [driver:ifname ...]\fR
-The <driver> string dictates which of the
-supported \fBwpa_supplicant\fR driver backends is to be
-used. To get a list of supported driver types see wpa_supplicant help
-(e.g, wpa_supplicant -h). The driver backend supported by most good
-drivers is \fBwext\fR\&.
-
-The <ifname> string specifies which network
-interface is to be managed by \fBwpa_supplicant\fR
-(e.g., wlan0 or ath0).
-
-\fBwpa_priv\fR does not use the network interface
-before \fBwpa_supplicant\fR is started, so it is fine to
-include network interfaces that are not available at the time wpa_priv
-is started. wpa_priv can control multiple interfaces with one process,
-but it is also possible to run multiple \fBwpa_priv\fR
-processes at the same time, if desired.
-.SH "SEE ALSO"
-.PP
-\fBwpa_supplicant\fR(8)
-.SH "LEGAL"
-.PP
-wpa_supplicant is copyright (c) 2003-2012,
-Jouni Malinen <j@w1.fi> and
-contributors.
-All Rights Reserved.
-.PP
-This program is licensed under the BSD license (the one with
-advertisement clause removed).
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.sgml b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.sgml
deleted file mode 100644
index eb907a8..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_priv.sgml
+++ /dev/null
@@ -1,148 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<refentry>
- <refmeta>
- <refentrytitle>wpa_priv</refentrytitle>
- <manvolnum>8</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>wpa_priv</refname>
-
- <refpurpose>wpa_supplicant privilege separation helper</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>wpa_priv</command>
- <arg>-c <replaceable>ctrl path</replaceable></arg>
- <arg>-Bdd</arg>
- <arg>-P <replaceable>pid file</replaceable></arg>
- <arg>driver:ifname <replaceable>[driver:ifname ...]</replaceable></arg>
- </cmdsynopsis>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Overview</title>
-
- <para><command>wpa_priv</command> is a privilege separation helper that
- minimizes the size of <command>wpa_supplicant</command> code that needs
- to be run with root privileges.</para>
-
- <para>If enabled, privileged operations are done in the wpa_priv process
- while leaving rest of the code (e.g., EAP authentication and WPA
- handshakes) to operate in an unprivileged process (wpa_supplicant) that
- can be run as non-root user. Privilege separation restricts the effects
- of potential software errors by containing the majority of the code in an
- unprivileged process to avoid the possibility of a full system
- compromise.</para>
-
- <para><command>wpa_priv</command> needs to be run with network admin
- privileges (usually, root user). It opens a UNIX domain socket for each
- interface that is included on the command line; any other interface will
- be off limits for <command>wpa_supplicant</command> in this kind of
- configuration. After this, <command>wpa_supplicant</command> can be run as
- a non-root user (e.g., all standard users on a laptop or as a special
- non-privileged user account created just for this purpose to limit access
- to user files even further).</para>
- </refsect1>
- <refsect1>
- <title>Example configuration</title>
-
- <para>The following steps are an example of how to configure
- <command>wpa_priv</command> to allow users in the
- <emphasis>wpapriv</emphasis> group to communicate with
- <command>wpa_supplicant</command> with privilege separation:</para>
-
- <para>Create user group (e.g., wpapriv) and assign users that
- should be able to use wpa_supplicant into that group.</para>
-
- <para>Create /var/run/wpa_priv directory for UNIX domain sockets and
- control user access by setting it accessible only for the wpapriv
- group:</para>
-
-<blockquote><programlisting>
-mkdir /var/run/wpa_priv
-chown root:wpapriv /var/run/wpa_priv
-chmod 0750 /var/run/wpa_priv
-</programlisting></blockquote>
-
- <para>Start <command>wpa_priv</command> as root (e.g., from system
- startup scripts) with the enabled interfaces configured on the
- command line:</para>
-
-<blockquote><programlisting>
-wpa_priv -B -c /var/run/wpa_priv -P /var/run/wpa_priv.pid wext:wlan0
-</programlisting></blockquote>
-
- <para>Run <command>wpa_supplicant</command> as non-root with a user
- that is in the wpapriv group:</para>
-
-<blockquote><programlisting>
-wpa_supplicant -i ath0 -c wpa_supplicant.conf
-</programlisting></blockquote>
-
- </refsect1>
- <refsect1>
- <title>Command Arguments</title>
- <variablelist>
- <varlistentry>
- <term>-c ctrl path</term>
-
- <listitem><para>Specify the path to wpa_priv control directory
- (Default: /var/run/wpa_priv/).</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-B</term>
- <listitem><para>Run as a daemon in the background.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-P file</term>
-
- <listitem><para>Set the location of the PID
- file.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>driver:ifname [driver:ifname ...]</term>
-
- <listitem><para>The &lt;driver&gt; string dictates which of the
- supported <command>wpa_supplicant</command> driver backends is to be
- used. To get a list of supported driver types see wpa_supplicant help
- (e.g, wpa_supplicant -h). The driver backend supported by most good
- drivers is <emphasis>wext</emphasis>.</para>
-
- <para>The &lt;ifname&gt; string specifies which network
- interface is to be managed by <command>wpa_supplicant</command>
- (e.g., wlan0 or ath0).</para>
-
- <para><command>wpa_priv</command> does not use the network interface
- before <command>wpa_supplicant</command> is started, so it is fine to
- include network interfaces that are not available at the time wpa_priv
- is started. wpa_priv can control multiple interfaces with one process,
- but it is also possible to run multiple <command>wpa_priv</command>
- processes at the same time, if desired.</para></listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry>
- <refentrytitle>wpa_supplicant</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
- <refsect1>
- <title>Legal</title>
- <para>wpa_supplicant is copyright (c) 2003-2012,
- Jouni Malinen <email>j@w1.fi</email> and
- contributors.
- All Rights Reserved.</para>
-
- <para>This program is licensed under the BSD license (the one with
- advertisement clause removed).</para>
- </refsect1>
-</refentry>
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.8 b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.8
deleted file mode 100644
index 7941dcf..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.8
+++ /dev/null
@@ -1,511 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "WPA_SUPPLICANT" "8" "12 January 2013" "" ""
-
-.SH NAME
-wpa_supplicant \- Wi-Fi Protected Access client and IEEE 802.1X supplicant
-.SH SYNOPSIS
-
-\fBwpa_supplicant\fR [ \fB-BddfhKLqqtuvW\fR ] [ \fB-i\fIifname\fB\fR ] [ \fB-c\fIconfig file\fB\fR ] [ \fB-D\fIdriver\fB\fR ] [ \fB-P\fIPID_file\fB\fR ] [ \fB-f\fIoutput file\fB\fR ]
-
-.SH "OVERVIEW"
-.PP
-Wireless networks do not require physical access to the network equipment
-in the same way as wired networks. This makes it easier for unauthorized
-users to passively monitor a network and capture all transmitted frames.
-In addition, unauthorized use of the network is much easier. In many cases,
-this can happen even without user's explicit knowledge since the wireless
-LAN adapter may have been configured to automatically join any available
-network.
-.PP
-Link-layer encryption can be used to provide a layer of security for
-wireless networks. The original wireless LAN standard, IEEE 802.11,
-included a simple encryption mechanism, WEP. However, that proved to
-be flawed in many areas and network protected with WEP cannot be consider
-secure. IEEE 802.1X authentication and frequently changed dynamic WEP keys
-can be used to improve the network security, but even that has inherited
-security issues due to the use of WEP for encryption. Wi-Fi Protected
-Access and IEEE 802.11i amendment to the wireless LAN standard introduce
-a much improvement mechanism for securing wireless networks. IEEE 802.11i
-enabled networks that are using CCMP (encryption mechanism based on strong
-cryptographic algorithm AES) can finally be called secure used for
-applications which require efficient protection against unauthorized
-access.
-.PP
-\fBwpa_supplicant\fR is an implementation of
-the WPA Supplicant component, i.e., the part that runs in the
-client stations. It implements WPA key negotiation with a WPA
-Authenticator and EAP authentication with Authentication
-Server. In addition, it controls the roaming and IEEE 802.11
-authentication/association of the wireless LAN driver.
-.PP
-\fBwpa_supplicant\fR is designed to be a
-"daemon" program that runs in the background and acts as the
-backend component controlling the wireless
-connection. \fBwpa_supplicant\fR supports separate
-frontend programs and an example text-based frontend,
-\fBwpa_cli\fR, is included with
-wpa_supplicant.
-.PP
-Before wpa_supplicant can do its work, the network interface
-must be available. That means that the physical device must be
-present and enabled, and the driver for the device must be
-loaded. The daemon will exit immediately if the device is not already
-available.
-.PP
-After \fBwpa_supplicant\fR has configured the
-network device, higher level configuration such as DHCP may
-proceed. There are a variety of ways to integrate wpa_supplicant
-into a machine's networking scripts, a few of which are described
-in sections below.
-.PP
-The following steps are used when associating with an AP
-using WPA:
-.TP 0.2i
-\(bu
-\fBwpa_supplicant\fR requests the kernel
-driver to scan neighboring BSSes
-.TP 0.2i
-\(bu
-\fBwpa_supplicant\fR selects a BSS based on
-its configuration
-.TP 0.2i
-\(bu
-\fBwpa_supplicant\fR requests the kernel
-driver to associate with the chosen BSS
-.TP 0.2i
-\(bu
-If WPA-EAP: integrated IEEE 802.1X Supplicant
-completes EAP authentication with the
-authentication server (proxied by the Authenticator in the
-AP)
-.TP 0.2i
-\(bu
-If WPA-EAP: master key is received from the IEEE 802.1X
-Supplicant
-.TP 0.2i
-\(bu
-If WPA-PSK: \fBwpa_supplicant\fR uses PSK
-as the master session key
-.TP 0.2i
-\(bu
-\fBwpa_supplicant\fR completes WPA 4-Way
-Handshake and Group Key Handshake with the Authenticator
-(AP)
-.TP 0.2i
-\(bu
-\fBwpa_supplicant\fR configures encryption
-keys for unicast and broadcast
-.TP 0.2i
-\(bu
-normal data packets can be transmitted and received
-.SH "SUPPORTED FEATURES"
-.PP
-Supported WPA/IEEE 802.11i features:
-.TP 0.2i
-\(bu
-WPA-PSK ("WPA-Personal")
-.TP 0.2i
-\(bu
-WPA with EAP (e.g., with RADIUS authentication server)
-("WPA-Enterprise") Following authentication methods are
-supported with an integrate IEEE 802.1X Supplicant:
-.RS
-.TP 0.2i
-\(bu
-EAP-TLS
-.RE
-.RS
-.TP 0.2i
-\(bu
-EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1)
-.TP 0.2i
-\(bu
-EAP-PEAP/TLS (both PEAPv0 and PEAPv1)
-.TP 0.2i
-\(bu
-EAP-PEAP/GTC (both PEAPv0 and PEAPv1)
-.TP 0.2i
-\(bu
-EAP-PEAP/OTP (both PEAPv0 and PEAPv1)
-.TP 0.2i
-\(bu
-EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1)
-.TP 0.2i
-\(bu
-EAP-TTLS/EAP-MD5-Challenge
-.TP 0.2i
-\(bu
-EAP-TTLS/EAP-GTC
-.TP 0.2i
-\(bu
-EAP-TTLS/EAP-OTP
-.TP 0.2i
-\(bu
-EAP-TTLS/EAP-MSCHAPv2
-.TP 0.2i
-\(bu
-EAP-TTLS/EAP-TLS
-.TP 0.2i
-\(bu
-EAP-TTLS/MSCHAPv2
-.TP 0.2i
-\(bu
-EAP-TTLS/MSCHAP
-.TP 0.2i
-\(bu
-EAP-TTLS/PAP
-.TP 0.2i
-\(bu
-EAP-TTLS/CHAP
-.TP 0.2i
-\(bu
-EAP-SIM
-.TP 0.2i
-\(bu
-EAP-AKA
-.TP 0.2i
-\(bu
-EAP-PSK
-.TP 0.2i
-\(bu
-EAP-PAX
-.TP 0.2i
-\(bu
-LEAP (note: requires special support from
-the driver for IEEE 802.11 authentication)
-.TP 0.2i
-\(bu
-(following methods are supported, but since
-they do not generate keying material, they cannot be used
-with WPA or IEEE 802.1X WEP keying)
-.TP 0.2i
-\(bu
-EAP-MD5-Challenge
-.TP 0.2i
-\(bu
-EAP-MSCHAPv2
-.TP 0.2i
-\(bu
-EAP-GTC
-.TP 0.2i
-\(bu
-EAP-OTP
-.RE
-.TP 0.2i
-\(bu
-key management for CCMP, TKIP, WEP104, WEP40
-.TP 0.2i
-\(bu
-RSN/WPA2 (IEEE 802.11i)
-.RS
-.TP 0.2i
-\(bu
-pre-authentication
-.TP 0.2i
-\(bu
-PMKSA caching
-.RE
-.SH "AVAILABLE DRIVERS"
-.PP
-A summary of available driver backends is below. Support for each
-of the driver backends is chosen at wpa_supplicant compile time. For a
-list of supported driver backends that may be used with the -D option on
-your system, refer to the help output of wpa_supplicant
-(\fBwpa_supplicant -h\fR).
-.TP
-\fBwext\fR
-Linux wireless extensions (generic).
-.TP
-\fBwired\fR
-wpa_supplicant wired Ethernet driver
-.TP
-\fBroboswitch\fR
-wpa_supplicant Broadcom switch driver
-.TP
-\fBbsd\fR
-BSD 802.11 support (Atheros, etc.).
-.TP
-\fBndis\fR
-Windows NDIS driver.
-.SH "COMMAND LINE OPTIONS"
-.PP
-Most command line options have global scope. Some are given per
-interface, and are only valid if at least one \fB-i\fR option
-is specified, otherwise they're ignored. Option groups for different
-interfaces must be separated by \fB-N\fR option.
-.TP
-\fB-b br_ifname\fR
-Optional bridge interface name. (Per interface)
-.TP
-\fB-B\fR
-Run daemon in the background.
-.TP
-\fB-c filename\fR
-Path to configuration file. (Per interface)
-.TP
-\fB-C ctrl_interface\fR
-Path to ctrl_interface socket (Per interface. Only used if
-\fB-c\fR is not).
-.TP
-\fB-i ifname\fR
-Interface to listen on. Multiple instances of this option can
-be present, one per interface, separated by \fB-N\fR
-option (see below).
-.TP
-\fB-d\fR
-Increase debugging verbosity (\fB-dd\fR even
-more).
-.TP
-\fB-D driver\fR
-Driver to use (can be multiple drivers: nl80211,wext).
-(Per interface, see the available options below.)
-.TP
-\fB-f output file\fR
-Log output to specified file instead of stdout.
-.TP
-\fB-g global ctrl_interface\fR
-Path to global ctrl_interface socket. If specified, interface
-definitions may be omitted.
-.TP
-\fB-K\fR
-Include keys (passwords, etc.) in debug output.
-.TP
-\fB-t\fR
-Include timestamp in debug messages.
-.TP
-\fB-h\fR
-Help. Show a usage message.
-.TP
-\fB-L\fR
-Show license (BSD).
-.TP
-\fB-p\fR
-Driver parameters. (Per interface)
-.TP
-\fB-P PID_file\fR
-Path to PID file.
-.TP
-\fB-q\fR
-Decrease debugging verbosity (\fB-qq\fR even
-less).
-.TP
-\fB-u\fR
-Enabled DBus control interface. If enabled, interface
-definitions may be omitted.
-.TP
-\fB-v\fR
-Show version.
-.TP
-\fB-W\fR
-Wait for a control interface monitor before starting.
-.TP
-\fB-N\fR
-Start describing new interface.
-.SH "EXAMPLES"
-.PP
-In most common cases, \fBwpa_supplicant\fR is
-started with:
-.sp
-.RS
-
-.nf
-wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
-.fi
-.RE
-.PP
-This makes the process fork into background.
-.PP
-The easiest way to debug problems, and to get debug log for
-bug reports, is to start \fBwpa_supplicant\fR on
-foreground with debugging enabled:
-.sp
-.RS
-
-.nf
-wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
-.fi
-.RE
-.PP
-If the specific driver wrapper is not known beforehand, it is
-possible to specify multiple comma separated driver wrappers on the command
-line. \fBwpa_supplicant\fR will use the first driver
-wrapper that is able to initialize the interface.
-.sp
-.RS
-
-.nf
-wpa_supplicant -Dnl80211,wext -c/etc/wpa_supplicant.conf -iwlan0
-.fi
-.RE
-.PP
-\fBwpa_supplicant\fR can control multiple
-interfaces (radios) either by running one process for each
-interface separately or by running just one process and list of
-options at command line. Each interface is separated with -N
-argument. As an example, following command would start
-wpa_supplicant for two interfaces:
-.sp
-.RS
-
-.nf
-wpa_supplicant \\
- -c wpa1.conf -i wlan0 -D nl80211 -N \\
- -c wpa2.conf -i ath0 -D wext
-.fi
-.RE
-.SH "OS REQUIREMENTS"
-.PP
-Current hardware/software requirements:
-.TP 0.2i
-\(bu
-Linux kernel 2.4.x or 2.6.x with Linux Wireless
-Extensions v15 or newer
-.TP 0.2i
-\(bu
-FreeBSD 6-CURRENT
-.TP 0.2i
-\(bu
-Microsoft Windows with WinPcap (at least WinXP, may work
-with other versions)
-.SH "SUPPORTED DRIVERS"
-.TP
-\fBLinux wireless extensions\fR
-In theory, any driver that supports Linux wireless
-extensions can be used with IEEE 802.1X (i.e., not WPA) when
-using ap_scan=0 option in configuration file.
-.TP
-\fBWired Ethernet drivers\fR
-Use ap_scan=0.
-.TP
-\fBBSD net80211 layer (e.g., Atheros driver)\fR
-At the moment, this is for FreeBSD 6-CURRENT branch.
-.TP
-\fBWindows NDIS\fR
-The current Windows port requires WinPcap
-(http://winpcap.polito.it/). See README-Windows.txt for more
-information.
-.PP
-wpa_supplicant was designed to be portable for different
-drivers and operating systems. Hopefully, support for more wlan
-cards and OSes will be added in the future. See developer.txt for
-more information about the design of wpa_supplicant and porting to
-other drivers. One main goal is to add full WPA/WPA2 support to
-Linux wireless extensions to allow new drivers to be supported
-without having to implement new driver-specific interface code in
-wpa_supplicant.
-.SH "ARCHITECTURE"
-.PP
-The
-\fBwpa_supplicant\fR system consists of the following
-components:
-.TP
-\fB\fIwpa_supplicant.conf\fB \fR
-the configuration file describing all networks that the
-user wants the computer to connect to.
-.TP
-\fBwpa_supplicant\fR
-the program that directly interacts with the
-network interface.
-.TP
-\fBwpa_cli\fR
-the
-client program that provides a high-level interface to the
-functionality of the daemon.
-.TP
-\fBwpa_passphrase\fR
-a utility needed to construct
-\fIwpa_supplicant.conf\fR files that include
-encrypted passwords.
-.SH "QUICK START"
-.PP
-First, make a configuration file, e.g.
-\fI/etc/wpa_supplicant.conf\fR, that describes the networks
-you are interested in. See \fBwpa_supplicant.conf\fR(5)
-for details.
-.PP
-Once the configuration is ready, you can test whether the
-configuration works by running \fBwpa_supplicant\fR
-with following command to start it on foreground with debugging
-enabled:
-.sp
-.RS
-
-.nf
-wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
-
-.fi
-.RE
-.PP
-Assuming everything goes fine, you can start using following
-command to start \fBwpa_supplicant\fR on background
-without debugging:
-.sp
-.RS
-
-.nf
-wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
-
-.fi
-.RE
-.PP
-Please note that if you included more than one driver
-interface in the build time configuration (.config), you may need
-to specify which interface to use by including -D<driver
-name> option on the command line.
-.SH "INTERFACE TO PCMCIA-CS/CARDMRG"
-.PP
-For example, following small changes to pcmcia-cs scripts
-can be used to enable WPA support:
-.PP
-Add MODE="Managed" and WPA="y" to the network scheme in
-\fI/etc/pcmcia/wireless.opts\fR\&.
-.PP
-Add the following block to the end of \fBstart\fR
-action handler in \fI/etc/pcmcia/wireless\fR:
-.sp
-.RS
-
-.nf
-if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
- /usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf -i$DEVICE
-fi
-
-.fi
-.RE
-.PP
-Add the following block to the end of \fBstop\fR
-action handler (may need to be separated from other actions) in
-\fI/etc/pcmcia/wireless\fR:
-.sp
-.RS
-
-.nf
-if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
- killall wpa_supplicant
-fi
-
-.fi
-.RE
-.PP
-This will make \fBcardmgr\fR start
-\fBwpa_supplicant\fR when the card is plugged
-in.
-.SH "SEE ALSO"
-.PP
-\fBwpa_background\fR(8)
-\fBwpa_supplicant.conf\fR(5)
-\fBwpa_cli\fR(8)
-\fBwpa_passphrase\fR(8)
-.SH "LEGAL"
-.PP
-wpa_supplicant is copyright (c) 2003-2012,
-Jouni Malinen <j@w1.fi> and
-contributors.
-All Rights Reserved.
-.PP
-This program is licensed under the BSD license (the one with
-advertisement clause removed).
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5
deleted file mode 100644
index 6f57aa0..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5
+++ /dev/null
@@ -1,225 +0,0 @@
-.\" This manpage has been automatically generated by docbook2man
-.\" from a DocBook document. This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
-.\" Please send any bug reports, improvements, comments, patches,
-.\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "WPA_SUPPLICANT.CONF" "5" "12 January 2013" "" ""
-
-.SH NAME
-wpa_supplicant.conf \- configuration file for wpa_supplicant
-.SH "OVERVIEW"
-.PP
-\fBwpa_supplicant\fR is configured using a text
-file that lists all accepted networks and security policies,
-including pre-shared keys. See the example configuration file,
-probably in \fB/usr/share/doc/wpa_supplicant/\fR, for
-detailed information about the configuration format and supported
-fields.
-.PP
-All file paths in this configuration file should use full
-(absolute, not relative to working directory) path in order to allow
-working directory to be changed. This can happen if wpa_supplicant is
-run in the background.
-.PP
-Changes to configuration file can be reloaded be sending
-SIGHUP signal to \fBwpa_supplicant\fR ('killall -HUP
-wpa_supplicant'). Similarly, reloading can be triggered with
-the \fBwpa_cli reconfigure\fR command.
-.PP
-Configuration file can include one or more network blocks,
-e.g., one for each used SSID. wpa_supplicant will automatically
-select the best network based on the order of network blocks in
-the configuration file, network security level (WPA/WPA2 is
-preferred), and signal strength.
-.SH "QUICK EXAMPLES"
-.TP 3
-1.
-WPA-Personal (PSK) as home network and WPA-Enterprise with
-EAP-TLS as work network.
-.sp
-.RS
-
-.nf
-# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-#
-# home network; allow all valid ciphers
-network={
- ssid="home"
- scan_ssid=1
- key_mgmt=WPA-PSK
- psk="very secret passphrase"
-}
-#
-# work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
-network={
- ssid="work"
- scan_ssid=1
- key_mgmt=WPA-EAP
- pairwise=CCMP TKIP
- group=CCMP TKIP
- eap=TLS
- identity="user@example.com"
- ca_cert="/etc/cert/ca.pem"
- client_cert="/etc/cert/user.pem"
- private_key="/etc/cert/user.prv"
- private_key_passwd="password"
-}
-.fi
-.RE
-.TP 3
-2.
-WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that
-use old peaplabel (e.g., Funk Odyssey and SBR, Meetinghouse
-Aegis, Interlink RAD-Series)
-.sp
-.RS
-
-.nf
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="example"
- scan_ssid=1
- key_mgmt=WPA-EAP
- eap=PEAP
- identity="user@example.com"
- password="foobar"
- ca_cert="/etc/cert/ca.pem"
- phase1="peaplabel=0"
- phase2="auth=MSCHAPV2"
-}
-.fi
-.RE
-.TP 3
-3.
-EAP-TTLS/EAP-MD5-Challenge configuration with anonymous
-identity for the unencrypted use. Real identity is sent only
-within an encrypted TLS tunnel.
-.sp
-.RS
-
-.nf
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="example"
- scan_ssid=1
- key_mgmt=WPA-EAP
- eap=TTLS
- identity="user@example.com"
- anonymous_identity="anonymous@example.com"
- password="foobar"
- ca_cert="/etc/cert/ca.pem"
- phase2="auth=MD5"
-}
-.fi
-.RE
-.TP 3
-4.
-IEEE 802.1X (i.e., no WPA) with dynamic WEP keys
-(require both unicast and broadcast); use EAP-TLS for
-authentication
-.sp
-.RS
-
-.nf
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="1x-test"
- scan_ssid=1
- key_mgmt=IEEE8021X
- eap=TLS
- identity="user@example.com"
- ca_cert="/etc/cert/ca.pem"
- client_cert="/etc/cert/user.pem"
- private_key="/etc/cert/user.prv"
- private_key_passwd="password"
- eapol_flags=3
-}
-.fi
-.RE
-.TP 3
-5.
-Catch all example that allows more or less all
-configuration modes. The configuration options are used based
-on what security policy is used in the selected SSID. This is
-mostly for testing and is not recommended for normal
-use.
-.sp
-.RS
-
-.nf
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="example"
- scan_ssid=1
- key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
- pairwise=CCMP TKIP
- group=CCMP TKIP WEP104 WEP40
- psk="very secret passphrase"
- eap=TTLS PEAP TLS
- identity="user@example.com"
- password="foobar"
- ca_cert="/etc/cert/ca.pem"
- client_cert="/etc/cert/user.pem"
- private_key="/etc/cert/user.prv"
- private_key_passwd="password"
- phase1="peaplabel=0"
- ca_cert2="/etc/cert/ca2.pem"
- client_cert2="/etc/cer/user.pem"
- private_key2="/etc/cer/user.prv"
- private_key2_passwd="password"
-}
-.fi
-.RE
-.TP 3
-6.
-Authentication for wired Ethernet. This can be used with
-\fBwired\fR or \fBroboswitch\fR interface
-(-Dwired or -Droboswitch on command line).
-.sp
-.RS
-
-.nf
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-ap_scan=0
-network={
- key_mgmt=IEEE8021X
- eap=MD5
- identity="user"
- password="password"
- eapol_flags=0
-}
-.fi
-.RE
-.SH "CERTIFICATES"
-.PP
-Some EAP authentication methods require use of
-certificates. EAP-TLS uses both server side and client
-certificates whereas EAP-PEAP and EAP-TTLS only require the server
-side certificate. When client certificate is used, a matching
-private key file has to also be included in configuration. If the
-private key uses a passphrase, this has to be configured in
-wpa_supplicant.conf ("private_key_passwd").
-.PP
-wpa_supplicant supports X.509 certificates in PEM and DER
-formats. User certificate and private key can be included in the
-same file.
-.PP
-If the user certificate and private key is received in
-PKCS#12/PFX format, they need to be converted to suitable PEM/DER
-format for wpa_supplicant. This can be done, e.g., with following
-commands:
-.sp
-.RS
-
-.nf
-# convert client certificate and private key to PEM format
-openssl pkcs12 -in example.pfx -out user.pem -clcerts
-# convert CA certificate (if included in PFX file) to PEM format
-openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
-.fi
-.RE
-.SH "SEE ALSO"
-.PP
-\fBwpa_supplicant\fR(8)
-\fBopenssl\fR(1)
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml
deleted file mode 100644
index 462039d..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.conf.sgml
+++ /dev/null
@@ -1,239 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-<refentry>
- <refmeta>
- <refentrytitle>wpa_supplicant.conf</refentrytitle>
- <manvolnum>5</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>wpa_supplicant.conf</refname>
- <refpurpose>configuration file for wpa_supplicant</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Overview</title>
-
- <para><command>wpa_supplicant</command> is configured using a text
- file that lists all accepted networks and security policies,
- including pre-shared keys. See the example configuration file,
- probably in <command>/usr/share/doc/wpa_supplicant/</command>, for
- detailed information about the configuration format and supported
- fields.</para>
-
- <para>All file paths in this configuration file should use full
- (absolute, not relative to working directory) path in order to allow
- working directory to be changed. This can happen if wpa_supplicant is
- run in the background.</para>
-
- <para>Changes to configuration file can be reloaded be sending
- SIGHUP signal to <command>wpa_supplicant</command> ('killall -HUP
- wpa_supplicant'). Similarly, reloading can be triggered with
- the <emphasis>wpa_cli reconfigure</emphasis> command.</para>
-
- <para>Configuration file can include one or more network blocks,
- e.g., one for each used SSID. wpa_supplicant will automatically
- select the best network based on the order of network blocks in
- the configuration file, network security level (WPA/WPA2 is
- preferred), and signal strength.</para>
- </refsect1>
-
- <refsect1>
- <title>Quick Examples</title>
-
- <orderedlist>
- <listitem>
-
- <para>WPA-Personal (PSK) as home network and WPA-Enterprise with
- EAP-TLS as work network.</para>
-
-<blockquote><programlisting>
-# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-#
-# home network; allow all valid ciphers
-network={
- ssid="home"
- scan_ssid=1
- key_mgmt=WPA-PSK
- psk="very secret passphrase"
-}
-#
-# work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
-network={
- ssid="work"
- scan_ssid=1
- key_mgmt=WPA-EAP
- pairwise=CCMP TKIP
- group=CCMP TKIP
- eap=TLS
- identity="user@example.com"
- ca_cert="/etc/cert/ca.pem"
- client_cert="/etc/cert/user.pem"
- private_key="/etc/cert/user.prv"
- private_key_passwd="password"
-}
-</programlisting></blockquote>
- </listitem>
-
- <listitem>
- <para>WPA-RADIUS/EAP-PEAP/MSCHAPv2 with RADIUS servers that
- use old peaplabel (e.g., Funk Odyssey and SBR, Meetinghouse
- Aegis, Interlink RAD-Series)</para>
-
-<blockquote><programlisting>
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="example"
- scan_ssid=1
- key_mgmt=WPA-EAP
- eap=PEAP
- identity="user@example.com"
- password="foobar"
- ca_cert="/etc/cert/ca.pem"
- phase1="peaplabel=0"
- phase2="auth=MSCHAPV2"
-}
-</programlisting></blockquote>
- </listitem>
-
- <listitem>
- <para>EAP-TTLS/EAP-MD5-Challenge configuration with anonymous
- identity for the unencrypted use. Real identity is sent only
- within an encrypted TLS tunnel.</para>
-
-
-<blockquote><programlisting>
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="example"
- scan_ssid=1
- key_mgmt=WPA-EAP
- eap=TTLS
- identity="user@example.com"
- anonymous_identity="anonymous@example.com"
- password="foobar"
- ca_cert="/etc/cert/ca.pem"
- phase2="auth=MD5"
-}
-</programlisting></blockquote>
-
- </listitem>
-
- <listitem>
- <para>IEEE 802.1X (i.e., no WPA) with dynamic WEP keys
- (require both unicast and broadcast); use EAP-TLS for
- authentication</para>
-
-<blockquote><programlisting>
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="1x-test"
- scan_ssid=1
- key_mgmt=IEEE8021X
- eap=TLS
- identity="user@example.com"
- ca_cert="/etc/cert/ca.pem"
- client_cert="/etc/cert/user.pem"
- private_key="/etc/cert/user.prv"
- private_key_passwd="password"
- eapol_flags=3
-}
-</programlisting></blockquote>
- </listitem>
-
-
- <listitem>
- <para>Catch all example that allows more or less all
- configuration modes. The configuration options are used based
- on what security policy is used in the selected SSID. This is
- mostly for testing and is not recommended for normal
- use.</para>
-
-<blockquote><programlisting>
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-network={
- ssid="example"
- scan_ssid=1
- key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
- pairwise=CCMP TKIP
- group=CCMP TKIP WEP104 WEP40
- psk="very secret passphrase"
- eap=TTLS PEAP TLS
- identity="user@example.com"
- password="foobar"
- ca_cert="/etc/cert/ca.pem"
- client_cert="/etc/cert/user.pem"
- private_key="/etc/cert/user.prv"
- private_key_passwd="password"
- phase1="peaplabel=0"
- ca_cert2="/etc/cert/ca2.pem"
- client_cert2="/etc/cer/user.pem"
- private_key2="/etc/cer/user.prv"
- private_key2_passwd="password"
-}
-</programlisting></blockquote>
- </listitem>
-
- <listitem>
- <para>Authentication for wired Ethernet. This can be used with
- <emphasis>wired</emphasis> or <emphasis>roboswitch</emphasis> interface
- (-Dwired or -Droboswitch on command line).</para>
-
-<blockquote><programlisting>
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
-ap_scan=0
-network={
- key_mgmt=IEEE8021X
- eap=MD5
- identity="user"
- password="password"
- eapol_flags=0
-}
-</programlisting></blockquote>
- </listitem>
- </orderedlist>
-
-
-
-
-
- </refsect1>
- <refsect1>
- <title>Certificates</title>
-
- <para>Some EAP authentication methods require use of
- certificates. EAP-TLS uses both server side and client
- certificates whereas EAP-PEAP and EAP-TTLS only require the server
- side certificate. When client certificate is used, a matching
- private key file has to also be included in configuration. If the
- private key uses a passphrase, this has to be configured in
- wpa_supplicant.conf ("private_key_passwd").</para>
-
- <para>wpa_supplicant supports X.509 certificates in PEM and DER
- formats. User certificate and private key can be included in the
- same file.</para>
-
- <para>If the user certificate and private key is received in
- PKCS#12/PFX format, they need to be converted to suitable PEM/DER
- format for wpa_supplicant. This can be done, e.g., with following
- commands:</para>
-<blockquote><programlisting>
-# convert client certificate and private key to PEM format
-openssl pkcs12 -in example.pfx -out user.pem -clcerts
-# convert CA certificate (if included in PFX file) to PEM format
-openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys
-</programlisting></blockquote>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry>
- <refentrytitle>wpa_supplicant</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>openssl</refentrytitle>
- <manvolnum>1</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
-</refentry>
diff --git a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.sgml b/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
deleted file mode 100644
index aa20e57..0000000
--- a/contrib/wpa/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
+++ /dev/null
@@ -1,690 +0,0 @@
-<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<refentry>
- <refmeta>
- <refentrytitle>wpa_supplicant</refentrytitle>
- <manvolnum>8</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>wpa_supplicant</refname>
- <refpurpose>Wi-Fi Protected Access client and IEEE 802.1X supplicant</refpurpose>
- </refnamediv>
- <refsynopsisdiv>
- <cmdsynopsis>
- <command>wpa_supplicant</command>
- <arg>-BddfhKLqqtuvW</arg>
- <arg>-i<replaceable>ifname</replaceable></arg>
- <arg>-c<replaceable>config file</replaceable></arg>
- <arg>-D<replaceable>driver</replaceable></arg>
- <arg>-P<replaceable>PID_file</replaceable></arg>
- <arg>-f<replaceable>output file</replaceable></arg>
- </cmdsynopsis>
- </refsynopsisdiv>
- <refsect1>
- <title>Overview</title>
-
- <para>
- Wireless networks do not require physical access to the network equipment
- in the same way as wired networks. This makes it easier for unauthorized
- users to passively monitor a network and capture all transmitted frames.
- In addition, unauthorized use of the network is much easier. In many cases,
- this can happen even without user's explicit knowledge since the wireless
- LAN adapter may have been configured to automatically join any available
- network.
- </para>
-
- <para>
- Link-layer encryption can be used to provide a layer of security for
- wireless networks. The original wireless LAN standard, IEEE 802.11,
- included a simple encryption mechanism, WEP. However, that proved to
- be flawed in many areas and network protected with WEP cannot be consider
- secure. IEEE 802.1X authentication and frequently changed dynamic WEP keys
- can be used to improve the network security, but even that has inherited
- security issues due to the use of WEP for encryption. Wi-Fi Protected
- Access and IEEE 802.11i amendment to the wireless LAN standard introduce
- a much improvement mechanism for securing wireless networks. IEEE 802.11i
- enabled networks that are using CCMP (encryption mechanism based on strong
- cryptographic algorithm AES) can finally be called secure used for
- applications which require efficient protection against unauthorized
- access.
- </para>
-
- <para><command>wpa_supplicant</command> is an implementation of
- the WPA Supplicant component, i.e., the part that runs in the
- client stations. It implements WPA key negotiation with a WPA
- Authenticator and EAP authentication with Authentication
- Server. In addition, it controls the roaming and IEEE 802.11
- authentication/association of the wireless LAN driver.</para>
-
- <para><command>wpa_supplicant</command> is designed to be a
- "daemon" program that runs in the background and acts as the
- backend component controlling the wireless
- connection. <command>wpa_supplicant</command> supports separate
- frontend programs and an example text-based frontend,
- <command>wpa_cli</command>, is included with
- wpa_supplicant.</para>
-
- <para>Before wpa_supplicant can do its work, the network interface
- must be available. That means that the physical device must be
- present and enabled, and the driver for the device must be
- loaded. The daemon will exit immediately if the device is not already
- available.</para>
-
- <para>After <command>wpa_supplicant</command> has configured the
- network device, higher level configuration such as DHCP may
- proceed. There are a variety of ways to integrate wpa_supplicant
- into a machine's networking scripts, a few of which are described
- in sections below.</para>
-
- <para>The following steps are used when associating with an AP
- using WPA:</para>
-
- <itemizedlist>
- <listitem>
- <para><command>wpa_supplicant</command> requests the kernel
- driver to scan neighboring BSSes</para>
- </listitem>
-
- <listitem>
- <para><command>wpa_supplicant</command> selects a BSS based on
- its configuration</para>
- </listitem>
-
- <listitem>
- <para><command>wpa_supplicant</command> requests the kernel
- driver to associate with the chosen BSS</para>
- </listitem>
-
- <listitem>
- <para>If WPA-EAP: integrated IEEE 802.1X Supplicant
- completes EAP authentication with the
- authentication server (proxied by the Authenticator in the
- AP)</para>
- </listitem>
-
- <listitem>
- <para>If WPA-EAP: master key is received from the IEEE 802.1X
- Supplicant</para>
- </listitem>
-
- <listitem>
- <para>If WPA-PSK: <command>wpa_supplicant</command> uses PSK
- as the master session key</para>
- </listitem>
-
- <listitem>
- <para><command>wpa_supplicant</command> completes WPA 4-Way
- Handshake and Group Key Handshake with the Authenticator
- (AP)</para>
- </listitem>
-
- <listitem>
- <para><command>wpa_supplicant</command> configures encryption
- keys for unicast and broadcast</para>
- </listitem>
-
- <listitem>
- <para>normal data packets can be transmitted and received</para>
- </listitem>
- </itemizedlist>
- </refsect1>
-
- <refsect1>
- <title>Supported Features</title>
- <para>Supported WPA/IEEE 802.11i features:</para>
- <itemizedlist>
- <listitem>
- <para>WPA-PSK ("WPA-Personal")</para>
- </listitem>
-
- <listitem>
- <para>WPA with EAP (e.g., with RADIUS authentication server)
- ("WPA-Enterprise") Following authentication methods are
- supported with an integrate IEEE 802.1X Supplicant:</para>
-
- <itemizedlist>
- <listitem>
- <para>EAP-TLS</para>
- </listitem>
- </itemizedlist>
-
- <itemizedlist>
- <listitem>
- <para>EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1)</para>
- </listitem>
-
-
- <listitem>
- <para>EAP-PEAP/TLS (both PEAPv0 and PEAPv1)</para>
- </listitem>
-
- <listitem>
- <para>EAP-PEAP/GTC (both PEAPv0 and PEAPv1)</para>
- </listitem>
-
- <listitem>
- <para>EAP-PEAP/OTP (both PEAPv0 and PEAPv1)</para>
- </listitem>
-
- <listitem>
- <para>EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1)</para>
- </listitem>
-
- <listitem>
- <para>EAP-TTLS/EAP-MD5-Challenge</para>
- </listitem>
-
- <listitem>
- <para>EAP-TTLS/EAP-GTC</para>
- </listitem>
-
- <listitem><para>EAP-TTLS/EAP-OTP</para></listitem>
-
- <listitem><para>EAP-TTLS/EAP-MSCHAPv2</para></listitem>
-
- <listitem><para>EAP-TTLS/EAP-TLS</para></listitem>
-
- <listitem><para>EAP-TTLS/MSCHAPv2</para></listitem>
-
- <listitem><para>EAP-TTLS/MSCHAP</para></listitem>
-
- <listitem><para>EAP-TTLS/PAP</para></listitem>
-
- <listitem><para>EAP-TTLS/CHAP</para></listitem>
-
- <listitem><para>EAP-SIM</para></listitem>
-
- <listitem><para>EAP-AKA</para></listitem>
-
- <listitem><para>EAP-PSK</para></listitem>
-
- <listitem><para>EAP-PAX</para></listitem>
-
- <listitem><para>LEAP (note: requires special support from
- the driver for IEEE 802.11 authentication)</para></listitem>
-
- <listitem><para>(following methods are supported, but since
- they do not generate keying material, they cannot be used
- with WPA or IEEE 802.1X WEP keying)</para></listitem>
-
- <listitem><para>EAP-MD5-Challenge </para></listitem>
-
- <listitem><para>EAP-MSCHAPv2</para></listitem>
-
- <listitem><para>EAP-GTC</para></listitem>
-
- <listitem><para>EAP-OTP</para></listitem>
- </itemizedlist>
- </listitem>
-
- <listitem>
- <para>key management for CCMP, TKIP, WEP104, WEP40</para>
- </listitem>
-
- <listitem>
- <para>RSN/WPA2 (IEEE 802.11i)</para>
- <itemizedlist>
- <listitem>
- <para>pre-authentication</para>
- </listitem>
-
- <listitem>
- <para>PMKSA caching</para>
- </listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </refsect1>
-
- <refsect1>
- <title>Available Drivers</title>
- <para>A summary of available driver backends is below. Support for each
- of the driver backends is chosen at wpa_supplicant compile time. For a
- list of supported driver backends that may be used with the -D option on
- your system, refer to the help output of wpa_supplicant
- (<emphasis>wpa_supplicant -h</emphasis>).</para>
-
- <variablelist>
- <varlistentry>
- <term>wext</term>
- <listitem>
- <para>Linux wireless extensions (generic).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>wired</term>
- <listitem>
- <para>wpa_supplicant wired Ethernet driver</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>roboswitch</term>
- <listitem>
- <para>wpa_supplicant Broadcom switch driver</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>bsd</term>
- <listitem>
- <para>BSD 802.11 support (Atheros, etc.).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>ndis</term>
- <listitem>
- <para>Windows NDIS driver.</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
-
- <refsect1>
- <title>Command Line Options</title>
- <para>Most command line options have global scope. Some are given per
- interface, and are only valid if at least one <option>-i</option> option
- is specified, otherwise they're ignored. Option groups for different
- interfaces must be separated by <option>-N</option> option.</para>
- <variablelist>
- <varlistentry>
- <term>-b br_ifname</term>
- <listitem>
- <para>Optional bridge interface name. (Per interface)</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-B</term>
- <listitem>
- <para>Run daemon in the background.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-c filename</term>
- <listitem>
- <para>Path to configuration file. (Per interface)</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-C ctrl_interface</term>
- <listitem>
- <para>Path to ctrl_interface socket (Per interface. Only used if
- <option>-c</option> is not).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-i ifname</term>
- <listitem>
- <para>Interface to listen on. Multiple instances of this option can
- be present, one per interface, separated by <option>-N</option>
- option (see below).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-d</term>
- <listitem>
- <para>Increase debugging verbosity (<option>-dd</option> even
- more).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-D driver</term>
- <listitem>
- <para>Driver to use (can be multiple drivers: nl80211,wext).
- (Per interface, see the available options below.)</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-f output file</term>
- <listitem>
- <para>Log output to specified file instead of stdout.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-g global ctrl_interface</term>
- <listitem>
- <para>Path to global ctrl_interface socket. If specified, interface
- definitions may be omitted.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-K</term>
- <listitem>
- <para>Include keys (passwords, etc.) in debug output.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-t</term>
- <listitem>
- <para>Include timestamp in debug messages.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-h</term>
- <listitem>
- <para>Help. Show a usage message.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-L</term>
- <listitem>
- <para>Show license (BSD).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-p</term>
- <listitem>
- <para>Driver parameters. (Per interface)</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-P PID_file</term>
- <listitem>
- <para>Path to PID file.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-q</term>
- <listitem>
- <para>Decrease debugging verbosity (<option>-qq</option> even
- less).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-u</term>
- <listitem>
- <para>Enabled DBus control interface. If enabled, interface
- definitions may be omitted.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-v</term>
- <listitem>
- <para>Show version.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-W</term>
- <listitem>
- <para>Wait for a control interface monitor before starting.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>-N</term>
- <listitem>
- <para>Start describing new interface.</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
-
- <refsect1>
- <title>Examples</title>
-
- <para>In most common cases, <command>wpa_supplicant</command> is
- started with:</para>
-
-<blockquote><programlisting>
-wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
-</programlisting></blockquote>
-
- <para>This makes the process fork into background.</para>
-
- <para>The easiest way to debug problems, and to get debug log for
- bug reports, is to start <command>wpa_supplicant</command> on
- foreground with debugging enabled:</para>
-
-<blockquote><programlisting>
-wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
-</programlisting></blockquote>
-
- <para>If the specific driver wrapper is not known beforehand, it is
- possible to specify multiple comma separated driver wrappers on the command
- line. <command>wpa_supplicant</command> will use the first driver
- wrapper that is able to initialize the interface.</para>
-
-<blockquote><programlisting>
-wpa_supplicant -Dnl80211,wext -c/etc/wpa_supplicant.conf -iwlan0
-</programlisting></blockquote>
-
- <para><command>wpa_supplicant</command> can control multiple
- interfaces (radios) either by running one process for each
- interface separately or by running just one process and list of
- options at command line. Each interface is separated with -N
- argument. As an example, following command would start
- wpa_supplicant for two interfaces:</para>
-
-<blockquote><programlisting>
-wpa_supplicant \
- -c wpa1.conf -i wlan0 -D nl80211 -N \
- -c wpa2.conf -i ath0 -D wext
-</programlisting></blockquote>
- </refsect1>
-
- <refsect1>
- <title>OS Requirements</title>
- <para>Current hardware/software requirements:</para>
-
- <itemizedlist>
- <listitem>
- <para>Linux kernel 2.4.x or 2.6.x with Linux Wireless
- Extensions v15 or newer</para>
- </listitem>
-
-
- <listitem>
- <para>FreeBSD 6-CURRENT</para>
- </listitem>
-
- <listitem>
- <para>Microsoft Windows with WinPcap (at least WinXP, may work
- with other versions)</para>
- </listitem>
- </itemizedlist>
- </refsect1>
-
- <refsect1>
- <title>Supported Drivers</title>
- <variablelist>
- <varlistentry>
- <term>Linux wireless extensions</term>
- <listitem>
- <para>In theory, any driver that supports Linux wireless
- extensions can be used with IEEE 802.1X (i.e., not WPA) when
- using ap_scan=0 option in configuration file.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>Wired Ethernet drivers</term>
- <listitem>
- <para>Use ap_scan=0.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>BSD net80211 layer (e.g., Atheros driver)</term>
- <listitem>
- <para>At the moment, this is for FreeBSD 6-CURRENT branch.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>Windows NDIS</term>
- <listitem>
- <para>The current Windows port requires WinPcap
- (http://winpcap.polito.it/). See README-Windows.txt for more
- information.</para>
- </listitem>
- </varlistentry>
- </variablelist>
-
-
- <para>wpa_supplicant was designed to be portable for different
- drivers and operating systems. Hopefully, support for more wlan
- cards and OSes will be added in the future. See developer.txt for
- more information about the design of wpa_supplicant and porting to
- other drivers. One main goal is to add full WPA/WPA2 support to
- Linux wireless extensions to allow new drivers to be supported
- without having to implement new driver-specific interface code in
- wpa_supplicant.</para>
- </refsect1>
-
- <refsect1>
- <title>Architecture</title> <para>The
- <command>wpa_supplicant</command> system consists of the following
- components:</para>
-
- <variablelist>
- <varlistentry>
- <term><filename>wpa_supplicant.conf</filename> </term>
- <listitem>
- <para>the configuration file describing all networks that the
- user wants the computer to connect to. </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><command>wpa_supplicant</command></term>
- <listitem><para>the program that directly interacts with the
- network interface. </para></listitem>
- </varlistentry>
- <varlistentry>
- <term><command>wpa_cli</command></term> <listitem><para> the
- client program that provides a high-level interface to the
- functionality of the daemon. </para></listitem>
- </varlistentry>
- <varlistentry>
- <term><command>wpa_passphrase</command></term>
- <listitem><para>a utility needed to construct
- <filename>wpa_supplicant.conf</filename> files that include
- encrypted passwords.</para></listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
-
- <refsect1>
- <title>Quick Start</title>
-
- <para>First, make a configuration file, e.g.
- <filename>/etc/wpa_supplicant.conf</filename>, that describes the networks
- you are interested in. See <citerefentry>
- <refentrytitle>wpa_supplicant.conf</refentrytitle>
- <manvolnum>5</manvolnum>
- </citerefentry>
- for details.</para>
-
- <para>Once the configuration is ready, you can test whether the
- configuration works by running <command>wpa_supplicant</command>
- with following command to start it on foreground with debugging
- enabled:</para>
-
- <blockquote><programlisting>
-wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
- </programlisting></blockquote>
-
- <para>Assuming everything goes fine, you can start using following
- command to start <command>wpa_supplicant</command> on background
- without debugging:</para>
-
- <blockquote><programlisting>
-wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
- </programlisting></blockquote>
-
- <para>Please note that if you included more than one driver
- interface in the build time configuration (.config), you may need
- to specify which interface to use by including -D&lt;driver
- name&gt; option on the command line.</para>
-
- <!-- XXX at this point, the page could include a little script
- based on wpa_cli to wait for a connection and then run
- dhclient -->
-
- </refsect1>
-
- <refsect1>
- <title>Interface to pcmcia-cs/cardmrg</title>
-
- <para>For example, following small changes to pcmcia-cs scripts
- can be used to enable WPA support:</para>
-
- <para>Add MODE="Managed" and WPA="y" to the network scheme in
- <filename>/etc/pcmcia/wireless.opts</filename>.</para>
-
- <para>Add the following block to the end of <emphasis>start</emphasis>
- action handler in <filename>/etc/pcmcia/wireless</filename>:</para>
-
- <blockquote><programlisting>
-if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
- /usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf -i$DEVICE
-fi
- </programlisting></blockquote>
-
-
- <para>Add the following block to the end of <emphasis>stop</emphasis>
- action handler (may need to be separated from other actions) in
- <filename>/etc/pcmcia/wireless</filename>:</para>
-
- <blockquote><programlisting>
-if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
- killall wpa_supplicant
-fi
- </programlisting></blockquote>
-
- <para>This will make <command>cardmgr</command> start
- <command>wpa_supplicant</command> when the card is plugged
- in.</para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry>
- <refentrytitle>wpa_background</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>wpa_supplicant.conf</refentrytitle>
- <manvolnum>5</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>wpa_cli</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- <citerefentry>
- <refentrytitle>wpa_passphrase</refentrytitle>
- <manvolnum>8</manvolnum>
- </citerefentry>
- </para>
- </refsect1>
- <refsect1>
- <title>Legal</title>
- <para>wpa_supplicant is copyright (c) 2003-2012,
- Jouni Malinen <email>j@w1.fi</email> and
- contributors.
- All Rights Reserved.</para>
-
- <para>This program is licensed under the BSD license (the one with
- advertisement clause removed).</para>
- </refsect1>
-</refentry>
OpenPOWER on IntegriCloud