Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a0796eb authored by Jakub Sitnicki's avatar Jakub Sitnicki Committed by Greg Kroah-Hartman
Browse files

staging: rtl8188eu: Introduce monitor interface for IEEE 802.11 frames



This adds support for monitoring IEEE 802.11 Data and Management frames
received or transmitted by a RTL8188EU-based device handled by this
driver.

The monitor interface is not enabled by default and will be registered
only if monitor_enable module parameter is set to 1.  When enabled it
will show up as a monX network device, which can be used by the
userspace programs for monitoring network traffic.

It is intended as an exploratory/debugging tool for rtl8188eu driver.

Signed-off-by: default avatarJakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d59177cb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ r8188eu-y := \
		hal/usb_halinit.o	\
		os_dep/ioctl_linux.o	\
		os_dep/mlme_linux.o	\
		os_dep/mon.o		\
		os_dep/os_intfs.o	\
		os_dep/osdep_service.o	\
		os_dep/recv_linux.o	\
+14 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <drv_types.h>
#include <recv_osdep.h>
#include <mlme_osdep.h>
#include <mon.h>
#include <wifi.h>
#include <linux/vmalloc.h>

@@ -1329,6 +1330,19 @@ static int validate_recv_frame(struct adapter *adapter,
		break;
	}

	/*
	 * This is the last moment before management and control frames get
	 * discarded. So we need to forward them to the monitor now or never.
	 *
	 * At the same time data frames can still be encrypted if software
	 * decryption is in use. However, decryption can occur not until later
	 * (see recv_func()).
	 *
	 * Hence forward the frame to the monitor anyway to preserve the order
	 * in which frames were received.
	 */
	rtl88eu_mon_recv_hook(adapter->pmondev, precv_frame);

exit:

	return retval;
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include <osdep_service.h>
#include <drv_types.h>
#include <mon.h>
#include <wifi.h>
#include <osdep_intf.h>
#include <linux/vmalloc.h>
@@ -1100,6 +1101,9 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
		memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen);
	}

	/* Frame is about to be encrypted. Forward it to the monitor first. */
	rtl88eu_mon_xmit_hook(padapter->pmondev, pxmitframe, frg_len);

	if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) {
		RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n"));
		DBG_88E("xmitframe_addmic(padapter, pxmitframe) == _FAIL\n");
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#define _RTL8188E_XMIT_C_
#include <osdep_service.h>
#include <drv_types.h>
#include <mon.h>
#include <wifi.h>
#include <osdep_intf.h>
#include <usb_ops_linux.h>
@@ -684,6 +685,9 @@ static s32 pre_xmitframe(struct adapter *adapt, struct xmit_frame *pxmitframe)

s32 rtl8188eu_mgnt_xmit(struct adapter *adapt, struct xmit_frame *pmgntframe)
{
	struct xmit_priv *xmitpriv = &adapt->xmitpriv;

	rtl88eu_mon_xmit_hook(adapt->pmondev, pmgntframe, xmitpriv->frag_len);
	return rtw_dump_xframe(adapt, pmgntframe);
}

+2 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ struct registry_priv {
	u8	if2name[16];

	u8	notch_filter;
	bool	monitor_enable;
};

/* For registry parameters */
@@ -209,6 +210,7 @@ struct adapter {
	void (*intf_start)(struct adapter *adapter);
	void (*intf_stop)(struct adapter *adapter);
	struct  net_device *pnetdev;
	struct  net_device *pmondev;

	/*  used by rtw_rereg_nd_name related function */
	struct rereg_nd_name_data {
Loading