Skip to content

Commit

Permalink
Fix injected frames drop
Browse files Browse the repository at this point in the history
  • Loading branch information
kimocoder committed Jan 18, 2019
1 parent b7160a6 commit a278113
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RTL8192EU
Linux driver for Realtek **RTL8192EU** based on official's **TP Link TL - WN823N V3 Beta** v5.2.19.1 from 2018-05-08
Supports monitor mode and frame injection for penetration testing abilities.
<br>Supports monitor mode and frame injection for penetration testing abilities.

# Supported devices:
- DWA-131 _(untested)_
Expand Down
27 changes: 22 additions & 5 deletions core/rtw_xmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4231,6 +4231,21 @@ int rtw_ieee80211_radiotap_iterator_init(
struct ieee80211_radiotap_header *radiotap_header,
int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);

static struct xmit_frame* monitor_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv) {
int tries;
int delay = 300;
struct xmit_frame *pmgntframe = NULL;

for(tries = 3; tries >= 0; tries--) {
pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if(pmgntframe != NULL)
return pmgntframe;
rtw_udelay_os(delay);
delay += delay/2;
}
return NULL;
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
{
Expand Down Expand Up @@ -4277,6 +4292,11 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
if (unlikely(skb->len < rtap_len))
goto fail;

if ((pmgntframe = monitor_alloc_mgtxmitframe(pxmitpriv)) == NULL) {
DBG_COUNTER(padapter->tx_logs.core_tx_err_pxmitframe);
return NETDEV_TX_BUSY;
}

ret = rtw_ieee80211_radiotap_iterator_init(&iterator, rtap_hdr, skb->len, NULL);
while (!ret) {
ret = rtw_ieee80211_radiotap_iterator_next(&iterator);
Expand Down Expand Up @@ -4358,10 +4378,6 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
// frame_ctl = le16_to_cpu(dot11_hdr->frame_control);
/* Check if the QoS bit is set */

if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) {
rtw_udelay_os(500);
goto fail;
}
pattrib = &pmgntframe->attrib;
update_monitor_frame_attrib(padapter, pattrib);

Expand All @@ -4388,10 +4404,11 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)

pattrib->last_txcmdsz = pattrib->pktlen;
dump_mgntframe(padapter, pmgntframe);
DBG_COUNTER(padapter->tx_logs.core_tx);

fail:
rtw_skb_free(skb);
return 0;
return NETDEV_TX_OK;
}
#endif
/*
Expand Down
2 changes: 1 addition & 1 deletion include/rtw_xmit.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
#ifdef CONFIG_SINGLE_XMIT_BUF
#define NR_XMIT_EXTBUFF (1)
#else
#define NR_XMIT_EXTBUFF (32)
#define NR_XMIT_EXTBUFF (64)
#endif

#ifdef CONFIG_RTL8812A
Expand Down

0 comments on commit a278113

Please sign in to comment.