Fix some initial loop back device compilation errors; mark configuration as EXPERIMENTAL

This commit is contained in:
Gregory Nutt
2015-08-24 11:29:54 -06:00
parent ccb24e1766
commit 0b012c7978
7 changed files with 38 additions and 34 deletions
+5 -5
View File
@@ -46,6 +46,7 @@
#include <errno.h>
#include <arpa/inet.h>
#include <nuttx/net/loopback.h>
#include "lib_internal.h"
#include "netdb/lib_netdb.h"
@@ -153,11 +154,10 @@ static int lib_localhost(FAR const void *addr, socklen_t len, int type,
FAR struct hostent_info_s *info;
socklen_t addrlen;
FAR const uint8_t *src;
FAR uint8_t *dest;
FAR char *dest;
bool match;
int herrnocode;
int namelen;
int ret;
if (lib_lo_ipv4match(addr, len, type))
{
@@ -193,7 +193,7 @@ static int lib_localhost(FAR const void *addr, socklen_t len, int type,
info = (FAR struct hostent_info_s *)buf;
dest = (FAR uint8_t *)info->hi_data;
dest = info->hi_data;
buflen -= (sizeof(struct hostent_info_s) - 1);
memset(host, 0, sizeof(struct hostent));
@@ -204,7 +204,7 @@ static int lib_localhost(FAR const void *addr, socklen_t len, int type,
host->h_addr_list = info->hi_addrlist;
host->h_length = addrlen;
ptr += addrlen;
dest += addrlen;
buflen -= addrlen;
/* And copy localhost host name */
@@ -216,7 +216,7 @@ static int lib_localhost(FAR const void *addr, socklen_t len, int type,
goto errorout_with_herrnocode;
}
strncpy(ptr, g_lo_hostname, buflen);
strncpy(dest, g_lo_hostname, buflen);
return 0;
}
+8 -8
View File
@@ -51,6 +51,7 @@
#include <arpa/inet.h>
#include <nuttx/net/dns.h>
#include <nuttx/net/loopback.h>
#include "lib_internal.h"
#include "netdb/lib_dns.h"
@@ -236,10 +237,9 @@ static int lib_localhost(FAR const char *name, FAR struct hostent *host,
{
FAR struct hostent_info_s *info;
socklen_t addrlen;
FAR const uint8_t *src;
FAR uint8_t *dest;
FAR const char *src;
FAR char *dest;
int namelen;
int ret;
if (strcmp(name, "localhost") == 0)
{
@@ -249,14 +249,14 @@ static int lib_localhost(FAR const char *name, FAR struct hostent *host,
/* Setup to transfer the IPv4 address */
addrlen = sizeof(struct in_addr);
src = (FAR uint8_t *)&g_lo_ipv4addr;
src = (FAR const char *)&g_lo_ipv4addr;
host->h_addrtype = AF_INET;
#else /* CONFIG_NET_IPv6 */
/* Setup to transfer the IPv6 address */
addrlen = sizeof(struct in6_addr);
src = (FAR uint8_t *)&g_lo_ipv6addr;
src = (FAR const char *)&g_lo_ipv6addr;
host->h_addrtype = AF_INET6;
#endif
@@ -270,7 +270,7 @@ static int lib_localhost(FAR const char *name, FAR struct hostent *host,
}
info = (FAR struct hostent_info_s *)buf;
dest = (FAR uint8_t *)info->hi_data;
dest = info->hi_data;
buflen -= (sizeof(struct hostent_info_s) - 1);
memset(host, 0, sizeof(struct hostent));
@@ -281,7 +281,7 @@ static int lib_localhost(FAR const char *name, FAR struct hostent *host,
host->h_addr_list = info->hi_addrlist;
host->h_length = addrlen;
ptr += addrlen;
dest += addrlen;
buflen -= addrlen;
/* And copy name */
@@ -292,7 +292,7 @@ static int lib_localhost(FAR const char *name, FAR struct hostent *host,
return -ERANGE;
}
strncpy(ptr, name, buflen);
strncpy(dest, name, buflen);
return 0;
}