]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
test: Use previously requested BSSID when adding a new interface
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 28 Dec 2009 11:38:18 +0000 (13:38 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 28 Dec 2009 11:38:18 +0000 (13:38 +0200)
src/drivers/driver_test.c

index 3bfa6d485fb001292f4a42c45d00148f668450df..bb1be4817f1d22c3bcbf653b5a9bde2fad79e371 100644 (file)
@@ -61,7 +61,8 @@ struct test_driver_bss {
 };
 
 struct wpa_driver_test_global {
-       int dummy;
+       int bss_add_used;
+       u8 req_addr[ETH_ALEN];
 };
 
 struct wpa_driver_test_data {
@@ -954,6 +955,8 @@ static int test_driver_bss_add(void *priv, const char *ifname, const u8 *bssid,
 
        bss->next = drv->bss;
        drv->bss = bss;
+       drv->global->bss_add_used = 1;
+       os_memcpy(drv->global->req_addr, bssid, ETH_ALEN);
 
        return 0;
 }
@@ -1906,6 +1909,7 @@ static void * wpa_driver_test_init2(void *ctx, const char *ifname,
                                    void *global_priv)
 {
        struct wpa_driver_test_data *drv;
+       struct wpa_driver_test_global *global = global_priv;
 
        drv = test_alloc_data(ctx, ifname);
        if (drv == NULL)
@@ -1923,6 +1927,11 @@ static void * wpa_driver_test_init2(void *ctx, const char *ifname,
        os_memcpy(drv->ssid, "test", 5);
        drv->ssid_len = 4;
 
+       if (global->bss_add_used) {
+               os_memcpy(drv->own_addr, global->req_addr, ETH_ALEN);
+               global->bss_add_used = 0;
+       }
+
        eloop_register_timeout(1, 0, wpa_driver_test_poll, drv, NULL);
 
        return drv;