From 69f1c3321a10c972adfe132d07ee8fa09f33ed25 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Sun, 2 Sep 2018 22:15:41 -0500 Subject: [PATCH] station: Add station_find --- src/station.c | 15 +++++++++++++++ src/station.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/station.c b/src/station.c index 914f62da..d91318d2 100644 --- a/src/station.c +++ b/src/station.c @@ -496,6 +496,21 @@ not_supported: return NULL; } +struct station *station_find(uint32_t ifindex) +{ + const struct l_queue_entry *entry; + + for (entry = l_queue_get_entries(station_list); entry; + entry = entry->next) { + struct station *station = entry->data; + + if (netdev_get_ifindex(station->netdev) == ifindex) + return station; + } + + return NULL; +} + struct station *station_create(struct wiphy *wiphy, struct netdev *netdev) { struct station *station; diff --git a/src/station.h b/src/station.h index 65801e96..e27974b3 100644 --- a/src/station.h +++ b/src/station.h @@ -60,5 +60,6 @@ struct handshake_state *station_handshake_setup(struct station *station, struct network *network, struct scan_bss *bss); +struct station *station_find(uint32_t ifindex); struct station *station_create(struct wiphy *wiphy, struct netdev *netdev); void station_free(struct station *station);