]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Print driver name in debug output
authorJouni Malinen <j@w1.fi>
Sun, 14 Jan 2024 15:32:22 +0000 (17:32 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 14 Jan 2024 15:32:22 +0000 (17:32 +0200)
This can be helpful in debugging some driver specific issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/drivers/driver_nl80211.c

index a3147bc7c4d2e66431adcb0fc2eb81dd6c7702c1..758d597221712cdebcb74b4f98438dcd4059ce9c 100644 (file)
@@ -2288,6 +2288,26 @@ static void * wpa_driver_nl80211_drv_init(void *ctx, const char *ifname,
        struct wpa_driver_nl80211_data *drv;
        struct i802_bss *bss;
        unsigned int i;
+       char path[128], buf[200], *pos;
+       ssize_t len;
+       int ret;
+
+       ret = os_snprintf(path, sizeof(path), "/sys/class/net/%s/device/driver",
+                         ifname);
+       if (!os_snprintf_error(sizeof(path), ret)) {
+               len = readlink(path, buf, sizeof(buf));
+               if (len > 0 && (size_t) len < sizeof(buf)) {
+                       buf[len] = '\0';
+                       pos = strrchr(buf, '/');
+                       if (pos)
+                               pos++;
+                       else
+                               pos = buf;
+                       wpa_printf(MSG_DEBUG,
+                                  "nl80211: Initialize interface %s (driver: %s)",
+                                  ifname, pos);
+               }
+       }
 
        if (global_priv == NULL)
                return NULL;