public inbox for gwml@vger.gnuweeb.org
 help / color / mirror / Atom feed
From: Ahmad Gani <reyuki@gnuweeb.org>
To: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Cc: Ahmad Gani <reyuki@gnuweeb.org>,
	Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>,
	GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>
Subject: [PATCH gwproxy v5 0/2] Initial work on integration of DNS parser lib in gwproxy
Date: Thu, 14 Aug 2025 11:46:53 +0700	[thread overview]
Message-ID: <20250814044658.252579-1-reyuki@gnuweeb.org> (raw)

Hi Chief,

This is revision v5 of initial work on integration of DNS parser lib in 
gwproxy. This is an RFC draft, the patches itself aren't final.

With current model, the caller is responsible to do the socket part, this
imply unlike conventional glibc's getaddrinfo that handle both socket and
crafting payload inside its abstraction, thus allow AF_UNSPEC, the build
query only craft packet for particular family at a time [1], either
AF_INET or AF_INET6, not both, I see this not as a limitation, but rather
an advantage, most of the time we don't need to request for both IPv6 and
IPv4, but there's still a case where both family is desired, it's often 
happened for fallback mechanism. I'll spend some time thinking about how
to integrate these functions into gwproxy.

# Changelog
v1 -> v2:
- use existing convert_str_to_ssaddr instead of init_addr
- fix memory leak when init_addr (now it's replaced) failed
- modify convert_str_to_ssaddr to support default port
- bring back __cold attribute on convert_ssaddr_to_str
- don't fill a dangling pointer as Sir Alviro said
- for now it's blocking, attempt_retry label is not needed

v2 -> v3:
- remove TODO(reyuki): hints->ai_family is used to filter results
- make gw_ares_getaddrinfo asynchronous by change UDP socket to non-blocking
- move socket creation to library initialization
- make UDP socket unconnected
- restructure internal struct and program execution flow to support async
- update unit test of dns parser
- transaction id creation is delegated to caller
- fix logic bug in serialize_answ that can lead to memory error: invalid read
- rename parameter prt and split commit message
- move variable declaration in for loop according to the Sir Alviro coding-style

v3 -> v4:
- add else block in the convert_str_to_ssaddr function
- use format specifier %hu for uint16_t in printf
- update base commit to branch master from upstream remote repository

v4 -> v5:
- squash commits to eliminate changes unrelated to the commit subject
- change commit subject: use imperative form for the subject
- update base commit to branch master from upstream remote repository
- changing the email subject to depict a turnaround of design changes
- drop the c-ares style thing
- restructure dnsparser.c and dnsparser.h

[1]:
- https://lore.gnuweeb.org/gwml/20250806035727.216702-1-reyuki@gnuweeb.org/
- www.ietf.org/rfc/rfc9619.pdf
- https://stackoverflow.com/questions/4082081/requesting-a-and-aaaa-records-in-single-dns-query/4083071

Signed-off-by: Ahmad Gani <reyuki@gnuweeb.org>
---

Ahmad Gani (2):
  dns: Allow only port string number
  dnsparser: Add dns parser code

 man/gwp_dns_queue.3     |   2 +-
 src/gwproxy/dns.h       |   3 +-
 src/gwproxy/dnsparser.c | 568 ++++++++++++++++++++++++++++++++++++++++
 src/gwproxy/dnsparser.h | 210 +++++++++++++++
 4 files changed, 780 insertions(+), 3 deletions(-)
 create mode 100644 src/gwproxy/dnsparser.c
 create mode 100644 src/gwproxy/dnsparser.h


base-commit: cff091cf6441845c1a8fc56b9e1216bf6cf48dca
-- 
Ahmad Gani


             reply	other threads:[~2025-08-14  4:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  4:46 Ahmad Gani [this message]
2025-08-14  4:46 ` [PATCH gwproxy v5 1/2] dns: Allow only port string number Ahmad Gani
2025-08-14  7:15   ` Alviro Iskandar Setiawan
2025-08-14  4:46 ` [PATCH gwproxy v5 2/2] dnsparser: Add dns parser code Ahmad Gani
2025-08-14  7:28   ` Alviro Iskandar Setiawan
2025-08-14  7:43     ` Alviro Iskandar Setiawan
2025-08-16 16:03   ` Ammar Faizi
2025-08-16 16:30     ` Ahmad Gani
2025-08-16 16:40       ` Ammar Faizi
2025-08-21 16:50       ` Alviro Iskandar Setiawan
2025-08-22  5:43         ` Ahmad Gani
2025-08-22 13:48           ` Alviro Iskandar Setiawan
2025-08-22 19:09             ` Alviro Iskandar Setiawan
2025-08-22 19:52               ` Ammar Faizi
2025-08-23  1:07                 ` Ahmad Gani
2025-08-23  1:52                   ` Ammar Faizi
2025-08-23  2:17                     ` Ahmad Gani
2025-08-23  2:22                       ` Ammar Faizi
2025-08-23  2:20                   ` Alviro Iskandar Setiawan
2025-08-23  2:28                     ` Ammar Faizi
2025-08-24 13:36                       ` Ahmad Gani
2025-08-25 14:37                         ` Ammar Faizi
2025-08-28  0:13                         ` Ammar Faizi
2025-08-28  1:51                           ` Ahmad Gani
2025-08-28  2:29                             ` Ahmad Gani
2025-08-28  2:45                               ` Ahmad Gani
2025-08-28  2:52                                 ` Ahmad Gani
2025-08-28  4:19                                 ` Ammar Faizi
2025-08-28  4:00                             ` Ammar Faizi
2025-08-16 16:41 ` (subset) [PATCH gwproxy v5 0/2] Initial work on integration of DNS parser lib in gwproxy Ammar Faizi

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=20250814044658.252579-1-reyuki@gnuweeb.org \
    --to=reyuki@gnuweeb.org \
    --cc=alviro.iskandar@gnuweeb.org \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=gwml@vger.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