Skip to content

Commit

Permalink
mac802154: add basic support for monitor
Browse files Browse the repository at this point in the history
This patch adds basic support for monitor mode. Also change the open
call that we set the transceiver mac setting on an interface up. Futher
patches will add a better handling while interface up an interface.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed Oct 29, 2014
1 parent 2ac0f3a commit 38130c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions net/mac802154/ieee802154_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ struct ieee802154_sub_if_data {
__le16 pan_id;
__le16 short_addr;
__le64 extended_addr;
bool promisuous_mode;

struct ieee802154_mac_params mac_params;

Expand Down
12 changes: 11 additions & 1 deletion net/mac802154/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ static int mac802154_wpan_open(struct net_device *dev)

mutex_lock(&phy->pib_lock);

if (local->hw.flags & IEEE802154_HW_PROMISCUOUS) {
rc = drv_set_promiscuous_mode(local, sdata->promisuous_mode);
if (rc < 0)
goto out;
}

if (local->hw.flags & IEEE802154_HW_TXPOWER) {
rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
if (rc < 0)
Expand Down Expand Up @@ -382,7 +388,7 @@ static const struct net_device_ops mac802154_wpan_ops = {
};

static const struct net_device_ops mac802154_monitor_ops = {
.ndo_open = mac802154_slave_open,
.ndo_open = mac802154_wpan_open,
.ndo_stop = mac802154_slave_close,
.ndo_start_xmit = ieee802154_monitor_start_xmit,
};
Expand Down Expand Up @@ -434,6 +440,8 @@ void mac802154_wpan_setup(struct net_device *dev)
sdata->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
sdata->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);

sdata->promisuous_mode = false;

mac802154_llsec_init(&sdata->sec);
}

Expand All @@ -453,4 +461,6 @@ void mac802154_monitor_setup(struct net_device *dev)

sdata = IEEE802154_DEV_TO_SUB_IF(dev);
sdata->type = IEEE802154_DEV_MONITOR;

sdata->promisuous_mode = true;
}

0 comments on commit 38130c3

Please sign in to comment.