From 2a934fbfba8df4bee5f137055d2a6713ff53c71a Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Thu, 16 Jul 2026 15:34:02 +0800 Subject: [PATCH] netdb: Add http and https service entries getaddrinfo() and getservbyname() use the built-in service table when resolving service names. The table only contained ntp, so common service names such as http and https could not be resolved without a numeric port. Add http and https entries for both TCP and UDP to match the existing service table style. Testing: - Host: Ubuntu 22.04 x86_64. - Board/config: sim:nsh with CONFIG_LIBC_NETDB=y and CONFIG_EXAMPLES_HELLO=y. - make clean && make -j16. - Ran a temporary hello example that called getservbyname("http", "tcp") and getservbyname("https", "tcp"). The app verified ports 80 and 443 and printed "getservbyname http/https test passed". Assisted-by: Claude:Claude-Fable-5 Signed-off-by: Lingao Meng --- libs/libc/netdb/lib_getservbynamer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/libc/netdb/lib_getservbynamer.c b/libs/libc/netdb/lib_getservbynamer.c index a1fe9fee71c..eaf3a26e7db 100644 --- a/libs/libc/netdb/lib_getservbynamer.c +++ b/libs/libc/netdb/lib_getservbynamer.c @@ -46,6 +46,10 @@ const struct services_db_s g_services_db[] = { + { "http", 80, IP_PROTO_TCP }, + { "http", 80, IP_PROTO_UDP }, + { "https", 443, IP_PROTO_TCP }, + { "https", 443, IP_PROTO_UDP }, { "ntp", 123, IP_PROTO_TCP }, { "ntp", 123, IP_PROTO_UDP }, { NULL, 0, 0 }