Merged in merlin17/apps/ieee802154 (pull request #79)

wireless/ieee802154: Adds sniffer back to I8SAK app

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2017-05-08 20:28:38 +00:00 committed by Gregory Nutt
commit feadc9ff4a
9 changed files with 427 additions and 49 deletions

View File

@ -100,6 +100,9 @@ int ieee802154_geteaddr(int fd, FAR uint8_t *eaddr);
int ieee802154_setpromisc(int fd, bool promisc); int ieee802154_setpromisc(int fd, bool promisc);
int ieee802154_getpromisc(int fd, FAR bool *promisc); int ieee802154_getpromisc(int fd, FAR bool *promisc);
int ieee802154_setrxonidle(int fd, bool rxonidle);
int ieee802154_getrxonidle(int fd, FAR bool *rxonidle);
int ieee802154_settxpwr(int fd, int32_t txpwr); int ieee802154_settxpwr(int fd, int32_t txpwr);
int ieee802154_gettxpwr(int fd, FAR int32_t *txpwr); int ieee802154_gettxpwr(int fd, FAR int32_t *txpwr);
@ -168,22 +171,14 @@ int sixlowpan_setpromisc(int sock, FAR const char *ifname, bool promisc);
int sixlowpan_getpromisc(int sock, FAR const char *ifname, int sixlowpan_getpromisc(int sock, FAR const char *ifname,
FAR bool *promisc); FAR bool *promisc);
int sixlowpan_setdevmode(int sock, FAR const char *ifname, uint8_t devmode); int sixlowpan_setrxonidle(int sock, FAR const char *ifname, bool rxonidle);
int sixlowpan_getdevmode(int sock, FAR const char *ifname, int sixlowpan_getrxonidle(int sock, FAR const char *ifname,
FAR uint8_t *devmode); FAR bool *rxonidle);
int sixlowpan_settxpwr(int sock, FAR const char *ifname, int32_t txpwr); int sixlowpan_settxpwr(int sock, FAR const char *ifname, int32_t txpwr);
int sixlowpan_gettxpwr(int sock, FAR const char *ifname, int sixlowpan_gettxpwr(int sock, FAR const char *ifname,
FAR int32_t *txpwr); FAR int32_t *txpwr);
int sixlowpan_setcca(int sock, FAR const char *ifname,
FAR struct ieee802154_cca_s *cca);
int sixlowpan_getcca(int sock, FAR const char *ifname,
FAR struct ieee802154_cca_s *cca);
int sixlowpan_energydetect(int sock, FAR const char *ifname,
FAR bool *energy);
#endif /* CONFIG_NET_6LOWPAN*/ #endif /* CONFIG_NET_6LOWPAN*/
/* libutils *****************************************************************/ /* libutils *****************************************************************/

View File

@ -20,5 +20,13 @@ config IEEE802154_I8SAK_PROGNAME
This is the name of the program that will be use when the NSH ELF This is the name of the program that will be use when the NSH ELF
program is installed. program is installed.
config IEEE802154_I8SAK_PRIORITY
int "i8sak task priority"
default 100
config IEEE802154_I8SAK_STACKSIZE
int "i8sak stack size"
default 2048
endif endif

View File

@ -73,7 +73,8 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static int tx(int fd, FAR const char *str, int verbose); static int tx(FAR const char *devname, FAR const char *str, int verbose);
static int start_sniffer_daemon(FAR const char *devname);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -81,6 +82,9 @@ static int tx(int fd, FAR const char *str, int verbose);
uint8_t g_handle = 0; uint8_t g_handle = 0;
uint8_t g_txframe[IEEE802154_MAX_MAC_PAYLOAD_SIZE]; uint8_t g_txframe[IEEE802154_MAX_MAC_PAYLOAD_SIZE];
static int sniffer_daemon(int argc, FAR char *argv[]);
bool g_sniffer_daemon_started = false;
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
@ -90,6 +94,112 @@ uint8_t g_txframe[IEEE802154_MAX_MAC_PAYLOAD_SIZE];
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name : start_sniff
*
* Description :
* Starts a thread to run the sniffer in the background
****************************************************************************/
static int start_sniffer_daemon(FAR const char *devname)
{
int ret;
FAR const char *sniffer_argv[2];
printf("i8sak: Starting sniffer_daemon\n");
if (g_sniffer_daemon_started)
{
printf("i8sak: sniffer_daemon already running\n");
return EXIT_SUCCESS;
}
sniffer_argv[0] = devname;
sniffer_argv[1] = NULL;
ret = task_create("sniffer_daemon", CONFIG_IEEE802154_I8SAK_PRIORITY,
CONFIG_IEEE802154_I8SAK_STACKSIZE, sniffer_daemon,
(FAR char * const *)sniffer_argv);
if (ret < 0)
{
int errcode = errno;
printf("i8sak: ERROR: Failed to start sniffer_daemon: %d\n",
errcode);
return EXIT_FAILURE;
}
g_sniffer_daemon_started = true;
printf("i8sak: sniffer_daemon started\n");
return OK;
}
/****************************************************************************
* Name : sniffer_daemon
*
* Description :
* Sniff for frames (Promiscuous mode)
****************************************************************************/
static int sniffer_daemon(int argc, FAR char *argv[])
{
int ret, fd, i;
struct mac802154dev_rxframe_s rx;
fd = open(argv[1], O_RDWR);
if (fd < 0)
{
printf("cannot open %s, errno=%d\n", argv[1], errno);
ret = errno;
return ret;
}
printf("Listening...\n");
/* Enable promiscuous mode */
ret = ieee802154_setpromisc(fd, true);
/* Make sure receiver is always on while idle */
ret = ieee802154_setrxonidle(fd, true);
while(1)
{
ret = read(fd, &rx, sizeof(struct mac802154dev_rxframe_s));
if (ret < 0)
{
printf("sniffer_daemon: read failed: %d\n", errno);
goto errout;
}
printf("Frame Received:\n");
for (i = 0; i < rx.length; i++)
{
printf("%02X", rx.payload[i]);
}
printf("\n");
fflush(stdout);
}
errout:
/* Turn receiver off when idle */
ret = ieee802154_setrxonidle(fd, false);
/* Disable promiscuous mode */
ret = ieee802154_setpromisc(fd, false);
printf("sniffer_daemon: closing");
close(fd);
g_sniffer_daemon_started = false;
return OK;
}
/**************************************************************************** /****************************************************************************
* Name : tx * Name : tx
* *
@ -97,12 +207,22 @@ uint8_t g_txframe[IEEE802154_MAX_MAC_PAYLOAD_SIZE];
* Transmit a data frame. * Transmit a data frame.
****************************************************************************/ ****************************************************************************/
static int tx(int fd, FAR const char *str, int verbose) static int tx(FAR const char *devname, FAR const char *str, int verbose)
{ {
struct mac802154dev_txframe_s tx; struct mac802154dev_txframe_s tx;
int ret, str_len; int ret, str_len, fd;
int i = 0; int i = 0;
/* Open device */
fd = open(devname, O_RDWR);
if (fd < 0)
{
printf("cannot open %s, errno=%d\n", devname, errno);
ret = errno;
return ret;
}
/* Set an application defined handle */ /* Set an application defined handle */
tx.meta.msdu_handle = g_handle++; tx.meta.msdu_handle = g_handle++;
@ -116,6 +236,8 @@ static int tx(int fd, FAR const char *str, int verbose)
tx.meta.ranging = IEEE802154_NON_RANGING; tx.meta.ranging = IEEE802154_NON_RANGING;
tx.meta.src_addr_mode = IEEE802154_ADDRMODE_EXTENDED; tx.meta.src_addr_mode = IEEE802154_ADDRMODE_EXTENDED;
tx.meta.dest_addr.mode = IEEE802154_ADDRMODE_SHORT;
tx.meta.dest_addr.saddr = 0xFADE;
str_len = strlen(str); str_len = strlen(str);
@ -128,7 +250,7 @@ static int tx(int fd, FAR const char *str, int verbose)
if ((str_len & 1) || (tx.length > IEEE802154_MAX_MAC_PAYLOAD_SIZE)) if ((str_len & 1) || (tx.length > IEEE802154_MAX_MAC_PAYLOAD_SIZE))
{ {
goto data_error; goto error;
} }
/* Decode hex packet */ /* Decode hex packet */
@ -144,7 +266,7 @@ static int tx(int fd, FAR const char *str, int verbose)
} }
else else
{ {
goto data_error; goto error;
} }
} }
@ -173,11 +295,13 @@ static int tx(int fd, FAR const char *str, int verbose)
printf(" write: errno=%d\n",errno); printf(" write: errno=%d\n",errno);
} }
return ret; close(fd);
return ret;
data_error: error:
printf("data error\n"); printf("data error\n");
return ERROR;; close(fd);
return ERROR;
} }
/**************************************************************************** /****************************************************************************
@ -190,7 +314,8 @@ data_error:
int usage(void) int usage(void)
{ {
printf("i8 <device> <op> [<args>]\n" printf("i8 <devname> <op> [<args>]\n"
" sniffer Listen for packets\n"
" tx <hexpacket> Transmit a data frame\n" " tx <hexpacket> Transmit a data frame\n"
); );
@ -207,48 +332,33 @@ int main(int argc, FAR char *argv[])
int i8_main(int argc, char *argv[]) int i8_main(int argc, char *argv[])
#endif #endif
{ {
unsigned long arg = 0; FAR const char *devname;
int fd; FAR const char *cmdname;
int ret = OK; int ret = OK;
if (argc < 3) if (argc < 3)
{ {
printf("ERROR: Missing argument\n");
return usage(); return usage();
} }
if (argc >= 4) devname = argv[1];
{ cmdname = argv[2];
arg = atol(argv[3]);
}
/* Open device */
fd = open(argv[1], O_RDWR);
if (fd < 0)
{
printf("cannot open %s, errno=%d\n", argv[1], errno);
ret = errno;
goto exit;
}
/* Get mode */ /* Get mode */
if (!strcmp(argv[2], "tx")) if (!strcmp(cmdname, "tx"))
{ {
ret = tx(fd, argv[3], TRUE); ret = tx(devname, argv[3], TRUE);
if (ret < 0) }
{ else if(!strcmp(argv[2], "sniffer"))
goto error; {
} ret = start_sniffer_daemon(devname);
} }
else else
{ {
usage:
ret = usage(); ret = usage();
} }
error:
close(fd);
exit:
return ret; return ret;
} }

View File

@ -47,11 +47,12 @@ CSRCS += ieee802154_resetreq.c ieee802154_rxenabreq.c ieee802154_scanreq.c
CSRCS += ieee802154_setreq.c ieee802154_startreq.c ieee802154_syncreq.c CSRCS += ieee802154_setreq.c ieee802154_startreq.c ieee802154_syncreq.c
CSRCS += ieee802154_pollreq.c CSRCS += ieee802154_pollreq.c
# Add Get/Set Attribute helpers # Add Get/Set Attribute helpers
CSRCS = ieee802154_setchan.c ieee802154_getchan.c CSRCS += ieee802154_setchan.c ieee802154_getchan.c
CSRCS += ieee802154_setpanid.c ieee802154_getpanid.c CSRCS += ieee802154_setpanid.c ieee802154_getpanid.c
CSRCS += ieee802154_setsaddr.c ieee802154_getsaddr.c CSRCS += ieee802154_setsaddr.c ieee802154_getsaddr.c
CSRCS += ieee802154_seteaddr.c ieee802154_geteaddr.c CSRCS += ieee802154_seteaddr.c ieee802154_geteaddr.c
CSRCS += ieee802154_setpromisc.c ieee802154_getpromisc.c CSRCS += ieee802154_setpromisc.c ieee802154_getpromisc.c
CSRCS += ieee802154_setrxonidle.c ieee802154_getrxonidle.c
CSRCS += ieee802154_settxpwr.c ieee802154_gettxpwr.c CSRCS += ieee802154_settxpwr.c ieee802154_gettxpwr.c
ifeq ($(CONFIG_NET_6LOWPAN),y) ifeq ($(CONFIG_NET_6LOWPAN),y)
@ -67,6 +68,7 @@ CSRCS += sixlowpan_setpanid.c sixlowpan_getpanid.c
CSRCS += sixlowpan_setsaddr.c sixlowpan_getsaddr.c CSRCS += sixlowpan_setsaddr.c sixlowpan_getsaddr.c
CSRCS += sixlowpan_seteaddr.c sixlowpan_geteaddr.c CSRCS += sixlowpan_seteaddr.c sixlowpan_geteaddr.c
CSRCS += sixlowpan_setpromisc.c sixlowpan_getpromisc.c CSRCS += sixlowpan_setpromisc.c sixlowpan_getpromisc.c
CSRCS += sixlowpan_setrxonidle.c sixlowpan_getrxonidle.c
CSRCS += sixlowpan_settxpwr.c sixlowpan_gettxpwr.c CSRCS += sixlowpan_settxpwr.c sixlowpan_gettxpwr.c
endif endif

View File

@ -63,5 +63,4 @@ int ieee802154_getpromisc(int fd, FAR bool *promisc)
*promisc = req.attr_value.mac.promisc_mode; *promisc = req.attr_value.mac.promisc_mode;
return ret; return ret;
} }

View File

@ -0,0 +1,67 @@
/****************************************************************************
* apps/wireless/ieee802154/libmac/ieee802154_getrxonidle.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2017 Verge Inc. All rights reserved.
* Author: Anthony Merlino <anthony@vergeaero.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
#include "wireless/ieee802154.h"
/****************************************************************************
* Public Functions
****************************************************************************/
int ieee802154_getrxonidle(int fd, FAR bool *rxonidle)
{
struct ieee802154_get_req_s req;
int ret;
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
ret = ieee802154_get_req(fd, &req);
*rxonidle = req.attr_value.mac.rxonidle;
return ret;
}

View File

@ -0,0 +1,65 @@
/****************************************************************************
* apps/wireless/ieee802154/libmac/ieee802154_setrxonidle.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2017 Verge Inc. All rights reserved.
* Author: Anthony Merlino <anthony@vergeaero.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <errno.h>
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
#include "wireless/ieee802154.h"
/****************************************************************************
* Public Functions
****************************************************************************/
int ieee802154_setrxonidle(int fd, bool rxonidle)
{
struct ieee802154_set_req_s req;
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
req.attr_value.mac.rxonidle = rxonidle;
return ieee802154_set_req(fd, &req);
}

View File

@ -0,0 +1,67 @@
/****************************************************************************
* apps/wireless/ieee802154/libmac/sixlowpan_getrxonidle.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
#include "wireless/ieee802154.h"
/****************************************************************************
* Public Functions
****************************************************************************/
int sixlowpan_getrxonidle(int sock, FAR const char *ifname, FAR bool *rxonidle)
{
struct ieee802154_get_req_s req;
int ret;
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
ret = sixlowpan_get_req(sock, ifname, &req);
*rxonidle = req.attr_value.mac.rxonidle;
return ret;
}

View File

@ -0,0 +1,65 @@
/****************************************************************************
* apps/wireless/ieee802154/libmac/sixlowpan_setrxonidle.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
#include "wireless/ieee802154.h"
/****************************************************************************
* Public Functions
****************************************************************************/
int sixlowpan_setrxonidle(int sock, FAR const char *ifname, bool rxonidle)
{
struct ieee802154_set_req_s req;
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
req.attr_value.mac.rxonidle = rxonidle;
return sixlowpan_set_req(sock, ifname, &req);
}