eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 848897ec172f5617cbc8b261715e7556184042f2
parent 6c959336639e2f6464c4a489b1025d776de58baf
Author: Denis Kenzior <denkenz@gmail.com>
Date:   Wed,  8 Apr 2020 12:33:17 -0500

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.

Diffstat:
Msrc/adhoc.c | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/adhoc.c b/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");