netutils: Add a helper function to convert a string to a 6loWPAN node address

This commit is contained in:
Gregory Nutt
2017-04-08 12:19:35 -06:00
parent d29a953915
commit ec6ff2791a
4 changed files with 115 additions and 3 deletions

View File

@@ -49,6 +49,8 @@
#include <netinet/in.h>
#include <net/if.h>
#include <nuttx/net/sixlowpan.h>
#include "netutils/netlib.h"
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
@@ -65,7 +67,7 @@
*
* Parameters:
* ifname The name of the interface to use
* nodeaddr Node address to set, size must be CONFIG_NET_6LOWPAN_RIMEADDR_SIZE
* nodeaddr Node address to set, size must be NET_6LOWPAN_RIMEADDR_SIZE
*
* Return:
* 0 on success; -1 on failure
@@ -92,7 +94,7 @@ int netlib_setnodeaddr(FAR const char *ifname, FAR const uint8_t *nodeaddr)
/* Put the new MAC address into the request */
req.ifr_hwaddr.sa_family = AF_INET6;
memcpy(&req.ifr_hwaddr.sa_data, nodeaddr, CONFIG_NET_6LOWPAN_RIMEADDR_SIZE);
memcpy(&req.ifr_hwaddr.sa_data, nodeaddr, NET_6LOWPAN_RIMEADDR_SIZE);
/* Perform the ioctl to set the MAC address */