From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server-vie001.gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_DBL_BLOCKED_OPENDNS, URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=new2025; t=1753986976; bh=qZr94B7npd0991kHBht5E0wI2InoAQdObIJcY8cWRYI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Transfer-Encoding:In-Reply-To:Message-ID:Date: From:Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=FcVUrv8+aMHegU7LZbHmYGGKaCVZ8bLFyTZKNzPLs/nzX7kegcCmeQMQUNpjZpp+i 2MffLR7vLTsKCVOB3Uqsu+C+ekkHWJzU1ZPcY9IBI2quxv8LQkJm5sYqKoM6NWFCg9 ECth/o+D6hBXZfmArcvFDd0G2tj2Y82srBmvcrn71sPf7TStnR+F7EuqvuBSpbWRWk +Y2SrEQ9WMslOpsz1GQmMCZCjkgi8vUXBX/hZpoSg/NWfZBFFjNQSC2wqv8QPamr5R X5vbPe53u23ODM1iWJ118g2NUg0JIZbNpEf4/gQxkFn1TYJ7MEwGYGBdW7eLNqp7do xsbl5BSTfUz6w== Received: from linux.gnuweeb.org (unknown [182.253.126.229]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 996FD3126E82; Thu, 31 Jul 2025 18:36:15 +0000 (UTC) Date: Fri, 1 Aug 2025 01:36:12 +0700 From: Ammar Faizi To: Alviro Iskandar Setiawan Cc: Ahmad Gani , GNU/Weeb Mailing List Subject: Re: [PATCH gwproxy v1 1/3] dnslookup: split common functionality and struct into net.c Message-ID: References: <20250731030856.366368-1-reyuki@gnuweeb.org> <20250731030856.366368-2-reyuki@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Machine-Hash: hUx9VaHkTWcLO7S8CQCslj6OzqBx2hfLChRz45nPESx5VSB/xuJQVOKOB1zSXE3yc9ntP27bV1M1 List-Id: On Fri, Aug 01, 2025 at 01:28:22AM +0700, Alviro Iskandar Setiawan wrote: > On Thu, Jul 31, 2025 at 9:01 PM Ammar Faizi wrote: > > On Thu, Jul 31, 2025 at 10:07:44AM +0700, Ahmad Gani wrote: > > > +int init_addr(const char *addr, struct gwp_sockaddr *addr_st, uint16_t port) > > > > This is a no-no. We don't need it. > > > > In gwproxy.c, there is convert_str_to_ssaddr(). It's also better than > > your version because with it you can have: > > > > ./gwproxy --target google.com:80 --bind localhost:1111 > > > > Not restricted to IP address format, but domain name is also ok. > > The init_addr() function is used in the subsequent patch within the > gw_ares_init() function to transform IP address strings into its > binary form. That IP address is expected to be used as the DNS server. > > I think a variant of convert_str_to_ssaddr() that accepts only an IP > address format should be created to handle the task in gw_ares_init(), > as domain name resolution is not expected yet at that point. That's not true. A DNS server IP address can be specificed in a domain name format too. For example: $ nslookup google.com one.one.one.one Server: one.one.one.one Address: 1.1.1.1#53 Non-authoritative answer: Name: google.com Address: 142.250.188.238 Name: google.com Address: 2607:f8b0:4007:809::200e will resolve one.one.one.one first, then it uses the resolved address 1.1.1.1 to resolve google.com. -- Ammar Faizi