mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
adhoc: Set linkmode & operstate for open networks
For PSK networks we have netdev.c taking care of setting the linkmode & operstate. For open adhoc networks, netdev.c was never involved which resulted in linkmode & operstate never being set. Fix this by invoking the necessary magic when a connection is established.
This commit is contained in:
parent
6c95933663
commit
848897ec17
22
src/adhoc.c
22
src/adhoc.c
@ -24,6 +24,9 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/if.h>
|
||||
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "linux/nl80211.h"
|
||||
@ -160,6 +163,17 @@ static bool ap_sta_match_addr(const void *a, const void *b)
|
||||
return !memcmp(sta->addr, b, 6);
|
||||
}
|
||||
|
||||
static void adhoc_operstate_cb(int error, uint16_t type,
|
||||
const void *data,
|
||||
uint32_t len, void *user_data)
|
||||
{
|
||||
if (!error)
|
||||
return;
|
||||
|
||||
l_debug("netdev: %u, error: %s", L_PTR_TO_UINT(user_data),
|
||||
strerror(-error));
|
||||
}
|
||||
|
||||
static void adhoc_handshake_event(struct handshake_state *hs,
|
||||
enum handshake_event event, void *user_data, ...)
|
||||
{
|
||||
@ -397,7 +411,15 @@ static void adhoc_new_station(struct adhoc_state *adhoc, const uint8_t *mac)
|
||||
|
||||
/* with open networks nothing else is required */
|
||||
if (sta->adhoc->open) {
|
||||
int ifindex = netdev_get_ifindex(adhoc->netdev);
|
||||
|
||||
sta->authenticated = true;
|
||||
|
||||
l_rtnl_set_linkmode_and_operstate(iwd_get_rtnl(), ifindex,
|
||||
IF_LINK_MODE_DORMANT, IF_OPER_UP,
|
||||
adhoc_operstate_cb,
|
||||
L_UINT_TO_PTR(ifindex), NULL);
|
||||
|
||||
l_dbus_property_changed(dbus_get_bus(),
|
||||
netdev_get_path(adhoc->netdev),
|
||||
IWD_ADHOC_INTERFACE, "ConnectedPeers");
|
||||
|
Loading…
Reference in New Issue
Block a user