[PATCH rtems-lwip] rtemslwip: Add gethostbyname wrapper

Kinsey Moore kinsey.moore at oarcorp.com
Wed Feb 28 19:31:57 UTC 2024


Applications and libraries compiled without the benefit of the lwIP
headers may require gethostbyname() instead of lwip_gethostbyname().
This wrapper allows those applicationns and libraries to link properly.
---
 rtemslwip/common/network_compat.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rtemslwip/common/network_compat.c b/rtemslwip/common/network_compat.c
index c072d54..d99204c 100644
--- a/rtemslwip/common/network_compat.c
+++ b/rtemslwip/common/network_compat.c
@@ -58,6 +58,12 @@ uint16_t htons(uint16_t x)
   return lwip_htons(x);
 }
 
+#undef gethostbyname
+struct hostent *gethostbyname(const char *name)
+{
+  return lwip_gethostbyname(name);
+}
+
 int
 getnameinfo(const struct sockaddr *sa, socklen_t salen, char *node,
     size_t nodelen, char *service, size_t servicelen, int flags)
-- 
2.39.2



More information about the devel mailing list