Q4-Send-probe-request
Topics in this section,
In this section, you are going to learn
How to send a probe-request every 30 seconds
# |
Version |
---|---|
Ubuntu |
Ubuntu 22.04 64 bit |
Linux Kernel |
6.9.2 |
Supplicant |
wpa_supplicant 2.10 |
Hostapd |
hostapd 2.10 |
Send a probe-request every 30 seconds
Call flow for send a probe-request every 30 seconds
ieee80211_scan
ieee80211_request_scan
drv_probereq_work
Download the below patch file
send_probe_req_every_30sec.patch
See the full content of patch file
Binary files original/net/mac80211/agg-rx.o and changed/net/mac80211/agg-rx.o differ
Binary files original/net/mac80211/agg-tx.o and changed/net/mac80211/agg-tx.o differ
Binary files original/net/mac80211/airtime.o and changed/net/mac80211/airtime.o differ
Binary files original/net/mac80211/cfg.o and changed/net/mac80211/cfg.o differ
Binary files original/net/mac80211/chan.o and changed/net/mac80211/chan.o differ
Binary files original/net/mac80211/debugfs_key.o and changed/net/mac80211/debugfs_key.o differ
Binary files original/net/mac80211/debugfs_netdev.o and changed/net/mac80211/debugfs_netdev.o differ
Binary files original/net/mac80211/debugfs.o and changed/net/mac80211/debugfs.o differ
Binary files original/net/mac80211/debugfs_sta.o and changed/net/mac80211/debugfs_sta.o differ
Binary files original/net/mac80211/driver-ops.o and changed/net/mac80211/driver-ops.o differ
Binary files original/net/mac80211/eht.o and changed/net/mac80211/eht.o differ
Binary files original/net/mac80211/ethtool.o and changed/net/mac80211/ethtool.o differ
Binary files original/net/mac80211/fils_aead.o and changed/net/mac80211/fils_aead.o differ
Binary files original/net/mac80211/he.o and changed/net/mac80211/he.o differ
Binary files original/net/mac80211/ht.o and changed/net/mac80211/ht.o differ
Binary files original/net/mac80211/ibss.o and changed/net/mac80211/ibss.o differ
diff -crB original/net/mac80211/ieee80211_i.h changed/net/mac80211/ieee80211_i.h
*** original/net/mac80211/ieee80211_i.h 2024-07-11 19:39:07.644259000 +0530
--- changed/net/mac80211/ieee80211_i.h 2024-08-02 01:10:29.460121473 +0530
***************
*** 599,604 ****
--- 599,605 ----
/* dialog token enumerator for neg TTLM request */
u8 dialog_token_alloc;
struct wiphy_delayed_work neg_ttlm_timeout_work;
+ int drv_sta_data ;
};
struct ieee80211_if_ibss {
***************
*** 1057,1062 ****
--- 1058,1064 ----
bool radar_required;
struct wiphy_delayed_work dfs_cac_timer_work;
+ struct wiphy_delayed_work drv_probereq_work;
union {
struct ieee80211_link_data_managed mgd;
***************
*** 2578,2584 ****
struct ieee80211_chanctx *ctx,
struct ieee80211_link_data *rsvd_for);
bool ieee80211_is_radar_required(struct ieee80211_local *local);
!
void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work);
void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
--- 2579,2585 ----
struct ieee80211_chanctx *ctx,
struct ieee80211_link_data *rsvd_for);
bool ieee80211_is_radar_required(struct ieee80211_local *local);
! void drv_probereq_work_cb(struct wiphy *wiphy, struct wiphy_work *work);
void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work);
void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
Binary files original/net/mac80211/iface.o and changed/net/mac80211/iface.o differ
Binary files original/net/mac80211/key.o and changed/net/mac80211/key.o differ
Binary files original/net/mac80211/led.o and changed/net/mac80211/led.o differ
diff -crB original/net/mac80211/link.c changed/net/mac80211/link.c
*** original/net/mac80211/link.c 2024-07-11 19:39:07.644259000 +0530
--- changed/net/mac80211/link.c 2024-08-02 01:10:58.408121115 +0530
***************
*** 47,52 ****
--- 46,53 ----
INIT_LIST_HEAD(&link->reserved_chanctx_list);
wiphy_delayed_work_init(&link->dfs_cac_timer_work,
ieee80211_dfs_cac_timer_work);
+ wiphy_delayed_work_init(&link->drv_probereq_work,
+ drv_probereq_work_cb);
if (!deflink) {
switch (sdata->vif.type) {
***************
*** 250,258 ****
ieee80211_link_setup(&link->data);
}
! if (new_links == 0)
ieee80211_link_init(sdata, -1, &sdata->deflink,
&sdata->vif.bss_conf);
ret = ieee80211_check_dup_link_addrs(sdata);
if (!ret) {
--- 251,260 ----
ieee80211_link_setup(&link->data);
}
! if (new_links == 0) {
ieee80211_link_init(sdata, -1, &sdata->deflink,
&sdata->vif.bss_conf);
+ }
ret = ieee80211_check_dup_link_addrs(sdata);
if (!ret) {
***************
*** 291,299 ****
links[link_id] = NULL;
}
deinit:
! if (use_deflink)
ieee80211_link_init(sdata, -1, &sdata->deflink,
&sdata->vif.bss_conf);
return ret;
}
--- 293,302 ----
links[link_id] = NULL;
}
deinit:
! if (use_deflink) {
ieee80211_link_init(sdata, -1, &sdata->deflink,
&sdata->vif.bss_conf);
+ }
return ret;
}
Binary files original/net/mac80211/link.o and changed/net/mac80211/link.o differ
Binary files original/net/mac80211/mac80211.ko and changed/net/mac80211/mac80211.ko differ
diff -crB original/net/mac80211/mac80211.mod.c changed/net/mac80211/mac80211.mod.c
*** original/net/mac80211/mac80211.mod.c 2024-07-11 19:39:07.824257000 +0530
--- changed/net/mac80211/mac80211.mod.c 2024-08-02 01:05:58.768124821 +0530
***************
*** 716,719 ****
MODULE_INFO(depends, "cfg80211,libarc4");
! MODULE_INFO(srcversion, "BB095EE77446E94801FEB4A");
--- 716,719 ----
MODULE_INFO(depends, "cfg80211,libarc4");
! MODULE_INFO(srcversion, "1991AA4E4C0AB3917DB778F");
Binary files original/net/mac80211/mac80211.mod.o and changed/net/mac80211/mac80211.mod.o differ
Binary files original/net/mac80211/mac80211.o and changed/net/mac80211/mac80211.o differ
Binary files original/net/mac80211/main.o and changed/net/mac80211/main.o differ
Binary files original/net/mac80211/mesh_hwmp.o and changed/net/mac80211/mesh_hwmp.o differ
Binary files original/net/mac80211/mesh.o and changed/net/mac80211/mesh.o differ
Binary files original/net/mac80211/mesh_pathtbl.o and changed/net/mac80211/mesh_pathtbl.o differ
Binary files original/net/mac80211/mesh_plink.o and changed/net/mac80211/mesh_plink.o differ
Binary files original/net/mac80211/mesh_ps.o and changed/net/mac80211/mesh_ps.o differ
Binary files original/net/mac80211/mesh_sync.o and changed/net/mac80211/mesh_sync.o differ
diff -crB original/net/mac80211/mlme.c changed/net/mac80211/mlme.c
*** original/net/mac80211/mlme.c 2024-07-11 19:39:07.648259000 +0530
--- changed/net/mac80211/mlme.c 2024-08-02 01:14:17.940118646 +0530
***************
*** 3388,3393 ****
--- 3387,3411 ----
ieee80211_tx_skb(sdata, skb);
}
+ void drv_probereq_work_cb(struct wiphy *wiphy, struct wiphy_work *work)
+ {
+ struct ieee80211_link_data *link =
+ container_of(work, struct ieee80211_link_data,
+ drv_probereq_work.work);
+ struct ieee80211_sub_if_data *sdata = link->sdata;
+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+
+ wiphy_delayed_work_queue(wiphy, &sdata->deflink.drv_probereq_work,
+ msecs_to_jiffies(30000));
+
+ lockdep_assert_wiphy(sdata->local->hw.wiphy);
+ u8 *dst = sdata->vif.cfg.ap_addr;
+ ieee80211_mlme_send_probe_req(sdata, sdata->vif.addr, dst,
+ sdata->vif.cfg.ssid,
+ sdata->vif.cfg.ssid_len,
+ sdata->deflink.conf->bss->channel);
+ }
+
static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
***************
*** 8628,8634 ****
wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);
wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
&ifmgd->neg_ttlm_timeout_work);
!
if (ifmgd->assoc_data)
ieee80211_destroy_assoc_data(sdata, ASSOC_TIMEOUT);
if (ifmgd->auth_data)
--- 8642,8649 ----
wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);
wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
&ifmgd->neg_ttlm_timeout_work);
! wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
! &sdata->deflink.drv_probereq_work);
if (ifmgd->assoc_data)
ieee80211_destroy_assoc_data(sdata, ASSOC_TIMEOUT);
if (ifmgd->auth_data)
Binary files original/net/mac80211/mlme.o and changed/net/mac80211/mlme.o differ
Binary files original/net/mac80211/ocb.o and changed/net/mac80211/ocb.o differ
Binary files original/net/mac80211/offchannel.o and changed/net/mac80211/offchannel.o differ
Binary files original/net/mac80211/parse.o and changed/net/mac80211/parse.o differ
Binary files original/net/mac80211/pm.o and changed/net/mac80211/pm.o differ
Binary files original/net/mac80211/rate.o and changed/net/mac80211/rate.o differ
Binary files original/net/mac80211/rc80211_minstrel_ht.o and changed/net/mac80211/rc80211_minstrel_ht.o differ
Binary files original/net/mac80211/rx.o and changed/net/mac80211/rx.o differ
Binary files original/net/mac80211/s1g.o and changed/net/mac80211/s1g.o differ
diff -crB original/net/mac80211/scan.c changed/net/mac80211/scan.c
*** original/net/mac80211/scan.c 2024-07-11 19:39:07.648259000 +0530
--- changed/net/mac80211/scan.c 2024-08-02 01:17:03.356116600 +0530
***************
*** 1168,1173 ****
--- 1167,1181 ----
{
lockdep_assert_wiphy(sdata->local->hw.wiphy);
+ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+ static int check_timer = 0;
+ ifmgd->drv_sta_data = 45;
+ if (!check_timer) {
+ check_timer = 1;
+ struct ieee80211_link_data *link = &sdata->deflink;
+ wiphy_delayed_work_queue(sdata->local->hw.wiphy, &sdata->deflink.drv_probereq_work,
+ msecs_to_jiffies(30000));
+ }
return __ieee80211_start_scan(sdata, req);
}
Binary files original/net/mac80211/scan.o and changed/net/mac80211/scan.o differ
Binary files original/net/mac80211/spectmgmt.o and changed/net/mac80211/spectmgmt.o differ
Binary files original/net/mac80211/sta_info.o and changed/net/mac80211/sta_info.o differ
Binary files original/net/mac80211/status.o and changed/net/mac80211/status.o differ
Binary files original/net/mac80211/tdls.o and changed/net/mac80211/tdls.o differ
Binary files original/net/mac80211/tkip.o and changed/net/mac80211/tkip.o differ
Binary files original/net/mac80211/trace.o and changed/net/mac80211/trace.o differ
Binary files original/net/mac80211/tx.o and changed/net/mac80211/tx.o differ
diff -crB original/net/mac80211/util.c changed/net/mac80211/util.c
*** original/net/mac80211/util.c 2024-07-11 19:39:07.652259000 +0530
--- changed/net/mac80211/util.c 2024-08-02 01:18:05.296115834 +0530
***************
*** 1234,1240 ****
*offset);
if (skb_tailroom(skb) < noffset - *offset)
return -ENOBUFS;
! skb_put_data(skb, ie + *offset, noffset - *offset);
*offset = noffset;
}
--- 1233,1239 ----
*offset);
if (skb_tailroom(skb) < noffset - *offset)
return -ENOBUFS;
!
*offset = noffset;
}
Binary files original/net/mac80211/util.o and changed/net/mac80211/util.o differ
Binary files original/net/mac80211/vht.o and changed/net/mac80211/vht.o differ
Binary files original/net/mac80211/wbrf.o and changed/net/mac80211/wbrf.o differ
Binary files original/net/mac80211/wep.o and changed/net/mac80211/wep.o differ
Binary files original/net/mac80211/wme.o and changed/net/mac80211/wme.o differ
Binary files original/net/mac80211/wpa.o and changed/net/mac80211/wpa.o differ
test:~$ pwd
/home/test/
Compile Linux
Change directory to linux-6.9.2
test:~$ cd linux-6.9.2/
Note : Your present working directory should be linux-6.9.2
test:~$ pwd
/home/test/linux-6.9.2/
Remove mac80211 module
test:~$ sudo systemctl stop NetworkManager.service
test:~$ sudo rmmod mac80211
Run the below command to apply patch
test:~$ sudo patch -p1 < send_probe_req_every_30sec.patch
patching file net/mac80211/ieee80211_i.h
patching file net/mac80211/link.c
patching file net/mac80211/mac80211.mod.c
patching file net/mac80211/mlme.c
patching file net/mac80211/scan.c
patching file net/mac80211/util.c
Compile mac80211 folder
test:~$ sudo make -C . M=net/mac80211/
Insert mac80211 module
test:~$ sudo insmod ./net/mac80211/mac80211.ko
Download file to check wireshark output
send_probe_req_every_30sec.pcapng
Check for probe-request packet
Apply display filter
wlan.addr == 02:00:00:00:01:00 && wlan.fc.type_subtype == 4

Observe the probe-request packets with 30 sec time interval
