commit c37146d403f435a0167a26e57d98d283b68ef84f
parent 17bfbbd39740b6b53cc91bb7234d5128981e0045
Author: Denis Kenzior <denkenz@gmail.com>
Date: Tue, 17 Jul 2018 19:19:09 -0500
wsc: Rework wsc_init & wsc_exit
- wsc module does not need nl80211 any longer, so remove it.
- Move wsc_init & wsc_exit declarations to iwd.h and remove wsc.h
- re-arrange how wsc_init & wsc_exit is called inside main.c.
Diffstat:
6 files changed, 11 insertions(+), 42 deletions(-)
diff --git 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
@@ -25,6 +25,7 @@
#endif
#include <stddef.h>
+#include <stdbool.h>
#include <string.h>
#include "src/iwd.h"
diff --git 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
@@ -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
@@ -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
@@ -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 <stdbool.h>
-#include <stddef.h>
-
-bool wsc_init(struct l_genl_family *in);
-bool wsc_exit();