WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2016-Aug-30 23:39:24

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

802.11 Reference Design- making AP send multiple SSIDs

Hi,

I'd like for the AP to send multiple probe responses (and beacons) with different SSIDs, for the purpose of virtualisation (allowing different operators to run on the same network).

In "mpdu_rx_process" in wlan_mac_ap.c, under "case (MAC_FRAME_CTRL1_SUBTYPE_PROBE_REQ)", I temporarily converted active_bss_info.bssid and active_bss_info.ssid into the different values, then sent it off using enqueue_after_tail(MANAGEMENT_QID, curr_tx_queue_element) for each 'operator'.

It works for about 5 seconds, where the different SSIDs are displayed on my phone (STA), but then it disappears after that.

Is there any reason this happens? If this is not the way to do this, how should I be doing it?

Regards,
loho2027

Offline

 

#2 2016-Aug-31 19:55:20

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

Actually I think I figured out the reason. I needed to run curr_tx_queue_element = queue_checkout(); every time I want to transmit another SSID.

Regards,
loho2027

Offline

 

#3 2016-Sep-01 14:45:38

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: 802.11 Reference Design- making AP send multiple SSIDs

Modifying the AP to manage two networks is certainly feasible but will require extensive modifications to the source code in CPU High and CPU Low. You would need to modify every place the code uses the node's MAC address and BSSID. The code modification you describe above is a small part of this. Actually implementing a dual-BSS AP would require much more than just Probe Responses. For example, the node must acknowledge unicast packets addressed to either of its addresses. ACK creation is implemented in CPU Low. It would also need to track the BSS assignment of every client, so that packets addressed to that client include the correct BSSID in the MAC header.

Offline

 

#4 2016-Sep-01 20:55:38

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

Thanks for your reply.

Do you have any suggestions as to how I can send off multiple beacons (with different SSIDs)? It looks like the send_beacon is in CPU_LOW, and poll_tbtt runs it. Is that related to the ACK packets you were saying?

Regards,
loho2027

Offline

 

#5 2016-Sep-02 00:45:19

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

What I did to get multiple beacons was to add a new configure_bss (with new bssid and ssid) after I receive a IPC_MBOX_TX_BEACON_DONE message from CPU_LOW, that way it should alternate sending beacons of different SSIDs.

I don't have a way of testing if that works or not, but maybe it works.

I managed to connect to the Internet once or twice using a different SSID and BSSID, though for some reason it's a very slow connection. I haven't been able to get it working since. Not sure why it acts inconsistently.

Regards,
loho2027

Offline

 

#6 2016-Sep-02 10:29:08

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: 802.11 Reference Design- making AP send multiple SSIDs

Alternating beacons isn't the right approach. Beacons advertise their beacon periods and clients expect to receive beacons on precise boundaries defined by the MAC time (so doubling the beacon period to account for the "skip" over every other beacon interval wouldn't work). You'd have to send both beacons sequentially on every TBTT, which you can do by modifying the low-level code in the DCF that sends beacons.

The deeper issue, like murphpo said, is that there is a lot more to having an AP host multiple basic service sets than simply changing SSIDs/BSSIDs. Likewise, there is a lot more than sending two beacons every TBTT. I really suggest you take a look at every place in the code where "wlan_mac_addr", "bssid" and "ssid" and develop a deep understanding of how it all works. How should an AP handle hosting two independent sets of associations? How should it direct incoming Ethernet traffic (e.g. which BSS does do packets go to?)? The implementation details like sending multiple beacons will fall out naturally once you have architected the overall system you want to build.

Offline

 

#7 2016-Sep-06 01:52:16

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

I was able to send probe response, authentication response, but when I received the ASSOC request, for some reason my code does not send out the association response (I tracked the wireless packets received using Acrylic WiFi analyser).

Here is part of my code:

active_bss_info->bssid[0] = curr_entry->vap->bssid[0]; //virtual AP BSSID
active_bss_info->bssid[1] = curr_entry->vap->bssid[1];
active_bss_info->bssid[2] = curr_entry->vap->bssid[2];
active_bss_info->bssid[3] = curr_entry->vap->bssid[3];
active_bss_info->bssid[4] = curr_entry->vap->bssid[4];
active_bss_info->bssid[5] = curr_entry->vap->bssid[5];

int len = strnlen((char*)curr_entry->vap->ssid, SSID_LEN_MAX);
strncpy(active_bss_info->ssid, (char*)curr_entry->vap->ssid, len);

tx_length = wlan_create_association_response_frame((void*)(curr_tx_queue_buffer->frame), &tx_header_common, STATUS_SUCCESS, station_info->ID, active_bss_info);


I also noticed that the queue used is different from probe response and authentication response (instead of MANAGEMENT_QID, it uses STATION_ID_TO_QUEUE_ID(station_info->ID)). Could this be the reason why it doesn't send? I've made sure that station_info->ID = 1, meaning that the station exists.

Regards,
loho2027

Offline

 

#8 2016-Sep-06 07:58:35

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: 802.11 Reference Design- making AP send multiple SSIDs

It's possibly related to queues. The poll_tx_queues() function traverses the "members" list of the "active_bss_info" global and attempts to dequeue to each station. If "active_bss_info" doesn't have a station with AID 1, then any enqueued packets to AID 1 will remain there and will never be dequeued and transmitted.

What does "active_bss_info" even mean for your application given that you want to send association responses on behalf of more than one BSS? This relates to what we are saying before -- there is more to it than dealing with the handshake that advertises, authenticated, and associates to a new network. The assumption that "active_bss_info" points to the one and only BSS info the AP has to deal with is deep within the design.

Offline

 

#9 2016-Sep-06 23:29:00

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

I get a number of errors after running the board for about 5 minutes.

1) ERROR: Attempted to remove a NULL dl_entry
2) WARNING:  List not in sync:  Length = 4112 but only had 1 entries (the length increments by one with each error)
3) Error processing BD-queue pairs

For the first error ("ERROR: Attempted to remove a NULL dl_entry"), I've narrowed it down to the dl_entry_remove method of queue_checkout() in wlan_mac_queue.c

The second and the third errors come from wlan_process_all_eth_pkts() in wlan_mac_eth_util.c

I haven't modified any of these methods, so are they bugs? Or have I done something I shouldn't have in my modified code?

Regards,
loho2027

Offline

 

#10 2016-Sep-07 09:47:04

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: 802.11 Reference Design- making AP send multiple SSIDs

These errors are strong evidence that your code changes are either leaking or corrupting memory. If you add code that allocates memory but does not free it, eventually the heap will be exhausted and other code blocks that require allocations will fail. Alternatively your code may be writing memory blocks it does not own, possible if you treat some non-pointer variable as a pointer and overwrite memory at an arbitrary address. You need to carefully review your code changes and understand exactly how your code is using/modifying memory.

Offline

 

#11 2016-Sep-12 01:55:30

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

Where in the CPU_LOW code can I change the value of the beacon's advertised duration? As I understand it, in the send_beacon method in wlan_mac_dcf.c, there is a variable 'header->duration_id' which does this, however I found it to be zero. Does that mean the beacon advertises its duration as 0?

Also, I am at the stage where I can connect to the virtual BSSID occasionally. What could be the reason for this intermittent behaviour? I found that sometimes it doesn't send the Authentication Responses. My code for the authentication response part (from mpdu_rx_process) is below:

Code:

curr_tx_queue_element = queue_checkout();

if(curr_tx_queue_element != NULL){
curr_tx_queue_buffer = (tx_queue_buffer_t*)(curr_tx_queue_element->data);


tx_header_common.address_2[0] = curr_entry->vap->bssid[0];
tx_header_common.address_2[1] = curr_entry->vap->bssid[1];
tx_header_common.address_2[2] = curr_entry->vap->bssid[2];
tx_header_common.address_2[3] = curr_entry->vap->bssid[3];
tx_header_common.address_2[4] = curr_entry->vap->bssid[4];
tx_header_common.address_2[5] = curr_entry->vap->bssid[5];
// Setup the TX header
wlan_mac_high_setup_tx_header( &tx_header_common, rx_80211_header->address_2, curr_entry->vap->bssid );


// Fill in the data
tx_length = wlan_create_auth_frame((void*)(curr_tx_queue_buffer->frame), &tx_header_common, AUTH_ALGO_OPEN_SYSTEM, AUTH_SEQ_RESP, STATUS_SUCCESS);



// Setup the TX frame info
wlan_mac_high_setup_tx_frame_info ( &tx_header_common,
																		curr_tx_queue_element,
																		tx_length,
																		(TX_FRAME_INFO_FLAGS_FILL_DURATION | TX_FRAME_INFO_FLAGS_REQ_TO ),
																		MANAGEMENT_QID );

// Set the information in the TX queue buffer
curr_tx_queue_buffer->metadata.metadata_type = QUEUE_METADATA_TYPE_TX_PARAMS;
curr_tx_queue_buffer->metadata.metadata_ptr  = (u32)(&default_unicast_mgmt_tx_params);
curr_tx_queue_buffer->tx_frame_info.ID         = 0;

									
// Put the packet in the queue
enqueue_after_tail(MANAGEMENT_QID, curr_tx_queue_element);


}

// Finish the function
goto mpdu_rx_process_end;

The code looks similar to the one without virtualisation, so I'm not sure what could be wrong. Without virtualisation, it runs fine.

Regards,
loho2027

Offline

 

#12 2016-Sep-12 09:19:01

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: 802.11 Reference Design- making AP send multiple SSIDs

This is not something we can debug for you remotely. You've clearly made substantial changes to the AP code - you need to figure out a way to test your changes in isolation. I would strongly recommend removing commercial Wi-Fi clients from your tests until you're certain your custom code is behaving as expected.  Instead you could use a WARP node as a STA connected to the AP via cable + attenuators (always 30+dB attenuation for a cabled connection). This setup will eliminate any over-the-air uncertainties and provide full visibility of the nodes Tx/Rx activity (via the wlan_exp logs).

Offline

 

#13 2016-Sep-13 00:10:14

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

What's strange is that when I connect using the WARP board as STA, it connects fine (it says "Successfully joined").

When I connect using commercial devices like my phone, it doesn't work.

Regards,
loho2027

Offline

 

#14 2016-Sep-13 10:02:45

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: 802.11 Reference Design- making AP send multiple SSIDs

The "Successfully Joined" print doesn't mean much. It just means that the STA receives an association response and its ""active_bss_info" turned non-NULL. It doesn't mean that the link is actually working after the handshake. You will need to dig deeper to understand what parts of the association handshake occurred and whether these are consistent with your changes.

Offline

 

#15 2016-Sep-13 20:03:43

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

I noticed that when the WARP board acting as an STA connects to the AP, it detects its beacon interval. Is that beacon interval crucial to the connection?

The reason I ask is because I haven't figured out how to send the beacons properly yet, nor am I able to change the beacon interval value in CPU_LOW. Is it possible that the WARP board STA is more tolerant of a wrong beacon, whereas a commercial WiFi device is less tolerant?

I don't know how to download something from the WARP board STA to test whether the connection works after the handshake. From what I can see, however, the STA WARP board actually completes the handshake, while for commercial WiFi devices (my phone) it does not complete the handshake. I'm not sure how to account for this apparent inconsistency.

Regards,
loho2027

Offline

 

#16 2016-Sep-14 10:09:39

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: 802.11 Reference Design- making AP send multiple SSIDs

loho2027 wrote:

I noticed that when the WARP board acting as an STA connects to the AP, it detects its beacon interval. Is that beacon interval crucial to the connection?

The reason I ask is because I haven't figured out how to send the beacons properly yet, nor am I able to change the beacon interval value in CPU_LOW. Is it possible that the WARP board STA is more tolerant of a wrong beacon, whereas a commercial WiFi device is less tolerant?

That information is part of the payloads of beacons and probe responses. The STA is just displaying the information it learned from those receptions. Beacons aren't critical for a WARP STA to maintain connection to the WARP AP (at least if you don't consider TSF MAC time synchronization "critical"). However, beacons are very important for connections to
commercial Wi-Fi devices. Since beaconing is a mandatory part of the 802.11 standard, commercial Wi-Fi STA devices will often drop a BSS if they don't see any beacons from it.

loho2027 wrote:

I don't know how to download something from the WARP board STA to test whether the connection works after the handshake.

As we state in our documentation, the STA and AP bridge their Eth A ports. You can use the wireless link by plugging the AP into a wired network and plugging the STA into a single computer. You should test this with the stock unmodified design before testing it on your modified design.

joho2027 wrote:

From what I can see, however, the STA WARP board actually completes the handshake, while for commercial WiFi devices (my phone) it does not complete the handshake. I'm not sure how to account for this apparent inconsistency.

If the AP is showing increments its hex display (e.g. from "0" to "1"), then the handshake completed. My guess is the commercial Wi-Fi device also completes the handshake but quickly drops the connection because something else is broken in your AP implementation. You can verify this by looking at the over-the-air packets directly with a laptop running Wireshark in monitor mode.

Offline

 

#17 2016-Sep-20 00:22:21

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

chunter wrote:

As we state in our documentation, the STA and AP bridge their Eth A ports. You can use the wireless link by plugging the AP into a wired network and plugging the STA into a single computer. You should test this with the stock unmodified design before testing it on your modified design.

Do I need a Gigabit Ethernet port to test this? It seems like I need one, from the documentation.

Regards,
loho2027

Offline

 

#18 2016-Sep-20 08:28:11

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: 802.11 Reference Design- making AP send multiple SSIDs

The WARPLab and 802.11 Reference Design configure the WARP v3 Ethernet interfaces for 1000Mbps. You must connect these ports to 1000Mbps Ethernet ports on a switch or PC. If your PC only supports 100Mbps you will need a 100/1000 Ethernet switch between your PC and the WARP v3 Ethernet ports.

Offline

 

#19 2016-Sep-20 18:42:25

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

I think I've narrowed down the problem with the AP virtualisation. The code below, when commented out, works fine (as long as I keep the AP as the same MAC address):

tx_header_common.address_2[0] = curr_entry->vap->bssid[0];
tx_header_common.address_2[1] = curr_entry->vap->bssid[1];
tx_header_common.address_2[2] = curr_entry->vap->bssid[2];
tx_header_common.address_2[3] = curr_entry->vap->bssid[3];
tx_header_common.address_2[4] = curr_entry->vap->bssid[4];
tx_header_common.address_2[5] = curr_entry->vap->bssid[5];

When I run the program with the above code, it still runs, and generates the appropriate packet (I used Wireshark to view the WiFi packets transmitted by the AP), but the commercial WiFi device I'm using to test this drops the packet, so that the handshake does not complete (at least, most of the time). When I inspect the packets with Wireshark, everything seems fine (FCS is good, etc).

So maybe the above code is not enough to change the BSSID of the AP? I've looked at all the places in the code that contains bssid, ssid, and wlan_mac_addr already.

I wonder if you have any suggestions?

Offline

 

#20 2016-Sep-21 10:17:02

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: 802.11 Reference Design- making AP send multiple SSIDs

So maybe the above code is not enough to change the BSSID of the AP?

The code above is definitely not enough to change the BSSID of the AP. The node's MAC addresses is used throughout the code in CPU High and CPU Low. You must address all of these uses, not just the addr2 field in the tx_header_common struct in CPU High.

Offline

 

#21 2016-Sep-21 18:16:58

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

Is there a way to check if I've properly changed the BSSID of an AP?

Offline

 

#22 2016-Sep-21 19:12:43

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

Starting with the unmodified code for 802.11 Reference Design, how would I change the BSSID of the AP? I changed the bssid in main() before running configure_bss, like so:

u8 new_addr[MAC_ADDR_LEN];
    new_addr[0] = wlan_mac_addr[0];
    new_addr[1] = wlan_mac_addr[1];
    new_addr[2] = wlan_mac_addr[2];
    new_addr[3] = wlan_mac_addr[3];
    new_addr[4] = wlan_mac_addr[4];
    new_addr[5] = wlan_mac_addr[5]+1;
    // Set Header information
    //tx_header_common.address_2 = &(wlan_mac_addr[0]);

    tx_header_common.address_2[0] = new_addr[0];
    tx_header_common.address_2[1] = new_addr[1];
    tx_header_common.address_2[2] = new_addr[2];
    tx_header_common.address_2[3] = new_addr[3];
    tx_header_common.address_2[4] = new_addr[4];
    tx_header_common.address_2[5] = new_addr[5];

...

memcpy(bss_config.bssid, new_addr,MAC_ADDR_LEN);
strncpy(bss_config.ssid, default_AP_SSID, SSID_LEN_MAX);

...


I also changed the configure_bss function to allow changing the bssid to a different address compared to the wlan_mac_addr (ie. disabled the BSS_CONFIG_FAILURE_BSSID_INVALID error message).

Then the connection no longer works.

Can you let me know some examples of what other bits of code I need to change to change the BSSID, from the unmodified 802.11 Reference Design code?

Regards,
loho2027

Last edited by loho2027 (2016-Sep-21 20:47:45)

Offline

 

#23 2016-Sep-22 08:54:19

chunter
Administrator
From: Mango Communications
Registered: 2006-Aug-24
Posts: 1212

Re: 802.11 Reference Design- making AP send multiple SSIDs

The default AP design stores uses the MAC address that is stored in the nonvolatile EEPROM on each WARP board as both the MAC address and the BSSID of the BSS. You should track where all get_mac_hw_addr_wlan() is used. It's not just CPU_HIGH.

For instance, suppose you change the BSSID and the RA (addr2) of every packet you create in CPU_HIGH. Receivers will try to send an ACK to the new address you chose, but CPU_LOW won't understand the ACK because it doesn't match the original hardware MAC address it uses from the EEPROM.

Offline

 

#24 2016-Oct-07 02:33:51

loho2027
Member
Registered: 2016-Aug-16
Posts: 45

Re: 802.11 Reference Design- making AP send multiple SSIDs

I'd like to implement WPA2-PSK support to the 802.11 Reference Design, and I am wondering if you know whether there are any libraries that Xilinx provides that supports all the required hash and cryptographic functions (like HMAC_SHA), or will I have to implement those functions on my own?

Regards,
loho2027

Last edited by loho2027 (2016-Oct-09 21:44:22)

Offline

 

#25 2016-Oct-10 11:59:42

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: 802.11 Reference Design- making AP send multiple SSIDs

Adding WPA2 to the 802.11 Reference Design is feasible but is a significant design project. The implementation of the cryptographic functions must be high throughput (to avoid being a bottleneck) and low latency (to avoid issues with MAC timing). This implies the implementation must be in the fabric of the FPGA, tightly integrated to the MAC and PHY cores. I have not explored any existing AES implementations. It would take considerable effort to evaluate these options and integrate the required logic in the existing MAC/PHY stack.

Offline

 

Board footer