summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2019-08-05 08:11:07 +0200
committerAngelo Mantellini <manangel@cisco.com>2019-08-05 08:12:19 +0200
commitaf6944a35b97a971139d93da49e09e023005f633 (patch)
treee6bc37f3400f4fea91d1193dbb0b2f2ee1cfdae9
parent7b373ed0c6d287aa61c65be2ddc7da1817e1757a (diff)
[HICN-257] facemgr for android
Signed-off-by: Angelo Mantellini <manangel@cisco.com> Change-Id: I2281def568d1faa1093dce81badab6a95fb03a57
-rw-r--r--ctrl/facemgr/src/face.c4
-rw-r--r--ctrl/facemgr/src/util/ip_address.h7
2 files changed, 11 insertions, 0 deletions
diff --git a/ctrl/facemgr/src/face.c b/ctrl/facemgr/src/face.c
index 7da255049..270a6fa9f 100644
--- a/ctrl/facemgr/src/face.c
+++ b/ctrl/facemgr/src/face.c
@@ -26,6 +26,10 @@
#include "util/hash.h"
#include "util/token.h"
+#ifndef bzero
+#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
+#endif
+
#define member_size(type, member) sizeof(((type *)0)->member)
diff --git a/ctrl/facemgr/src/util/ip_address.h b/ctrl/facemgr/src/util/ip_address.h
index 165394709..243ce048b 100644
--- a/ctrl/facemgr/src/util/ip_address.h
+++ b/ctrl/facemgr/src/util/ip_address.h
@@ -27,6 +27,9 @@
#include <machine/endian.h>
#else
#include <endian.h>
+#ifdef __ANDROID__
+#include <byteswap.h>
+#endif
#endif
#include <errno.h>
#include <netdb.h> // struct addrinfo
@@ -87,7 +90,11 @@ typedef struct {
/* No htonl() with const */
static const ip_address_t IPV4_LOOPBACK = {
#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __ANDROID__
+ .v4.as_inaddr.s_addr = bswap_32(INADDR_LOOPBACK),
+#else
.v4.as_inaddr.s_addr = __bswap_constant_32(INADDR_LOOPBACK),
+#endif
#else
.v4.as_inaddr.s_addr = INADDR_LOOPBACK,
#endif