mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-30 14:22:37 +01:00
netdev: Make netdev_init accept nl80211
This commit is contained in:
parent
411af28489
commit
280f2d40ad
12
src/main.c
12
src/main.c
@ -100,6 +100,9 @@ static void nl80211_appeared(void *user_data)
|
||||
if (!wiphy_init(nl80211))
|
||||
l_error("Unable to init wiphy functionality");
|
||||
|
||||
if (!netdev_init(nl80211))
|
||||
l_error("Unable to init netdev functionality");
|
||||
|
||||
if (!scan_init(nl80211))
|
||||
l_error("Unable to init scan functionality");
|
||||
|
||||
@ -113,6 +116,7 @@ static void nl80211_vanished(void *user_data)
|
||||
|
||||
wsc_exit();
|
||||
scan_exit();
|
||||
netdev_exit();
|
||||
wiphy_exit();
|
||||
}
|
||||
|
||||
@ -191,11 +195,6 @@ int main(int argc, char *argv[])
|
||||
goto fail_device;
|
||||
}
|
||||
|
||||
if (!netdev_init()) {
|
||||
exit_status = EXIT_FAILURE;
|
||||
goto fail_netdev;
|
||||
}
|
||||
|
||||
l_debug("Opening nl80211 interface");
|
||||
|
||||
nl80211 = l_genl_family_new(genl, NL80211_GENL_NAME);
|
||||
@ -220,9 +219,6 @@ int main(int argc, char *argv[])
|
||||
l_genl_family_unref(nl80211);
|
||||
|
||||
fail_nl80211:
|
||||
netdev_exit();
|
||||
|
||||
fail_netdev:
|
||||
device_exit();
|
||||
|
||||
fail_device:
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "src/netdev.h"
|
||||
|
||||
static struct l_netlink *rtnl = NULL;
|
||||
static struct l_genl_family *nl80211;
|
||||
|
||||
static void do_debug(const char *str, void *user_data)
|
||||
{
|
||||
@ -108,7 +109,7 @@ void netdev_set_linkmode_and_operstate(uint32_t ifindex,
|
||||
l_free(rtmmsg);
|
||||
}
|
||||
|
||||
bool netdev_init(void)
|
||||
bool netdev_init(struct l_genl_family *in)
|
||||
{
|
||||
if (rtnl)
|
||||
return false;
|
||||
@ -124,6 +125,8 @@ bool netdev_init(void)
|
||||
if (getenv("IWD_RTNL_DEBUG"))
|
||||
l_netlink_set_debug(rtnl, do_debug, "[RTNL] ", NULL);
|
||||
|
||||
nl80211 = in;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -132,6 +135,8 @@ bool netdev_exit(void)
|
||||
if (!rtnl)
|
||||
return false;
|
||||
|
||||
nl80211 = NULL;
|
||||
|
||||
l_debug("Closing route netlink socket");
|
||||
|
||||
/*
|
||||
|
@ -30,5 +30,5 @@ void netdev_set_linkmode_and_operstate(uint32_t ifindex,
|
||||
uint8_t linkmode, uint8_t operstate,
|
||||
netdev_command_func_t cb, void *user_data);
|
||||
|
||||
bool netdev_init(void);
|
||||
bool netdev_init(struct l_genl_family *in);
|
||||
bool netdev_exit(void);
|
||||
|
Loading…
Reference in New Issue
Block a user