diff --git a/Makefile.am b/Makefile.am index 584f636a..8d0e11ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -88,7 +88,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h \ src/storage.h src/storage.c \ src/network.h src/network.c \ src/wscutil.h src/wscutil.c \ - src/wsc.h src/wsc.c \ + src/wsc.c \ src/eap-wsc.h src/eap-wsc.c \ src/eap.h src/eap.c src/eap-private.h \ src/eap-md5.c \ diff --git a/src/common.c b/src/common.c index 2b16e408..55ebd4d2 100644 --- a/src/common.c +++ b/src/common.c @@ -25,6 +25,7 @@ #endif #include +#include #include #include "src/iwd.h" diff --git a/src/iwd.h b/src/iwd.h index 7537482f..8fc7f781 100644 --- a/src/iwd.h +++ b/src/iwd.h @@ -37,3 +37,6 @@ void network_exit(); void sim_auth_init(void); void sim_auth_exit(void); + +bool wsc_init(void); +bool wsc_exit(); diff --git a/src/main.c b/src/main.c index 4d9a20de..d599e830 100644 --- a/src/main.c +++ b/src/main.c @@ -41,7 +41,6 @@ #include "src/eap.h" #include "src/eapol.h" #include "src/scan.h" -#include "src/wsc.h" #include "src/knownnetworks.h" #include "src/rfkill.h" #include "src/ap.h" @@ -156,9 +155,6 @@ static void nl80211_appeared(void *user_data) if (!scan_init(nl80211)) l_error("Unable to init scan functionality"); - if (!wsc_init(nl80211)) - l_error("Unable to init WSC functionality"); - ap_init(nl80211); } @@ -444,6 +440,7 @@ int main(int argc, char *argv[]) __eapol_set_config(iwd_config); adhoc_init(); + wsc_init(); eap_init(eap_mtu); eapol_init(); network_init(); @@ -460,6 +457,7 @@ int main(int argc, char *argv[]) network_exit(); eapol_exit(); eap_exit(); + wsc_exit(); adhoc_exit(); l_genl_family_unref(nl80211); diff --git a/src/wsc.c b/src/wsc.c index dd2fe7d0..e387c1f0 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -36,7 +36,6 @@ #include "src/ie.h" #include "src/wscutil.h" #include "src/util.h" -#include "src/wsc.h" #include "src/handshake.h" #include "src/eap-wsc.h" #include "src/crypto.h" @@ -47,7 +46,6 @@ #define WALK_TIME 120 -static struct l_genl_family *nl80211 = NULL; static uint32_t device_watch = 0; struct wsc { @@ -1096,7 +1094,7 @@ static void device_event(struct device *device, enum device_event event, } } -bool wsc_init(struct l_genl_family *in) +bool wsc_init(void) { if (!l_dbus_register_interface(dbus_get_bus(), IWD_WSC_INTERFACE, setup_wsc_interface, @@ -1104,10 +1102,11 @@ bool wsc_init(struct l_genl_family *in) return false; device_watch = device_watch_add(device_event, NULL, NULL); - if (!device_watch) + if (!device_watch) { + l_dbus_unregister_interface(dbus_get_bus(), IWD_WSC_INTERFACE); return false; + } - nl80211 = in; return true; } @@ -1115,13 +1114,8 @@ bool wsc_exit() { l_debug(""); - if (!nl80211) - return false; - l_dbus_unregister_interface(dbus_get_bus(), IWD_WSC_INTERFACE); - device_watch_remove(device_watch); - nl80211 = 0; return true; } diff --git a/src/wsc.h b/src/wsc.h deleted file mode 100644 index 79f54297..00000000 --- a/src/wsc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * - * Wireless daemon for Linux - * - * Copyright (C) 2013-2015 Intel Corporation. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include -#include - -bool wsc_init(struct l_genl_family *in); -bool wsc_exit();