diff --git a/src/adhoc.c b/src/adhoc.c index 8c61f81e..8a995481 100644 --- a/src/adhoc.c +++ b/src/adhoc.c @@ -24,6 +24,9 @@ #include #endif +#include +#include + #include #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");