mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 03:32:42 +01:00
build: Remove support for usage of kdbus
This commit is contained in:
parent
cc2052d33e
commit
88909947e2
@ -83,7 +83,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h \
|
|||||||
src/iwd.h
|
src/iwd.h
|
||||||
src_iwd_LDADD = ell/libell-internal.la -ldl
|
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
|
client_iwctl_LDADD = ell/libell-internal.la
|
||||||
|
|
||||||
monitor_iwmon_SOURCES = monitor/main.c linux/nl80211.h \
|
monitor_iwmon_SOURCES = monitor/main.c linux/nl80211.h \
|
||||||
|
28
README
28
README
@ -48,34 +48,6 @@ will happen when building the Wireless daemon and it will then be linked
|
|||||||
internally.
|
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
|
Netlink monitoring
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ell/ell.h>
|
#include <ell/ell.h>
|
||||||
|
|
||||||
#include "src/kdbus.h"
|
|
||||||
|
|
||||||
static void signal_handler(struct l_signal *signal, uint32_t signo,
|
static void signal_handler(struct l_signal *signal, uint32_t signo,
|
||||||
void *user_data)
|
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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *bus_name;
|
|
||||||
char bus_address[64];
|
|
||||||
int exit_status;
|
int exit_status;
|
||||||
struct l_dbus *dbus;
|
struct l_dbus *dbus;
|
||||||
struct l_signal *signal;
|
struct l_signal *signal;
|
||||||
@ -82,19 +78,7 @@ int main(int argc, char *argv[])
|
|||||||
l_log_set_stderr();
|
l_log_set_stderr();
|
||||||
l_debug_enable("*");
|
l_debug_enable("*");
|
||||||
|
|
||||||
bus_name = kdbus_lookup_bus();
|
dbus = l_dbus_new_default(L_DBUS_SYSTEM_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);
|
|
||||||
if (!dbus) {
|
if (!dbus) {
|
||||||
exit_status = EXIT_FAILURE;
|
exit_status = EXIT_FAILURE;
|
||||||
goto done;
|
goto done;
|
||||||
|
28
src/dbus.c
28
src/dbus.c
@ -33,7 +33,6 @@
|
|||||||
#include "src/agent.h"
|
#include "src/agent.h"
|
||||||
|
|
||||||
struct l_dbus *g_dbus = 0;
|
struct l_dbus *g_dbus = 0;
|
||||||
static int kdbus_fd = -1;
|
|
||||||
|
|
||||||
static void do_debug(const char *str, void *user_data)
|
static void do_debug(const char *str, void *user_data)
|
||||||
{
|
{
|
||||||
@ -199,31 +198,9 @@ struct l_dbus *dbus_get_bus(void)
|
|||||||
return g_dbus;
|
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);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enable_debug)
|
if (enable_debug)
|
||||||
l_dbus_set_debug(g_dbus, do_debug, "[DBUS] ", NULL);
|
l_dbus_set_debug(g_dbus, do_debug, "[DBUS] ", NULL);
|
||||||
@ -241,9 +218,6 @@ bool dbus_exit(void)
|
|||||||
l_dbus_destroy(g_dbus);
|
l_dbus_destroy(g_dbus);
|
||||||
g_dbus = NULL;
|
g_dbus = NULL;
|
||||||
|
|
||||||
if (kdbus_fd >= 0)
|
|
||||||
close(kdbus_fd);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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_connected(struct l_dbus_message *msg);
|
||||||
struct l_dbus_message *dbus_error_not_implemented(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);
|
bool dbus_exit(void);
|
||||||
void dbus_shutdown(void);
|
void dbus_shutdown(void);
|
||||||
|
52
src/kdbus.c
52
src/kdbus.c
@ -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 <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glob.h>
|
|
||||||
#include <ell/ell.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
23
src/kdbus.h
23
src/kdbus.h
@ -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);
|
|
12
src/main.c
12
src/main.c
@ -76,15 +76,13 @@ static void usage(void)
|
|||||||
"Usage:\n");
|
"Usage:\n");
|
||||||
printf("\tiwd [options]\n");
|
printf("\tiwd [options]\n");
|
||||||
printf("Options:\n"
|
printf("Options:\n"
|
||||||
"\t-B, --dbus-debug Enable DBus debugging\n"
|
"\t-B, --dbus-debug Enable D-Bus debugging\n"
|
||||||
"\t-K, --kdbus Setup Kernel D-Bus\n"
|
|
||||||
"\t-i, --interfaces Interfaces to manage\n"
|
"\t-i, --interfaces Interfaces to manage\n"
|
||||||
"\t-I, --nointerfaces Interfaces to ignore\n"
|
"\t-I, --nointerfaces Interfaces to ignore\n"
|
||||||
"\t-h, --help Show help options\n");
|
"\t-h, --help Show help options\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct option main_options[] = {
|
static const struct option main_options[] = {
|
||||||
{ "kdbus", no_argument, NULL, 'K' },
|
|
||||||
{ "dbus-debug", no_argument, NULL, 'B' },
|
{ "dbus-debug", no_argument, NULL, 'B' },
|
||||||
{ "version", no_argument, NULL, 'v' },
|
{ "version", no_argument, NULL, 'v' },
|
||||||
{ "interfaces", required_argument, NULL, 'i' },
|
{ "interfaces", required_argument, NULL, 'i' },
|
||||||
@ -131,7 +129,6 @@ static void nl80211_vanished(void *user_data)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
bool enable_kdbus = false;
|
|
||||||
bool enable_dbus_debug = false;
|
bool enable_dbus_debug = false;
|
||||||
struct l_signal *signal;
|
struct l_signal *signal;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
@ -142,14 +139,11 @@ int main(int argc, char *argv[])
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
int opt;
|
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)
|
if (opt < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'K':
|
|
||||||
enable_kdbus = true;
|
|
||||||
break;
|
|
||||||
case 'B':
|
case 'B':
|
||||||
enable_dbus_debug = true;
|
enable_dbus_debug = true;
|
||||||
break;
|
break;
|
||||||
@ -193,7 +187,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
l_info("Wireless daemon version %s", VERSION);
|
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;
|
exit_status = EXIT_FAILURE;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user