wifi: cfg80211: introduce cfg80211_ssid_eq()
authorDmitry Antipov <dmantipov@yandex.ru>
Fri, 15 Dec 2023 12:38:51 +0000 (15:38 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 19 Dec 2023 16:32:24 +0000 (17:32 +0100)
Since SSIDs comparison is commonly used across many drivers, introduce
generic 'cfg80211_ssid_eq()' to replace driver-private implementations.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://msgid.link/20231215123859.196350-1-dmantipov@yandex.ru
[fix kernel-doc return docs]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h

index ac1fb326dcdae635343a7a7fd445abf9f6494b49..033a0a25397fd67fd6e3191668b2ad3c97165efb 100644 (file)
@@ -7165,6 +7165,23 @@ enum cfg80211_bss_frame_type {
 int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
                                    enum nl80211_band band);
 
+/**
+ * cfg80211_ssid_eq - compare two SSIDs
+ * @a: first SSID
+ * @b: second SSID
+ *
+ * Return: %true if SSIDs are equal, %false otherwise.
+ */
+static inline bool
+cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b)
+{
+       if (WARN_ON(!a || !b))
+               return false;
+       if (a->ssid_len != b->ssid_len)
+               return false;
+       return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true;
+}
+
 /**
  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
  *