]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_cli: Do not pick p2p-dev-* interfaces by default
authorJouni Malinen <jouni@codeaurora.org>
Mon, 9 Sep 2019 13:28:17 +0000 (16:28 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 9 Sep 2019 13:37:46 +0000 (16:37 +0300)
These are the driver-specific interface for the non-netdev P2P Device
interface and not something that useful for most use cases. Skip them to
allow the main netdev (e.g., wlan0 over p2p-dev-wlan0) to be selected.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/wpa_cli.c

index 004b84d83df496a0f07fad8c6509bda158dbba36..fa24121ca64b908f41c07e2d43015e46039ea984 100644 (file)
@@ -4606,8 +4606,11 @@ static char * wpa_cli_get_default_ifname(void)
                if (dent->d_type != DT_SOCK && dent->d_type != DT_UNKNOWN)
                        continue;
 #endif /* _DIRENT_HAVE_D_TYPE */
+               /* Skip current/previous directory and special P2P Device
+                * interfaces. */
                if (os_strcmp(dent->d_name, ".") == 0 ||
-                   os_strcmp(dent->d_name, "..") == 0)
+                   os_strcmp(dent->d_name, "..") == 0 ||
+                   os_strncmp(dent->d_name, "p2p-dev-", 8) == 0)
                        continue;
                printf("Selected interface '%s'\n", dent->d_name);
                ifname = os_strdup(dent->d_name);