From 320980de012edf28f3e104c41fb9ac7fd6c2062c Mon Sep 17 00:00:00 2001 From: Sergei Makarenkov Date: Thu, 9 Feb 2017 22:12:44 +0300 Subject: [PATCH] Fix injection in the monitor mode --- include/rtw_xmit.h | 1 + os_dep/linux/xmit_linux.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/rtw_xmit.h b/include/rtw_xmit.h index 54800b4..53d324b 100644 --- a/include/rtw_xmit.h +++ b/include/rtw_xmit.h @@ -839,6 +839,7 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv); void rtw_alloc_hwxmits(_adapter *padapter); void rtw_free_hwxmits(_adapter *padapter); +s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev); s32 rtw_xmit(_adapter *padapter, _pkt **pkt); bool xmitframe_hiq_filter(struct xmit_frame *xmitframe); diff --git a/os_dep/linux/xmit_linux.c b/os_dep/linux/xmit_linux.c index 1f7f38c..2312b58 100644 --- a/os_dep/linux/xmit_linux.c +++ b/os_dep/linux/xmit_linux.c @@ -527,11 +527,17 @@ _func_exit_; int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) { + _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); int ret = 0; if (pkt) { - rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, pkt->truesize); - ret = _rtw_xmit_entry(pkt, pnetdev); + if (check_fwstate(pmlmepriv, WIFI_MONITOR_STATE) == _TRUE) { + rtw_monitor_xmit_entry((struct sk_buff*)pkt, pnetdev); + } else { + rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, pkt->truesize); + ret = _rtw_xmit_entry(pkt, pnetdev); + } } return ret;