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=1757826587; bh=JR+bL4lRBmGZzP7dNJ2aa/i3zT0LFWyzC6KPIvEyi/8=; 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=PlVVMbWj7c0Tjp+T4AbTjmRkcB+Ybx/iHPabbaaTDDTgnTFJlqDOs6T1xg6izgsAO KLcsk4VOCLa+Xc5YWEEhYLecmHiD9pAviupBVXcXJTfjSGj/j00tTSPcfryBd6HdcT NdldE4fabrt+BKah2q01TRtrQKXXLm9HebX/BMu9MhrxicONy/iqyjHFoALkSGXnKd AgFW1vgf3STthrtC0G3H32RMLUkZt/1k2xmm/bqAxzpi6NittxC9y9D756DFDKOqyI qM0rNYRkSetjcYCx0K9Q12+nuviA/zO9pUb8r37xqHFRHXW7FIqGpRB3gJKJASQPzv H2B9S1J8LwVmQ== Received: from zero (unknown [182.253.228.107]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 7993831279C6; Sun, 14 Sep 2025 05:09:46 +0000 (UTC) From: Ahmad Gani To: Ammar Faizi Cc: Ahmad Gani , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH gwproxy v11 0/6] Initial work on integration of DNS parser lib in gwproxy Date: Sun, 14 Sep 2025 12:09:34 +0700 Message-ID: <20250914050943.184934-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 v11 of the initial work on the integration of the DNS parser lib in gwproxy. There are 6 patches in this series: - Use __sys_close instead of close - Define __maybe_unused macro - Add dns parser code - Refactor code base to add experimental raw DNS backend - Update Makefile and configure scripts - Reduce #ifdef CONFIG_RAW_DNS Please give it a test, and 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 v6 -> v7: - squash commits - refactor gwproxy codebase (specifically, DNS system) - add dns parser code v7 -> v8: - use __sys_close instead of libc's wrapper close - add newline at EoF - fix warning: 'af' may be used uninitialized [-Wmaybe-uninitialized] - remove break that occured after goto statement v8 -> v9: - use a single UDP socket for each gwproxy worker - expose gwp_dns_ctx members to other source files - apply revisions from Sir Alviro's review - apply proposals from Sir Alviro and Sir Ammar v9 -> v10: - fix realloc issue v10 -> v11: - split patchset into more managable patches - Use __sys_close instead of close - Define __maybe_unused macro - Add dns parser code - Refactor code base to add experimental raw DNS backend - Update Makefile and configure scripts - Reduce #ifdef CONFIG_RAW_DNS Ahmad Gani (6): dns: Use __sys_close instead of close gwproxy: Define __maybe_unused macro dnsparser: Add dns parser code gwproxy: Refactor code base to add experimental raw DNS backend gwproxy: Update Makefile and configure scripts gwproxy: Reduce #ifdef CONFIG_RAW_DNS Makefile | 2 +- configure | 8 + src/gwproxy/common.h | 4 + src/gwproxy/dns.c | 271 +++++++++++++++---- src/gwproxy/dns.h | 52 +++- src/gwproxy/dnsparser.c | 583 ++++++++++++++++++++++++++++++++++++++++ src/gwproxy/dnsparser.h | 192 +++++++++++++ src/gwproxy/ev/epoll.c | 140 +++++++++- src/gwproxy/gwproxy.c | 189 ++++++++++++- src/gwproxy/gwproxy.h | 84 ++++++ 10 files changed, 1455 insertions(+), 70 deletions(-) create mode 100644 src/gwproxy/dnsparser.c create mode 100644 src/gwproxy/dnsparser.h base-commit: b1e70e468bab135a14a8faee3ea535ace9eac211 -- Ahmad Gani