Add injection support

Added injection support based on rtl8188eus driver modification
for aircrack-ng from rofl0r:

aircrack-ng/rtl8188eus@e48f669

Changes to be committed:
	modified:   core/rtw_xmit.c
	modified:   include/drv_conf.h
This commit is contained in:
j4munoz 2020-10-25 17:53:48 +01:00 committed by Rin Cat (鈴猫)
parent 1dad7c3b66
commit a253ec4c6c
No known key found for this signature in database
GPG Key ID: 40DCF18E97150795
2 changed files with 22 additions and 5 deletions

View File

@ -4882,9 +4882,11 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
unsigned char *pframe; unsigned char *pframe;
u8 dummybuf[32]; u8 dummybuf[32];
int len = skb->len, rtap_len; int len = skb->len, rtap_len;
#ifdef CONFIG_MONITOR_MODE_XMIT
int consume;
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); #endif /* CONFIG_MONITOR_MODE_XMIT */
if (likely(skb))
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
#ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL #ifndef CONFIG_CUSTOMER_ALIBABA_GENERAL
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
@ -4899,13 +4901,25 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
if (unlikely(skb->len < rtap_len)) if (unlikely(skb->len < rtap_len))
goto fail; goto fail;
#ifdef CONFIG_MONITOR_MODE_XMIT
len -= sizeof(struct ieee80211_radiotap_header);
rtap_len -= sizeof(struct ieee80211_radiotap_header);
while(rtap_len) {
consume = rtap_len > sizeof(dummybuf) ? sizeof(dummybuf) : rtap_len;
_rtw_pktfile_read(&pktfile, dummybuf, consume);
rtap_len -= consume;
len -= consume;
}
#else /* CONFIG_MONITOR_MODE_XMIT */
if (rtap_len != 12) { if (rtap_len != 12) {
RTW_INFO("radiotap len (should be 14): %d\n", rtap_len); RTW_INFO("radiotap len (should be 14): %d\n", rtap_len);
goto fail; goto fail;
} }
_rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header)); _rtw_pktfile_read(&pktfile, dummybuf, rtap_len-sizeof(struct ieee80211_radiotap_header));
len = len - rtap_len; len = len - rtap_len;
#endif #endif /* CONFIG_MONITOR_MODE_XMIT */
#endif /* CONFIG_CUSTOMER_ALIBABA_GENERAL */
pmgntframe = alloc_mgtxmitframe(pxmitpriv); pmgntframe = alloc_mgtxmitframe(pxmitpriv);
if (pmgntframe == NULL) { if (pmgntframe == NULL) {
rtw_udelay_os(500); rtw_udelay_os(500);
@ -4945,6 +4959,9 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
dump_mgntframe(padapter, pmgntframe); dump_mgntframe(padapter, pmgntframe);
fail: fail:
#ifdef CONFIG_MONITOR_MODE_XMIT
rtw_endofpktfile(&pktfile);
#endif /* CONFIG_MONITOR_MODE_XMIT */
rtw_skb_free(skb); rtw_skb_free(skb);
return 0; return 0;
} }

View File

@ -193,7 +193,7 @@
#endif #endif
#ifdef CONFIG_WIFI_MONITOR #ifdef CONFIG_WIFI_MONITOR
/* #define CONFIG_MONITOR_MODE_XMIT */ #define CONFIG_MONITOR_MODE_XMIT
#endif #endif
#ifdef CONFIG_CUSTOMER_ALIBABA_GENERAL #ifdef CONFIG_CUSTOMER_ALIBABA_GENERAL