Q1-Add vendor IE

  • In this section, you are going to learn

  • How to add vendor IE in Beacons, Probe-Response, Assoc-Response similar to SSID IE

#

Version

Ubuntu

Ubuntu 22.04 64 bit

Linux Kernel

6.9.2

Hostapd

hostapd 2.10

  • Add vendor IE in Beacons, Probe-Response, Assoc-Response similar to SSID IE

  • Call flow for add vendor 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_vendor_ie ()
  • Call flow for add vendor ie in Probe-Response

nl80211_global_init ()
  wpa_driver_nl80211_init_nl_global ()
    process_global_event ()
      do_process_drv_event ()
	mlme_event ()
	   mlme_event_mgmt ()
	     wpa_supplicant_event ()
		hostapd_mgmt_rx ()
		  ieee802_11_mgmt ()
		     handle_probe_req ()
		       hostapd_gen_probe_resp ()
			 ap_add_vendor_ie ()
  • Call flow for add vendor ie in Assoc-Response

nl80211_global_init ()
  wpa_driver_nl80211_init_nl_global ()
    process_global_event ()
      do_process_drv_event ()
	mlme_event ()
	  mlme_event_mgmt ()
	    wpa_supplicant_event ()
	       hostapd_mgmt_rx ()
		 ieee802_11_mgmt ()
		    handle_assoc ()
		      send_assoc_resp ()
			ap_add_vendor_ie ()
  • Download the below patch file

add_vendor_ie_beacons_prob_assoc_res.patch

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_vendor_ie_beacons_prob_assoc_res.patch
patching file hostapd-2.10/src/ap/beacon.c
patching file hostapd-2.10/src/ap/ieee802_11.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_vendor_ie_beacons_prob_assoc_res.pcapng

  • Check for beacon packet

  • Click on packet No.2 as shown in the image below

Diagram
  • Click on IEEE 802.11 Wireless Management

  • Click on Tagged parameters

  • Click on Tag: Vendor Specific: Wi-Fi Alliance: Unknown

Diagram
  • Check for probe-response packet

  • Click on packet No.103 as shown in the image below

Diagram
  • Click on IEEE 802.11 Wireless Management

  • Click on Tagged parameters

  • Click on Tag: Vendor Specific: Wi-Fi Alliance: Unknown

Diagram
  • Check for association response packet

  • Click on packet No.141 as shown in the image below

Diagram
  • Click on IEEE 802.11 Wireless Management

  • Click on Tagged parameters

  • Click on Tag: Vendor Specific: Wi-Fi Alliance: Unknown

Diagram