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=1753986517; bh=+EyHb1hzde8n484KQzlB8Z4Qxui8v/QV/3UthlYKjwo=; 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=aw3HlnFrZfpZcZ+p6TRtUHhZTBnBLCX+IIqacqWapLmyic4SNaCph6b5emusCg5kb B/9AOxsH196pZpgs5WmkfnuPey13PSYLt2zxAy/EI8OgZcPletbAeXhWBF5FTgBhJu T4p9ZPXHyrZzTDpdH9n8YeHYIczIzGR0DbHZXZH697BMY1I3bdcsM6649tdZxL4a2i EqPrDwac8vtrQbpCOF9VLVd4jE6kW0jvA8TUjse72TuFCvDSRaFlbjWCOtZM0UVb7/ 8WPAzW1hEcd2KK3fE+P3hTP1bLBc4Pqgnr1b02ccatZm5r03cYxKZFiRIFS+zNlsJa lLDm3xRiS+exg== Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 12ABF3126E9A for ; Thu, 31 Jul 2025 18:28:37 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-31ecd1f0e71so20161a91.3 for ; Thu, 31 Jul 2025 11:28:36 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWr3BsmT1VEZ8n7oIElKOF2K438v3/IVVm5nzpraiaceRnTAHI50FS3ly/VJQi493ppIuuE@vger.gnuweeb.org X-Gm-Message-State: AOJu0YyN6u7Qie+Gnh+7ZW8rQlRC2VCDXY3iYneIN/2EdW8xfL7rHqMX MsdeyUZtIoy6os7jWdabvYzePkgUfQs73c7Cm7vzg3HUgHMNtsIn8RVa6V7Aq72xVIPApFje2ty +biImpQoaqlWwcaEsYi6VGChxMe+28kI= X-Google-Smtp-Source: AGHT+IHrBRK8IDy9khYbE36Z4Al4DIq9dTrRdUrEImfxjZo7QIBmiNmIA2TyrNq3DDdTX3LIL3rV2IhOdTWio1y1T/g= X-Received: by 2002:a17:90b:2d84:b0:312:1ac5:c7c7 with SMTP id 98e67ed59e1d1-31f5de1f1b8mr11473262a91.2.1753986515401; Thu, 31 Jul 2025 11:28:35 -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:28:22 +0700 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXw8FV3UT1yY_XvEx_1Qkn43yg1FJ4iQO8i2vK_6rqO88eggBiZfS7ZEj3k 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 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, 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. Another option would be to make init_addr() private to dnslookup.c because no one else uses it. -- Viro