From 849bbf0698dd8e1ad362899f5ec8da4882c94a9f Mon Sep 17 00:00:00 2001 From: Mathy Vanhoef Date: Fri, 26 Jun 2020 16:23:46 +0400 Subject: [PATCH] rtl8812a: add module parameter to retransmit injected frames The reliability of some attacks is increased by letting the device retransmit injected frames. Since it may not always be desired to retransmit injected frames, add a module parameter to enable it manually. This was tested with an Alfa AWUS036ACH. Even when using a spoofed sender MAC address, the retransmission behaviour is as expected. That is, when an ACK frame towards the spoofed MAC address is received, the retransmission will stop. --- core/rtw_xmit.c | 6 +++++- include/drv_types.h | 1 + os_dep/linux/os_intfs.c | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 07d1a28..eb6cbe2 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -4485,7 +4485,11 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev) pattrib->stbc = 0; } - pattrib->retry_ctrl = _FALSE; + + if (pregpriv->monitor_retransmit) + pattrib->retry_ctrl = _TRUE; + else + pattrib->retry_ctrl = _FALSE; pattrib->pktlen = len; pmlmeext->mgnt_seq = GetSequence(pwlanhdr); pattrib->seqnum = pmlmeext->mgnt_seq; diff --git a/include/drv_types.h b/include/drv_types.h index 083fe72..dcfa74c 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -459,6 +459,7 @@ struct registry_priv { #endif/*CONFIG_TDMADIG*/ u8 monitor_overwrite_seqnum; + u8 monitor_retransmit; u8 monitor_disable_1m; }; diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 00b8e79..aea29b5 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -76,6 +76,10 @@ int rtw_monitor_overwrite_seqnum = 0; module_param(rtw_monitor_overwrite_seqnum, int, 0644); MODULE_PARM_DESC(rtw_monitor_overwrite_seqnum, "Overwrite the sequence number of injected frames"); +int rtw_monitor_retransmit = 0; +module_param(rtw_monitor_retransmit, int, 0644); +MODULE_PARM_DESC(rtw_monitor_retransmit, "Retransmit injected frames"); + int rtw_monitor_disable_1m = 0; module_param(rtw_monitor_disable_1m, int, 0644); MODULE_PARM_DESC(rtw_monitor_disable_1m, "Disable default 1Mbps rate for monitor injected frames"); @@ -1228,6 +1232,7 @@ uint loadparam(_adapter *padapter) #endif registry_par->monitor_overwrite_seqnum = (u8)rtw_monitor_overwrite_seqnum; + registry_par->monitor_retransmit = (u8)rtw_monitor_retransmit; registry_par->monitor_disable_1m = (u8)rtw_monitor_disable_1m; return status;