mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-26 01:02:35 +01:00
netconfig: Change public API
As a first step to enable the usage of netconfig in ead and prospective transition to be a part of ell, the public API for creation and destruction of the netconfig objects has been renamed and changed. Instead of hiding the netconfig objects inside of netconfig module, the object is now passed back to the caller. The internal queue of netconfig objects remains untouched, due to limitations in ell’s implementation of rtnl. After the proper changes are done to ell, netconfig_list is expected to be removed from netconfig module.
This commit is contained in:
parent
c8dfb6061d
commit
d954eee0cc
@ -94,17 +94,6 @@ static void netconfig_free(void *data)
|
||||
l_free(netconfig);
|
||||
}
|
||||
|
||||
static bool netconfig_match(const void *a, const void *b)
|
||||
{
|
||||
const struct netconfig *netconfig = a;
|
||||
uint32_t ifindex = L_PTR_TO_UINT(b);
|
||||
|
||||
if (netconfig->ifindex == ifindex)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static struct netconfig *netconfig_find(uint32_t ifindex)
|
||||
{
|
||||
const struct l_queue_entry *entry;
|
||||
@ -696,23 +685,23 @@ static void netconfig_station_state_changed(enum station_state state,
|
||||
netconfig->station_state = state;
|
||||
}
|
||||
|
||||
bool netconfig_ifindex_add(uint32_t ifindex)
|
||||
struct netconfig *netconfig_new(uint32_t ifindex)
|
||||
{
|
||||
struct netconfig *netconfig;
|
||||
struct station *station;
|
||||
|
||||
if (!netconfig_list)
|
||||
return false;
|
||||
return NULL;
|
||||
|
||||
l_debug("Starting netconfig for interface: %d", ifindex);
|
||||
|
||||
netconfig = netconfig_find(ifindex);
|
||||
if (netconfig)
|
||||
return true;
|
||||
return netconfig;
|
||||
|
||||
station = station_find(ifindex);
|
||||
if (!station)
|
||||
return false;
|
||||
return NULL;
|
||||
|
||||
netconfig = l_new(struct netconfig, 1);
|
||||
netconfig->ifindex = ifindex;
|
||||
@ -725,22 +714,17 @@ bool netconfig_ifindex_add(uint32_t ifindex)
|
||||
|
||||
l_queue_push_tail(netconfig_list, netconfig);
|
||||
|
||||
return true;
|
||||
return netconfig;
|
||||
}
|
||||
|
||||
bool netconfig_ifindex_remove(uint32_t ifindex)
|
||||
void netconfig_destroy(struct netconfig *netconfig)
|
||||
{
|
||||
struct netconfig *netconfig;
|
||||
|
||||
if (!netconfig_list)
|
||||
return false;
|
||||
return;
|
||||
|
||||
l_debug();
|
||||
|
||||
netconfig = l_queue_remove_if(netconfig_list, netconfig_match,
|
||||
L_UINT_TO_PTR(ifindex));
|
||||
if (!netconfig)
|
||||
return false;
|
||||
l_queue_remove(netconfig_list, netconfig);
|
||||
|
||||
if (netconfig->station_state != STATION_STATE_DISCONNECTED) {
|
||||
netconfig_ipv4_select_and_uninstall(netconfig);
|
||||
@ -751,8 +735,6 @@ bool netconfig_ifindex_remove(uint32_t ifindex)
|
||||
}
|
||||
|
||||
netconfig_free(netconfig);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int netconfig_init(void)
|
||||
|
@ -20,5 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
bool netconfig_ifindex_add(uint32_t ifindex);
|
||||
bool netconfig_ifindex_remove(uint32_t ifindex);
|
||||
struct netconfig;
|
||||
|
||||
struct netconfig *netconfig_new(uint32_t ifindex);
|
||||
void netconfig_destroy(struct netconfig *netconfig);
|
||||
|
@ -88,6 +88,8 @@ struct station {
|
||||
|
||||
struct l_queue *anqp_pending;
|
||||
|
||||
struct netconfig *netconfig;
|
||||
|
||||
bool preparing_roam : 1;
|
||||
bool signal_low : 1;
|
||||
bool roam_no_orig_ap : 1;
|
||||
@ -3021,7 +3023,7 @@ static struct station *station_create(struct netdev *netdev)
|
||||
l_dbus_object_add_interface(dbus, netdev_get_path(netdev),
|
||||
IWD_STATION_INTERFACE, station);
|
||||
|
||||
netconfig_ifindex_add(netdev_get_ifindex(netdev));
|
||||
station->netconfig = netconfig_new(netdev_get_ifindex(netdev));
|
||||
|
||||
station->anqp_pending = l_queue_new();
|
||||
|
||||
@ -3038,7 +3040,8 @@ static void station_free(struct station *station)
|
||||
if (station->connected_bss)
|
||||
netdev_disconnect(station->netdev, NULL, NULL);
|
||||
|
||||
netconfig_ifindex_remove(netdev_get_ifindex(station->netdev));
|
||||
netconfig_destroy(station->netconfig);
|
||||
station->netconfig = NULL;
|
||||
|
||||
periodic_scan_stop(station);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user