diff --git a/libc/netdb/Make.defs b/libc/netdb/Make.defs index 758534c09e1..68b87a288f7 100644 --- a/libc/netdb/Make.defs +++ b/libc/netdb/Make.defs @@ -48,7 +48,8 @@ endif # Add DNS lookup support ifeq ($(CONFIG_NETDB_DNSCLIENT),y) -CSRCS += lib_dnsinit.c lib_dnsclient.c lib_dnsaddserver.c lib_dnsforeach.c +CSRCS += lib_dnsinit.c lib_dnsbind.c lib_dnsquery.c lib_dnsaddserver.c +CSRCS += lib_dnsforeach.c ifneq ($(CONFIG_NETDB_DNSCLIENT_ENTRIES),0) CSRCS += lib_dnscache.c diff --git a/libc/netdb/lib_dnsclient.c b/libc/netdb/lib_dnsquery.c similarity index 91% rename from libc/netdb/lib_dnsclient.c rename to libc/netdb/lib_dnsquery.c index ba56279eb8a..21e0c14f05e 100644 --- a/libc/netdb/lib_dnsclient.c +++ b/libc/netdb/lib_dnsquery.c @@ -46,19 +46,12 @@ #include -#include -#include #include #include #include #include -#if 0 -#include - -#endif - #include #include "netdb/lib_dns.h" @@ -409,64 +402,6 @@ static int dns_recv_response(int sd, FAR struct sockaddr *addr, * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: dns_bind - * - * Description: - * Initialize the DNS resolver and return a socket bound to the DNS name - * server. The name server was previously selected via dns_server(). - * - * Input Parameters: - * None - * - * Returned Value: - * On success, the bound, non-negative socket descriptor is returned. A - * negated errno value is returned on any failure. - * - ****************************************************************************/ - -int dns_bind(void) -{ - struct timeval tv; - int errcode; - int sd; - int ret; - - /* Has the DNS client been properly initialized? */ - - if (!dns_initialize()) - { - ndbg("ERROR: DNS client has not been initialized\n"); - return -EDESTADDRREQ; - } - - /* Create a new socket */ - - sd = socket(PF_INET, SOCK_DGRAM, 0); - if (sd < 0) - { - errcode = get_errno(); - ndbg("ERROR: socket() failed: %d\n", errcode); - return -errcode; - } - - /* Set up a receive timeout */ - - tv.tv_sec = 30; - tv.tv_usec = 0; - - ret = setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(struct timeval)); - if (ret < 0) - { - errcode = get_errno(); - ndbg("ERROR: setsockopt() failed: %d\n", errcode); - close(sd); - return -errcode; - } - - return sd; -} - /**************************************************************************** * Name: dns_query *