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

Commit 0606069d authored by alex.bluesman.smirnov@gmail.com's avatar alex.bluesman.smirnov@gmail.com Committed by David S. Miller
Browse files

mac802154: monitor device support



Support for monitor device intended to capture all the network activity.
This interface could be used by networks sniffers and is already
supported by WireShark. That's a good test point to check that basic
MAC support works.

Signed-off-by: default avatarAlexander Smirnov <alex.bluesman.smirnov@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 62610ad2
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,7 @@
#define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header  */
#define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header  */
#define ARPHRD_IEEE80211_RADIOTAP 803	/* IEEE 802.11 + radiotap header */
#define ARPHRD_IEEE80211_RADIOTAP 803	/* IEEE 802.11 + radiotap header */
#define ARPHRD_IEEE802154	  804
#define ARPHRD_IEEE802154	  804
#define ARPHRD_IEEE802154_MONITOR 805	/* IEEE 802.15.4 network monitor */


#define ARPHRD_PHONET	820		/* PhoNet media type		*/
#define ARPHRD_PHONET	820		/* PhoNet media type		*/
#define ARPHRD_PHONET_PIPE 821		/* PhoNet pipe header		*/
#define ARPHRD_PHONET_PIPE 821		/* PhoNet pipe header		*/
+14 −0
Original line number Original line Diff line number Diff line
@@ -129,6 +129,20 @@ enum {


enum {
enum {
	__IEEE802154_DEV_INVALID = -1,
	__IEEE802154_DEV_INVALID = -1,

	 /* TODO:
	 * Nowadays three device types supported by this stack at linux-zigbee
	 * project: WPAN = 0, MONITOR = 1 and SMAC = 2.
	 *
	 * Since this stack implementation exists many years, it's definitely
	 * bad idea to change the assigned values due to they are already used
	 * by third-party userspace software like: iz-tools, wireshark...
	 *
	 * Currently only monitor device is added and initialized by '1' for
	 * compatibility.
	 */
	IEEE802154_DEV_MONITOR = 1,

	__IEEE802154_DEV_MAX,
	__IEEE802154_DEV_MAX,
};
};


+8 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,14 @@
#include <linux/mutex.h>
#include <linux/mutex.h>
#include <linux/bug.h>
#include <linux/bug.h>


/* According to the IEEE 802.15.4 stadard the upper most significant bits of
 * the 32-bit channel bitmaps shall be used as an integer value to specify 32
 * possible channel pages. The lower 27 bits of the channel bit map shall be
 * used as a bit mask to specify channel numbers within a channel page.
 */
#define WPAN_NUM_CHANNELS	27
#define WPAN_NUM_PAGES		32

struct wpan_phy {
struct wpan_phy {
	struct mutex pib_lock;
	struct mutex pib_lock;


+1 −1
Original line number Original line Diff line number Diff line
obj-$(CONFIG_MAC802154)	+= mac802154.o
obj-$(CONFIG_MAC802154)	+= mac802154.o
mac802154-objs		:= ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o
mac802154-objs		:= ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o monitor.o
+4 −1
Original line number Original line Diff line number Diff line
@@ -135,8 +135,11 @@ mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
	struct net_device *dev;
	struct net_device *dev;
	int err = -ENOMEM;
	int err = -ENOMEM;


	/* No devices is currently added */
	switch (type) {
	switch (type) {
	case IEEE802154_DEV_MONITOR:
		dev = alloc_netdev(sizeof(struct mac802154_sub_if_data),
				   name, mac802154_monitor_setup);
		break;
	default:
	default:
		dev = NULL;
		dev = NULL;
		err = -EINVAL;
		err = -EINVAL;
Loading