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

[Minios-devel] [UNIKRAFT/LWIP PATCH 2/5] Add getaddrinfo() wrapper


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Fri, 2 Aug 2019 15:57:40 +0300
  • Cc: felipe.huici@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, sharan.santhanam@xxxxxxxxx, Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
  • Delivery-date: Fri, 02 Aug 2019 12:57:56 +0000
  • Ironport-phdr: 9a23:ofOtUxEfLaHFNuK/nPGr8J1GYnF86YWxBRYc798ds5kLTJ76p8iybnLW6fgltlLVR4KTs6sC17OM9fGxEjdYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5sIBmsqQjcssYajIV+Jq0s1hbHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlTwKPCAl/m7JlsNwjbpboBO/qBx5347Ue5yeOP5ncq/AYd8WWW9NU8BMXCJDH4y8dZMCAeofM+hFoYfzpFwAohmwBQS3GO/j1iVFimPs0KEmz+gsFxzN0gw6H9IJtXTZtMv4NKAJUeCpzanIyyjIYfVL2Tfl9YjDbxcsru2LXbJrbcrRyE8vGxnBjlWNsYzlIiiY2fgWs2SB9+pgSPmgh3Q9qwF2uzWiwNonhIrRho8N11zJ+jh1zJw2KNC4UkJ3f8CoHZlKuyyUL4d6X8wvT3xytCs5yrAKo4C3cSYExZg92hLSZOKLfo6V6Rz5TumROy13hHd9dbK6gBa97Favx/XnVsmxzFZKti1FksTQtnwV1xzc9MyHSvxl80e/3DaAzQHT6uVeLU8ojqrXMYYhwqMrmZYJq0TDGTf6mETwjKCIakUp4vWk5uv6brn8pZKRN5V4hh/gPqksgMCyD/w0Mg0UUGia/eS82qfj/Ur8QLhSkvI2lbLZsIzbJcQdvKK5BxJV0p4+6xukEzimy84UnWEaLF1eYh6HlY/pN0nUIP/kFfe/n0iskDBzyvDCJLLhGYnCLmXZnLj6erZ95FNTxxA1zd1b5p9ZEb4BIPfpVU/wsNzUFAM2Mwuxw+z/EtVyypseWX6TAq+eKK7StF6I5uQuI+mLf48ZoSvyJOY75/HwiX80glsdfaiy3ZsLc3C0BPtnLFufYXb2hdcBC2gKtBIkTOP2kF2CTSJTZ3GqUqIy+D47DIOmDZ/dSYy3gLyBwSa7EYFXZm1dDFCDD2vnd4GeVPgXci6dPNJhmCQeVbe9U48hyQ2utAjixrp8Lurb4DcYuojl1NRv/O3cjxcy9SB0D8uH1WGCVWR0k3gORzAowK9/pVZyxUyZ3admnvxSDcZT6O9RUgcmKZ7cyPR3C8vzWgLEedeJTkyqQta7AT4vSNIwwsEBY1xmFtWkkB/Mwy6qDKUOmLCRGpM07/GU43+kIsd7ynHdkaUskVQias9OLnG9wL5y8U7UHYGavV+ekvOBcr8A3SiF0Hqb0CLat0ZDTA92F6HYRW03bVCQtcnzoFnFGez9QY87OxdMnJbRYpBBbcfk2BAfHK/u
  • Ironport-sdr: DwA5l0hCNM8VTT06ztOR2G5LrcfKNjqK31fk0gV1Vx8SAB7eujq+9QI8D8+2gNTcp64WOUadGe imQXJxNGOYOA==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

From: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>

... and freeaddrinfo() and gai_strerror().

Signed-off-by: Bogdan Lascu <lascu.bogdan96@xxxxxxxxx>
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 exportsyms.uk   |  3 +++
 include/netdb.h |  8 +++++++-
 inet.c          | 23 +++++++++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/exportsyms.uk b/exportsyms.uk
index ca0a748..7362abb 100644
--- a/exportsyms.uk
+++ b/exportsyms.uk
@@ -35,3 +35,6 @@ getservbyname
 getservbyport
 inet_ntop
 inet_pton
+lwip_getaddrinfo
+lwip_freeaddrinfo
+gai_strerror
diff --git a/include/netdb.h b/include/netdb.h
index dbed0cd..0cbcb5e 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -4,7 +4,11 @@
 
 #define gethostbyname(name) lwip_gethostbyname(name)
 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
-       lwip_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)
 
 #endif /* LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) */
 
@@ -20,3 +24,5 @@ struct protoent {
        char    **p_aliases;    /* alias list */
        int     p_proto;        /* protocol # */
 };
+
+const char *gai_strerror(int errcode);
diff --git a/inet.c b/inet.c
index 07dafe6..f718e38 100644
--- a/inet.c
+++ b/inet.c
@@ -43,3 +43,26 @@ int inet_pton(int af, const char *src, void *dst)
 {
        return lwip_inet_pton(af, src, dst);
 }
+
+/* Note: lwip implementation of getaddrinfo does not return all the errors
+ * codes mentioned in its man page.
+ */
+const char *gai_strerror(int errcode)
+{
+       switch (errcode) {
+#if LWIP_DNS_API_DEFINE_ERRORS
+       case EAI_NONAME:
+               return "The node or service is not known; or both node and 
service are NULL.";
+       case EAI_SERVICE:
+               return "The requested service is not available for the 
requested socket type.";
+       case EAI_FAIL:
+               return "The name server returned a permanent failure 
indication.";
+       case EAI_MEMORY:
+               return "Out of memory.";
+       case EAI_FAMILY:
+               return "The requested address family is not supported.";
+#endif /* LWIP_DNS_API_DEFINE_ERRORS */
+       default:
+               return "Error on getaddrinfo.";
+       }
+}
-- 
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®.