Q2-Add SSID IE
Topics in this section,
In this section, you are going to learn
How to add multiple SSID IE elements in Beacons
# |
Version |
---|---|
Ubuntu |
Ubuntu 22.04 64 bit |
Linux Kernel |
6.9.2 |
Hostapd |
hostapd 2.10 |
Add multiple SSID IE elements in Beacons
Call flow for add multiple ssid ie in Beacons
main ()
hostapd_setup_interface ()
setup_interface ()
setup_interface2 ()
hostapd_setup_interface_complete ()
hostapd_setup_interface_complete_sync ()
hostapd_setup_bss ()
ieee802_11_set_beacon ()
__ieee802_11_set_beacon ()
ieee802_11_build_ap_params ()
ap_add_multiple_ssid_ie ()
Download the below patch file
add_multiple_ssid_ie_beacons.patch
See the full content of patch file
diff -crB original/hostapd-2.10/src/ap/beacon.c changed/hostapd-2.10/src/ap/beacon.c
*** original/hostapd-2.10/src/ap/beacon.c 2022-01-17 02:21:29.000000000 +0530
--- changed/hostapd-2.10/src/ap/beacon.c 2024-07-25 19:09:48.461444824 +0530
***************
*** 1515,1520 ****
--- 1515,1521 ----
hapd->conf->ssid.ssid_len);
pos += hapd->conf->ssid.ssid_len;
}
+ pos = ap_add_multiple_ssid_ie(pos);
/* Supported rates */
pos = hostapd_eid_supp_rates(hapd, pos);
diff -crB original/hostapd-2.10/src/ap/ieee802_11.h changed/hostapd-2.10/src/ap/ieee802_11.h
*** original/hostapd-2.10/src/ap/ieee802_11.h 2022-01-17 02:21:29.000000000 +0530
--- changed/hostapd-2.10/src/ap/ieee802_11.h 2024-07-25 19:09:09.653445426 +0530
***************
*** 115,120 ****
--- 115,121 ----
u8 * hostapd_eid_adv_proto(struct hostapd_data *hapd, u8 *eid);
u8 * hostapd_eid_roaming_consortium(struct hostapd_data *hapd, u8 *eid);
u8 * hostapd_eid_time_adv(struct hostapd_data *hapd, u8 *eid);
+ u8 * ap_add_multiple_ssid_ie(u8 *eid);
u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid);
int hostapd_update_time_adv(struct hostapd_data *hapd);
void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
diff -crB original/hostapd-2.10/src/ap/ieee802_11_shared.c changed/hostapd-2.10/src/ap/ieee802_11_shared.c
*** original/hostapd-2.10/src/ap/ieee802_11_shared.c 2022-01-17 02:21:29.000000000 +0530
--- changed/hostapd-2.10/src/ap/ieee802_11_shared.c 2024-07-25 19:09:01.413445554 +0530
***************
*** 625,630 ****
--- 625,651 ----
return eid;
}
+ char data_ssid1_ie[] = "Hello";
+ char data_ssid2_ie[] = "World";
+
+ u8 * ap_add_multiple_ssid_ie(u8 *eid)
+ {
+ size_t len;
+
+ len = os_strlen(data_ssid1_ie);
+ *eid++ = WLAN_EID_SSID;
+ *eid++ = len;
+ os_memcpy(eid, data_ssid1_ie, len);
+ eid += len;
+
+ len = os_strlen(data_ssid2_ie);
+ *eid++ = WLAN_EID_SSID;
+ *eid++ = len;
+ os_memcpy(eid, data_ssid2_ie, len);
+ eid += len;
+
+ return eid;
+ }
u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid)
{
test:~$ pwd
/home/test
Make sure internet is available in laptop to download hostapd package
test:~$ sudo wget http://w1.fi/releases/hostapd-2.10.tar.gz
Create a directory
test:~$ mkdir hostapd
Change directory to hostapd
test:~$ cd hostapd
Note : Your present working directory should be hostapd
test:~$ pwd
/home/test/hostapd/
Extract hostapd
test:~$ sudo tar -xvf ~/hostapd-2.10.tar.gz
Run the below command to apply patch
test:~$ patch -p1 < add_multiple_ssid_ie_beacons.patch
patching file hostapd-2.10/src/ap/beacon.c
patching file hostapd-2.10/src/ap/ieee802_11.h
patching file hostapd-2.10/src/ap/ieee802_11_shared.c
Change directory to hostapd
test:~$ cd hostapd-2.10/hostapd/
Check the current working directory using pwd command
Make sure your current working directory is hostapd
test:~$ pwd
/home/test/hostapd/hostapd-2.10/hostapd/
Copy the contents of defconfig file to .config file
test:~$ sudo cp defconfig .config
Compile hostapd
test:~$ sudo make
Create run_hostapd.conf
test:~$ sudo vim ./run_hostapd.conf
ctrl_interface=/run/hostapd
interface=wlan0
driver=nl80211
ssid=test_open
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
Run hostapd
test:~$ sudo ./hostapd ./run_hostapd.conf
Download file to check wireshark output
add_multiple_ssid_ie_beacons.pcapng
Check for beacon packet
Click on packet No.2 as shown in the image below

Click on IEEE 802.11 Wireless Management
Click on Tagged parameters
Click on Tag: SSID parameter set: Undecoded
