Q1-Add vendor IE
Topics in this section,
In this section, you are going to learn
How to add vendor IE in Probe-Request and Association-Request similar to SSID IE
# |
Version |
---|---|
Ubuntu |
Ubuntu 22.04 64 bit |
Linux Kernel |
6.9.2 |
Supplicant |
wpa_supplicant 2.10 |
Add vendor IE in Probe-Request and Association-Request similar to SSID IE
Call flow for add vendor ie in Probe-request
Call flow for add vendor ie in Probe-request
main ()
wpa_supplicant_add_iface ()
wpa_supplicant_init_iface ()
wpa_supplicant_driver_init ()
wpa_supplicant_req_scan ()
wpa_supplicant_scan ()
wpa_supplicant_extra_ies ()
sta_build_vendor_ie ()
Call flow for add vendor ie in Association-Request
nl80211_global_init ()
wpa_driver_nl80211_init_nl_global ()
process_global_event ()
do_process_drv_event ()
send_scan_event ()
process_global_event ()
do_process_drv_event ()
mlme_event ()
mlme_event_auth ()
wpa_supplicant_event ()
sme_event_auth ()
sme_associate ()
sta_construct_vendor_ie ()
Download the below patch file
add_vendor_ie_prob_assoc_req.patch
See the full content of patch file
diff -crB original/wpa_supplicant-2.10/wpa_supplicant/scan.c changed/wpa_supplicant-2.10/wpa_supplicant/scan.c
*** original/wpa_supplicant-2.10/wpa_supplicant/scan.c 2022-01-17 02:21:29.000000000 +0530
--- changed/wpa_supplicant-2.10/wpa_supplicant/scan.c 2024-07-29 15:35:11.660281820 +0530
***************
*** 588,593 ****
--- 588,614 ----
wpabuf_free(default_ies);
}
+ unsigned char vendor_ie[]= {
+ // Vender OUI ( Organization Unique identifier )
+ 0x50, 0x6f, 0x9a,
+ // Vender-Specific data
+ 0x33, 0x44, 0x55, 0x66
+ };
+
+ void sta_build_vendor_ie(struct wpa_supplicant *wpa_s, struct wpabuf **extra_ie)
+ {
+ size_t buf_len;
+ /* Wi-Fi vendor element */
+ buf_len = 1 + /* Element ID */
+ 1 + /* Length */
+ sizeof(vendor_ie);
+ if (wpabuf_resize(extra_ie, buf_len) == 0) {
+ wpabuf_put_u8(*extra_ie, WLAN_EID_VENDOR_SPECIFIC);
+ wpabuf_put_u8(*extra_ie, buf_len-2);
+ wpabuf_put_data(*extra_ie, vendor_ie, sizeof(vendor_ie));
+ }
+
+ }
static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s)
{
***************
*** 674,681 ****
if (wpabuf_resize(&extra_ie, wpabuf_len(buf)) == 0)
wpabuf_put_buf(extra_ie, buf);
! }
!
return extra_ie;
}
--- 695,702 ----
if (wpabuf_resize(&extra_ie, wpabuf_len(buf)) == 0)
wpabuf_put_buf(extra_ie, buf);
! }
! sta_build_vendor_ie(wpa_s, &extra_ie);
return extra_ie;
}
diff -crB original/wpa_supplicant-2.10/wpa_supplicant/sme.c changed/wpa_supplicant-2.10/wpa_supplicant/sme.c
*** original/wpa_supplicant-2.10/wpa_supplicant/sme.c 2022-01-17 02:21:29.000000000 +0530
--- changed/wpa_supplicant-2.10/wpa_supplicant/sme.c 2024-07-29 15:36:17.476280799 +0530
***************
*** 1721,1726 ****
--- 1721,1741 ----
}
#endif /* CONFIG_IEEE80211R */
+ unsigned char vendor_assoc_ie[]= {
+ 0xdd, // Element ID for
+ 0x07, // Length of the IE
+ // Vender OUI ( Organization Unique identifier )
+ 0x50, 0x6f, 0x9a,
+ // Vender-Specific data
+ 0x33, 0x44, 0x55, 0x66
+ };
+
+ void sta_construct_vendor_ie(struct wpa_supplicant *wpa_s)
+ {
+ os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len,vendor_assoc_ie,sizeof(vendor_assoc_ie));
+ wpa_s->sme.assoc_req_ie_len += sizeof(vendor_assoc_ie);
+
+ }
void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
const u8 *bssid, u16 auth_type)
***************
*** 1957,1963 ****
}
wpa_s->sme.assoc_req_ie_len += multi_ap_ie_len;
}
!
params.bssid = bssid;
params.ssid = wpa_s->sme.ssid;
params.ssid_len = wpa_s->sme.ssid_len;
--- 1972,1978 ----
}
wpa_s->sme.assoc_req_ie_len += multi_ap_ie_len;
}
! sta_construct_vendor_ie(wpa_s);
params.bssid = bssid;
params.ssid = wpa_s->sme.ssid;
params.ssid_len = wpa_s->sme.ssid_len;
test:~$ pwd
/home/test
Make sure internet is available in laptop to download supplicant package
test:~$ sudo wget https://w1.fi/releases/wpa_supplicant-2.10.tar.gz
Create a directory
test:~$ mkdir supplicant
Change directory to supplicant
test:~$ cd supplicant
Note : Your present working directory should be supplicant
test:~$ pwd
/home/test/supplicant/
Extract wpa_supplicant
test:~$ sudo tar -xvf ~/wpa_supplicant-2.10.tar.gz
Run the below command to apply patch
test:~$ patch -p1 < add_vendor_ie_prob_assoc_req.patch
patching file wpa_supplicant-2.10/wpa_supplicant/scan.c
patching file wpa_supplicant-2.10/wpa_supplicant/sme.c
Change directory to wpa_supplicant
test:~$ cd wpa_supplicant-2.10/wpa_supplicant/
Check the current working directory using pwd command
Make sure your current working directory is wpa_supplicant
test:~$ pwd
/home/test/supplicant/wpa_supplicant-2.10/wpa_supplicant
Copy the contents of defconfig file to .config file
test:~$ sudo cp defconfig .config
Compile wpa_supplicant
test:~$ sudo make
Create run_supplicant.conf
test:~$ sudo vim ./run_supplicant.conf
ctrl_interface=/run/wpa_supplicant
update_config=1
network={
ssid="test_open"
key_mgmt=NONE
}
Run wpa_supplicant
test:~$ sudo ./wpa_supplicant -Dnl80211 -i wlan1 -c ./run_supplicant.conf
Download file to check wireshark output
add_vendor_ie_prob_assoc_req.pcapng
Check for probe request packet
Click on packet No.97 as shown in the image below

Click on IEEE 802.11 Wireless Management
Click on Tagged parameters
Click on Tag: Vendor Specific: Wi-Fi Alliance: Unknown

Check for association request packet
Click on packet No.135 as shown in the image below

Click on IEEE 802.11 Wireless Management
Click on Tagged parameters
Click on Tag: Vendor Specific: Wi-Fi Alliance: Unknown
