public inbox for gwml@vger.gnuweeb.org
 help / color / mirror / Atom feed
From: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
To: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Cc: Ahmad Gani <reyuki@gnuweeb.org>,
	"GNU/Weeb Mailing List" <gwml@vger.gnuweeb.org>
Subject: Re: [PATCH gwproxy v1 1/3] dnslookup: split common functionality and struct into net.c
Date: Fri, 1 Aug 2025 01:42:41 +0700	[thread overview]
Message-ID: <CAOG64qMKRd67824bz1xKdPrcovChrf3Z_z9EyXmsFNTFWsX3VA@mail.gmail.com> (raw)
In-Reply-To: <aIu3nL6VPZ/vljCk@linux.gnuweeb.org>

On Fri, Aug 1, 2025 at 1:36 AM 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 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.

Ah, ic ic. I didn't know that. So it's fine to keep using glibc's
getaddrinfo() to initialize ares?

-- Viro

  reply	other threads:[~2025-07-31 18:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31  3:07 [PATCH gwproxy v1 0/3] Initial work for DNS lookup implementation Ahmad Gani
2025-07-31  3:07 ` [PATCH gwproxy v1 1/3] dnslookup: split common functionality and struct into net.c Ahmad Gani
2025-07-31 14:01   ` Ammar Faizi
2025-07-31 18:28     ` Alviro Iskandar Setiawan
2025-07-31 18:36       ` Ammar Faizi
2025-07-31 18:42         ` Alviro Iskandar Setiawan [this message]
2025-07-31 18:53           ` Ammar Faizi
2025-07-31 19:03             ` Alviro Iskandar Setiawan
2025-07-31  3:07 ` [PATCH gwproxy v1 2/3] dnslookup: Allow only port string number Ahmad Gani
2025-07-31  3:07 ` [PATCH gwproxy v1 3/3] dnslookup: Initial work for implementation of C-ares-like getaddrinfo function Ahmad Gani
2025-07-31 18:19   ` Alviro Iskandar Setiawan
2025-07-31 19:14   ` Alviro Iskandar Setiawan
2025-08-01  1:51     ` reyuki
2025-08-01 23:32       ` Alviro Iskandar Setiawan
2025-07-31 13:39 ` [PATCH gwproxy v1 0/3] Initial work for DNS lookup implementation Ammar Faizi
2025-08-01  1:49   ` reyuki
2025-08-01  2:19     ` Ammar Faizi
2025-08-05  6:28       ` reyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOG64qMKRd67824bz1xKdPrcovChrf3Z_z9EyXmsFNTFWsX3VA@mail.gmail.com \
    --to=alviro.iskandar@gnuweeb.org \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=gwml@vger.gnuweeb.org \
    --cc=reyuki@gnuweeb.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox