mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 19:44:35 +08:00
netutils: Add a helper function to convert a string to a 6loWPAN node address
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
Reference in New Issue
Block a user