[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/LWIP PATCH v2] Define getaddrinfo() and freeaddrinfo() as functions instead of wrappers



Hello Costin,

this patch looks good.

Thank you.


Reviewed-by: Charalampos Mainas <charalampos.mainas@xxxxxxxxx>




From: Costin Lupu <costin.lupu@xxxxxxxxx>
Sent: Friday, August 23, 2019 1:53 PM
To: minios-devel@xxxxxxxxxxxxx
Cc: Felipe Huici; Charalampos Mainas; Bogdan Lascu
Subject: [UNIKRAFT/LWIP PATCH v2] Define getaddrinfo() and freeaddrinfo() as functions instead of wrappers
 
From: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>

Commit 28138d6d added getaddrinfo() and freeaddrinfo() as wrappers. However,
it's not necessary for a source file to include the netdb.h header where they
are defined when it uses them. So their definitions are needed as functions and
not as macros.

Signed-off-by: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 exportsyms.uk   |  4 ++--
 include/netdb.h |  7 ++++---
 inet.c          | 14 ++++++++++++++
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/exportsyms.uk b/exportsyms.uk
index 9df9d0d..856ca8f 100644
--- a/exportsyms.uk
+++ b/exportsyms.uk
@@ -35,7 +35,7 @@ getservbyname
 getservbyport
 inet_ntop
 inet_pton
-lwip_getaddrinfo
-lwip_freeaddrinfo
+getaddrinfo
+freeaddrinfo
 gai_strerror
 getnameinfo
diff --git a/include/netdb.h b/include/netdb.h
index d650499..0856a49 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -6,9 +6,10 @@
 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
                 lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
 
-#define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
-#define getaddrinfo(nodname, servname, hints, res) \
-               lwip_getaddrinfo(nodname, servname, hints, res)
+int getaddrinfo(const char *node, const char *service,
+               const struct addrinfo *hints,
+               struct addrinfo **res);
+void freeaddrinfo(struct addrinfo *res);
 
 #endif /* LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) */
 
diff --git a/inet.c b/inet.c
index bbb81a3..903b676 100644
--- a/inet.c
+++ b/inet.c
@@ -44,6 +44,20 @@ int inet_pton(int af, const char *src, void *dst)
         return lwip_inet_pton(af, src, dst);
 }
 
+#if LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS)
+int getaddrinfo(const char *node, const char *service,
+               const struct addrinfo *hints,
+               struct addrinfo **res)
+{
+       return lwip_getaddrinfo(node, service, hints, res);
+}
+
+void freeaddrinfo(struct addrinfo *res)
+{
+       return lwip_freeaddrinfo(res);
+}
+#endif /* LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) */
+
 /* Note: lwip implementation of getaddrinfo does not return all the errors
  * codes mentioned in its man page.
  */
--
2.20.1

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.