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=1753987373; bh=LQRaILWoqvVaVRYiFH7pLI6s16luIGwp9icZem2ccWA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type:Content-Transfer-Encoding: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=gZIPYdiQkMuHHErsJuQN9DTAcFT5Y05PevYsHPj34fjSlwvVRc9vwx7/TDulVhSfP 7cT+Dm40/A89EkkLRX6UNS/odeZV1Dzqyt1VhtalE5nXqQnqamisKVuHJomybwzwr6 Gt8VD1e1hMJEbFOz2aIOric5wBH2RTToorRx2YiYWIBc+alfKmMGDJG4BMTfXX61X8 +5fgndZmb+f+0LhwpURmY3ksF5PTDw5qvLyWs9MdvYHSR+/hEQkd+a7sPWlLn3cJfG EQi0jvM1ut6jFy5KEYVrzPxwLXCr4v9+1P7xHZHa4dIK5f/ovwkymcNdf5iy1hSCpZ SvORiCWNxd4Lg== Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id E2F103126E82 for ; Thu, 31 Jul 2025 18:42:53 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-31329098ae8so1094779a91.1 for ; Thu, 31 Jul 2025 11:42:53 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVO9tqslJsJO531jgrFSYbnMrP9pOlNCcrT7KlbKhc293IBHibkGhd2TCpaw5kv29e4blHc@vger.gnuweeb.org X-Gm-Message-State: AOJu0Yxk7l7Bj1sPmT2Y3HdEs1xq0RL1k9m6RTf6ydqYCNqQVEstvRgN vysC1ZSo343DUXsbWpCWpCnI89YDrW762W6RTfAT9xefuWGqXhVl18sTNdg/GN1riGaSlKsrC3v n/soYIBrdD3M4MyIotIvRQZdNNSqH4gg= X-Google-Smtp-Source: AGHT+IEBt06nvyghi4LU4bUvdIGA0VgH/PvZ7drx8EGf2h1WK2Nx1xsDiRVIC0TEHoSN48l5X5yxHJhkicl6Q3LsVdg= X-Received: by 2002:a17:90b:4acb:b0:31e:e066:c81c with SMTP id 98e67ed59e1d1-320da5a792dmr4293961a91.6.1753987372216; Thu, 31 Jul 2025 11:42:52 -0700 (PDT) MIME-Version: 1.0 References: <20250731030856.366368-1-reyuki@gnuweeb.org> <20250731030856.366368-2-reyuki@gnuweeb.org> In-Reply-To: From: Alviro Iskandar Setiawan Date: Fri, 1 Aug 2025 01:42:41 +0700 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXy_uHs5FpGo6DKgGt6tdPYeZomPYaJtYXGBG_Fh-eRD_9s8Fz7NwVc63NU Message-ID: Subject: Re: [PATCH gwproxy v1 1/3] dnslookup: split common functionality and struct into net.c To: Ammar Faizi Cc: Ahmad Gani , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: On Fri, Aug 1, 2025 at 1:36=E2=80=AFAM Ammar Faizi wrote: > On Fri, Aug 01, 2025 at 01:28:22AM +0700, Alviro Iskandar Setiawan wrote: > > On Thu, Jul 31, 2025 at 9:01=E2=80=AFPM 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, uint= 16_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. Ah, ic ic. I didn't know that. So it's fine to keep using glibc's getaddrinfo() to initialize ares? -- Viro