On Thu, 2024-07-04 at 11:03 +0800, En-Wei Wu wrote: > > +#define VIRT_WIFI_SSID_LEN 8 > +#define VIRT_WIFI_SSID "VirtWifi" Use strlen(VIRT_WIFI_SSID) for VIRT_WIFI_SSID_LEN maybe? It should be constant "enough" for the compiler. > + if (!sme->ssid) { > + wiphy_err(wiphy, "invalid SSID\n"); > + return -EINVAL; I wouldn't print an error here > + ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN); The min_t() is unnecessary, cfg80211 won't give you too long SSIDs. > bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid); > + bool right_ssid = (priv->connect_requested_ssid_len == VIRT_WIFI_SSID_LEN ? > + !memcmp(priv->connect_requested_ssid, VIRT_WIFI_SSID, > + priv->connect_requested_ssid_len) : false); the ternary seems odd, why not just priv->connect_requested_ssid_len == VIRT_WIFI_SSID_LEN && !memcmp(...); ? johannes