mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-02 09:22:32 +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))
|
if (!wiphy_init(nl80211))
|
||||||
l_error("Unable to init wiphy functionality");
|
l_error("Unable to init wiphy functionality");
|
||||||
|
|
||||||
|
if (!netdev_init(nl80211))
|
||||||
|
l_error("Unable to init netdev functionality");
|
||||||
|
|
||||||
if (!scan_init(nl80211))
|
if (!scan_init(nl80211))
|
||||||
l_error("Unable to init scan functionality");
|
l_error("Unable to init scan functionality");
|
||||||
|
|
||||||
@ -113,6 +116,7 @@ static void nl80211_vanished(void *user_data)
|
|||||||
|
|
||||||
wsc_exit();
|
wsc_exit();
|
||||||
scan_exit();
|
scan_exit();
|
||||||
|
netdev_exit();
|
||||||
wiphy_exit();
|
wiphy_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,11 +195,6 @@ int main(int argc, char *argv[])
|
|||||||
goto fail_device;
|
goto fail_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!netdev_init()) {
|
|
||||||
exit_status = EXIT_FAILURE;
|
|
||||||
goto fail_netdev;
|
|
||||||
}
|
|
||||||
|
|
||||||
l_debug("Opening nl80211 interface");
|
l_debug("Opening nl80211 interface");
|
||||||
|
|
||||||
nl80211 = l_genl_family_new(genl, NL80211_GENL_NAME);
|
nl80211 = l_genl_family_new(genl, NL80211_GENL_NAME);
|
||||||
@ -220,9 +219,6 @@ int main(int argc, char *argv[])
|
|||||||
l_genl_family_unref(nl80211);
|
l_genl_family_unref(nl80211);
|
||||||
|
|
||||||
fail_nl80211:
|
fail_nl80211:
|
||||||
netdev_exit();
|
|
||||||
|
|
||||||
fail_netdev:
|
|
||||||
device_exit();
|
device_exit();
|
||||||
|
|
||||||
fail_device:
|
fail_device:
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "src/netdev.h"
|
#include "src/netdev.h"
|
||||||
|
|
||||||
static struct l_netlink *rtnl = NULL;
|
static struct l_netlink *rtnl = NULL;
|
||||||
|
static struct l_genl_family *nl80211;
|
||||||
|
|
||||||
static void do_debug(const char *str, void *user_data)
|
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);
|
l_free(rtmmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool netdev_init(void)
|
bool netdev_init(struct l_genl_family *in)
|
||||||
{
|
{
|
||||||
if (rtnl)
|
if (rtnl)
|
||||||
return false;
|
return false;
|
||||||
@ -124,6 +125,8 @@ bool netdev_init(void)
|
|||||||
if (getenv("IWD_RTNL_DEBUG"))
|
if (getenv("IWD_RTNL_DEBUG"))
|
||||||
l_netlink_set_debug(rtnl, do_debug, "[RTNL] ", NULL);
|
l_netlink_set_debug(rtnl, do_debug, "[RTNL] ", NULL);
|
||||||
|
|
||||||
|
nl80211 = in;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +135,8 @@ bool netdev_exit(void)
|
|||||||
if (!rtnl)
|
if (!rtnl)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
nl80211 = NULL;
|
||||||
|
|
||||||
l_debug("Closing route netlink socket");
|
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,
|
uint8_t linkmode, uint8_t operstate,
|
||||||
netdev_command_func_t cb, void *user_data);
|
netdev_command_func_t cb, void *user_data);
|
||||||
|
|
||||||
bool netdev_init(void);
|
bool netdev_init(struct l_genl_family *in);
|
||||||
bool netdev_exit(void);
|
bool netdev_exit(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user