]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Allow OSU SSID selection to be enforced for testing purposes
authorJouni Malinen <jouni@codeaurora.org>
Wed, 12 Sep 2018 01:00:27 +0000 (04:00 +0300)
committerJouni Malinen <jouni@codeaurora.org>
Wed, 12 Sep 2018 21:17:51 +0000 (00:17 +0300)
This allows hs20-osu-client to be requested to select a specific OSU
SSID with the new command line argument (-o<OSU_SSID>). This is useful
for testing single SSID transition mode cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hs20/client/osu_client.c
hs20/client/osu_client.h

index a17469954bd1a86ebcc6e02d87aa1e336722707e..76ef9c449ddbc6511f0aa1ad565e85743e949a71 100644 (file)
@@ -2146,6 +2146,22 @@ static int osu_connect(struct hs20_osu_client *ctx, const char *bssid,
        if (ssid2 && ssid2[0] == '\0')
                ssid2 = NULL;
 
+       if (ctx->osu_ssid) {
+               if (os_strcmp(ssid, ctx->osu_ssid) == 0) {
+                       wpa_printf(MSG_DEBUG,
+                                  "Enforced OSU SSID matches ANQP info");
+                       ssid2 = NULL;
+               } else if (ssid2 && os_strcmp(ssid2, ctx->osu_ssid) == 0) {
+                       wpa_printf(MSG_DEBUG,
+                                  "Enforced OSU SSID matches RSN[OSEN] info");
+                       ssid = ssid2;
+               } else {
+                       wpa_printf(MSG_INFO, "Enforced OSU SSID did not match");
+                       write_summary(ctx, "Enforced OSU SSID did not match");
+                       return -1;
+               }
+       }
+
        id = add_network(ifname);
        if (id < 0)
                return -1;
@@ -3153,7 +3169,7 @@ int main(int argc, char *argv[])
                return -1;
 
        for (;;) {
-               c = getopt(argc, argv, "df:hKNO:qr:s:S:tw:x:");
+               c = getopt(argc, argv, "df:hKNo:O:qr:s:S:tw:x:");
                if (c < 0)
                        break;
                switch (c) {
@@ -3170,6 +3186,9 @@ int main(int argc, char *argv[])
                case 'N':
                        no_prod_assoc = 1;
                        break;
+               case 'o':
+                       ctx.osu_ssid = optarg;
+                       break;
                case 'O':
                        friendly_name = optarg;
                        break;
index 9a7059edfddb314b80eb5c6df4edd521c1332ac7..5c8e6d00b6bb826af6116009852c03e51d60bbc5 100644 (file)
@@ -47,6 +47,7 @@ struct hs20_osu_client {
        int client_cert_present;
        char **server_dnsname;
        size_t server_dnsname_count;
+       const char *osu_ssid; /* Enforced OSU_SSID for testing purposes */
 #define WORKAROUND_OCSP_OPTIONAL 0x00000001
        unsigned long int workarounds;
 };