Misc build fixes
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3402 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
37868d0c05
commit
0926c62f8e
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* up_tapdev.c
|
||||
* arch/sim/src/up_tapdev.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
@ -44,6 +44,10 @@
|
|||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL (void*)0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
|
|
@ -135,33 +135,32 @@ static inline void dump_ethhdr(const char *msg, unsigned char *buf, int buflen)
|
|||
|
||||
static int up_setmacaddr(void)
|
||||
{
|
||||
unsigned char macaddr[6];
|
||||
int sockfd;
|
||||
int ret = -1;
|
||||
if (macaddr)
|
||||
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
|
||||
sockfd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||
struct ifreq req;
|
||||
memset(&req, 0, sizeof(struct ifreq));
|
||||
|
||||
int sockfd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd >= 0)
|
||||
/* Put the driver name into the request */
|
||||
|
||||
strncpy(req.ifr_name, "tap0", IFNAMSIZ);
|
||||
|
||||
/* Perform the ioctl to get the MAC address */
|
||||
|
||||
ret = ioctl(sockfd, SIOCGIFHWADDR, (unsigned long)&req);
|
||||
if (!ret)
|
||||
{
|
||||
struct ifreq req;
|
||||
memset(&req, 0, sizeof(struct ifreq));
|
||||
/* Set the MAC address */
|
||||
|
||||
/* Put the driver name into the request */
|
||||
|
||||
strncpy(req.ifr_name, "tap0", IFNAMSIZ);
|
||||
|
||||
/* Perform the ioctl to get the MAC address */
|
||||
|
||||
ret = ioctl(sockfd, SIOCGIFHWADDR, (unsigned long)&req);
|
||||
if (!ret)
|
||||
{
|
||||
/* Set the MAC address */
|
||||
|
||||
ret = uipdriver_setmacaddr(&req.ifr_hwaddr.sa_data);
|
||||
}
|
||||
ret = uipdriver_setmacaddr(&req.ifr_hwaddr.sa_data);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,4 +36,4 @@
|
|||
# Networking support
|
||||
|
||||
CONFIGURED_APPS += netutils/uiplib=.built_always
|
||||
CONFIGURED_APPS += netutils/thttps=.built_always
|
||||
CONFIGURED_APPS += netutils/thttpd=.built_always
|
||||
|
|
Loading…
Reference in New Issue