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_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=1756391784; bh=cQcyFAJhB4wfYWlFTdNcmWQpWn7h6tiodods0+qSAF0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: 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=gFWO3eZ0tf/ogQsxcSXLSaBAJADDl+F6MZfn1Gst/0fSRJScdN3aIh2iAE7gsR2jS a/cjv5ftc6XtS3aDV+DST+j1nF8ARvggfHiUWJvDU7YvLTdTlKzUwAA9YeYJOP48cv hY/9vOB7tFStBcjc2CWzfOJzrrKNs2/LsTcfI7Jbtd8Fg0amHJIJbRflTpiRBSvA04 Z4LNUz/SmhDrOET9hovSDDFOe7l6+jnGO8tpplwFQ7uDfcBACYusIR6xm+1dHaWku4 hypxFwDYj4QT/u4LgldTYxzk7cdshYF+0cBs/e6eEXxXqMYVhA58D5FkAy5Z4Q9bkm M5jYqSV5/G/Ug== Received: from zero (unknown [182.253.228.107]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id A7AC23127F72; Thu, 28 Aug 2025 14:36:22 +0000 (UTC) From: Ahmad Gani To: Ammar Faizi Cc: Ahmad Gani , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH gwproxy v6 00/11] Initial work on integration of DNS parser lib in gwproxy Date: Thu, 28 Aug 2025 21:34:22 +0700 Message-ID: <20250828143444.540247-1-reyuki@gnuweeb.org> X-Mailer: git-send-email 2.50.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Hi Chief, This is revision v6 of the initial work on the integration of the DNS parser lib in gwproxy. This is an RFC draft; the patches themselves aren't final. This series has 11 patches; you can skip the rest and focus on the highlighted one: - add DNS server option (remove hard-coded DNS server) - add fallback mechanism for raw DNS - fix DNS parser - mark this feature as experimental and disabled by default - fix minor errors from master branch Thanks for taking a look. # 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 - drop the c-ares style thing - restructure dnsparser.c and dnsparser.h v5 -> v6: - mark this feature as experimental and disabled by default - fix minor issues from master branch - fix dns parser - add dns server as gwproxy' cmdline option - add fallback mechanism for raw dns backend Signed-off-by: Ahmad Gani --- Ahmad Gani (11): gwproxy: Fix syntax error inside assertion gwproxy: Fix socks5 failure on debug mode dnsparser: Add dns parser code dnsparser: remove unused constant dnsparser: Ignore CNAME if any dns: Remove code block related to the usage of glibc's getaddrinfo_a function dns: refactor dns.c to integrate the dns parser dns: revert removed DNS code and disable raw DNS by default test: revert DNS test-case gwproxy: Add DNS server option dns: Add fallback mechanism for raw DNS Makefile | 2 +- configure | 8 + src/gwproxy/dns.c | 240 +++++++++++++++-- src/gwproxy/dns.h | 29 +- src/gwproxy/dnsparser.c | 581 ++++++++++++++++++++++++++++++++++++++++ src/gwproxy/dnsparser.h | 192 +++++++++++++ src/gwproxy/ev/epoll.c | 69 ++++- src/gwproxy/gwproxy.c | 57 +++- src/gwproxy/gwproxy.h | 5 +- 9 files changed, 1132 insertions(+), 51 deletions(-) create mode 100644 src/gwproxy/dnsparser.c create mode 100644 src/gwproxy/dnsparser.h base-commit: 2a53c0e3694a88331fc6fd9a6793c01dc37c27f9 -- Ahmad Gani