From 88909947e2e2376bf58cc2d9327a06dc65521ab5 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 16 Oct 2016 19:41:27 +0200 Subject: [PATCH] build: Remove support for usage of kdbus --- Makefile.am | 2 +- README | 28 --------------------------- client/main.c | 18 +----------------- src/dbus.c | 30 ++--------------------------- src/dbus.h | 2 +- src/kdbus.c | 52 --------------------------------------------------- src/kdbus.h | 23 ----------------------- src/main.c | 12 +++--------- 8 files changed, 8 insertions(+), 159 deletions(-) delete mode 100644 src/kdbus.c delete mode 100644 src/kdbus.h diff --git a/Makefile.am b/Makefile.am index de7087df..87b8c7c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -83,7 +83,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h \ src/iwd.h src_iwd_LDADD = ell/libell-internal.la -ldl -client_iwctl_SOURCES = client/main.c src/kdbus.h src/kdbus.c +client_iwctl_SOURCES = client/main.c client_iwctl_LDADD = ell/libell-internal.la monitor_iwmon_SOURCES = monitor/main.c linux/nl80211.h \ diff --git a/README b/README index 3affb350..cea7a460 100644 --- a/README +++ b/README @@ -48,34 +48,6 @@ will happen when building the Wireless daemon and it will then be linked internally. -Kernel dependencies -=================== - -In order to use this daemon and control utility the kdbus kernel module -is required. The development repositories can be found here: - - https://github.com/gregkh/kdbus - https://code.google.com/p/d-bus/ - -The daemon will start its own private bus that is located at the /dev/kdbus -device hierarchy: - - /dev/kdbus - |--- control - `--- 0-iwd - `--- bus - -When started as root, the new private bus will be /dev/kdbus/0-iwd/bus -and it can be verified with the busctl utility from systemd: - - # busctl --address=kernel:path=/dev/kdbus/0-iwd/bus - NAME PID PROCESS USER CONNECTION CONNECTION-NAME - :1.1 62151 iwd root :1.1 iwd - :1.2 62153 busctl root :1.2 sd-busctl - -Clients talking to the daemon must specifiy the private bus address. - - Netlink monitoring ================== diff --git a/client/main.c b/client/main.c index d263d1e7..b94ba08c 100644 --- a/client/main.c +++ b/client/main.c @@ -28,8 +28,6 @@ #include #include -#include "src/kdbus.h" - static void signal_handler(struct l_signal *signal, uint32_t signo, void *user_data) { @@ -63,8 +61,6 @@ static void signal_message(struct l_dbus_message *message, void *user_data) int main(int argc, char *argv[]) { - char *bus_name; - char bus_address[64]; int exit_status; struct l_dbus *dbus; struct l_signal *signal; @@ -82,19 +78,7 @@ int main(int argc, char *argv[]) l_log_set_stderr(); l_debug_enable("*"); - bus_name = kdbus_lookup_bus(); - if (!bus_name) { - exit_status = EXIT_FAILURE; - goto done; - } - - l_debug("Bus location: %s", bus_name); - - snprintf(bus_address, sizeof(bus_address), "kernel:path=%s", bus_name); - - l_free(bus_name); - - dbus = l_dbus_new(bus_address); + dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS); if (!dbus) { exit_status = EXIT_FAILURE; goto done; diff --git a/src/dbus.c b/src/dbus.c index 5cb41deb..cc56680d 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -33,7 +33,6 @@ #include "src/agent.h" struct l_dbus *g_dbus = 0; -static int kdbus_fd = -1; static void do_debug(const char *str, void *user_data) { @@ -199,31 +198,9 @@ struct l_dbus *dbus_get_bus(void) return g_dbus; } -bool dbus_init(bool enable_debug, bool use_kdbus) +bool dbus_init(bool enable_debug) { - if (!use_kdbus) - g_dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS); - else { - char bus_name[32], bus_address[64]; - - snprintf(bus_name, sizeof(bus_name), "%u-iwd", getuid()); - - kdbus_fd = _dbus_kernel_create_bus(bus_name); - if (kdbus_fd < 0) - return false; - - snprintf(bus_address, sizeof(bus_address), - "kernel:path=/dev/kdbus/%s/bus", bus_name); - - l_debug("Bus location: %s", bus_address); - - g_dbus = l_dbus_new(bus_address); - - if (!g_dbus) { - close(kdbus_fd); - return false; - } - } + g_dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS); if (enable_debug) l_dbus_set_debug(g_dbus, do_debug, "[DBUS] ", NULL); @@ -241,9 +218,6 @@ bool dbus_exit(void) l_dbus_destroy(g_dbus); g_dbus = NULL; - if (kdbus_fd >= 0) - close(kdbus_fd); - return true; } diff --git a/src/dbus.h b/src/dbus.h index 77a9f91f..3b1e40c8 100644 --- a/src/dbus.h +++ b/src/dbus.h @@ -64,6 +64,6 @@ struct l_dbus_message *dbus_error_no_agent(struct l_dbus_message *msg); struct l_dbus_message *dbus_error_not_connected(struct l_dbus_message *msg); struct l_dbus_message *dbus_error_not_implemented(struct l_dbus_message *msg); -bool dbus_init(bool enable_debug, bool use_kdbus); +bool dbus_init(bool enable_debug); bool dbus_exit(void); void dbus_shutdown(void); diff --git a/src/kdbus.c b/src/kdbus.c deleted file mode 100644 index ea1468d2..00000000 --- a/src/kdbus.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Wireless daemon for Linux - * - * Copyright (C) 2013-2014 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 - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "src/kdbus.h" - -char *kdbus_lookup_bus(void) -{ - glob_t gl; - char *path = NULL; - - if (glob("/dev/kdbus/*-iwd/bus", GLOB_ONLYDIR, NULL, &gl)) { - l_error("Failed to lookup bus directory"); - return NULL; - } - - if (gl.gl_pathc < 1) { - l_error("Failed to lookup bus endpoint"); - return NULL; - } - - path = l_strdup(gl.gl_pathv[0]); - - globfree(&gl); - - return path; -} diff --git a/src/kdbus.h b/src/kdbus.h deleted file mode 100644 index aefdbd8a..00000000 --- a/src/kdbus.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * - * Wireless daemon for Linux - * - * Copyright (C) 2013-2014 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 - * - */ - -char *kdbus_lookup_bus(void); diff --git a/src/main.c b/src/main.c index 4aa868ba..f40321eb 100644 --- a/src/main.c +++ b/src/main.c @@ -76,15 +76,13 @@ static void usage(void) "Usage:\n"); printf("\tiwd [options]\n"); printf("Options:\n" - "\t-B, --dbus-debug Enable DBus debugging\n" - "\t-K, --kdbus Setup Kernel D-Bus\n" + "\t-B, --dbus-debug Enable D-Bus debugging\n" "\t-i, --interfaces Interfaces to manage\n" "\t-I, --nointerfaces Interfaces to ignore\n" "\t-h, --help Show help options\n"); } static const struct option main_options[] = { - { "kdbus", no_argument, NULL, 'K' }, { "dbus-debug", no_argument, NULL, 'B' }, { "version", no_argument, NULL, 'v' }, { "interfaces", required_argument, NULL, 'i' }, @@ -131,7 +129,6 @@ static void nl80211_vanished(void *user_data) int main(int argc, char *argv[]) { - bool enable_kdbus = false; bool enable_dbus_debug = false; struct l_signal *signal; sigset_t mask; @@ -142,14 +139,11 @@ int main(int argc, char *argv[]) for (;;) { int opt; - opt = getopt_long(argc, argv, "KBi:I:vh", main_options, NULL); + opt = getopt_long(argc, argv, "Bi:I:vh", main_options, NULL); if (opt < 0) break; switch (opt) { - case 'K': - enable_kdbus = true; - break; case 'B': enable_dbus_debug = true; break; @@ -193,7 +187,7 @@ int main(int argc, char *argv[]) l_info("Wireless daemon version %s", VERSION); - if (!dbus_init(enable_dbus_debug, enable_kdbus)) { + if (!dbus_init(enable_dbus_debug)) { exit_status = EXIT_FAILURE; goto done; }