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=1756442200; bh=fSCT4ZtTU2Zp0dyth/grMJu2FqfI7eqRigHkowECQE8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Transfer-Encoding:In-Reply-To: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=rpJ0PvMKZAJp7ls+k7n8JGbgNye5q3BMDInp2diV9gMcy084ozLx5cJMtGpaJpzGm /ZmVfeACnD9LX2wyIKUk1uO2gvLV69b8HGPon9zF3GZBvrRkDiyoqfHWSJ+1TmtXid cUveo3L49Y0UIum5l3Irx7Mal/OxRg/nHFAFId+GuBzJN4/0Y02c790UdkTZ/29w0p a8ndUXIlyVvUbP0KRswaLJBA1Gm3W2fZvm4ptGtG8R3ZHma1TnvQavOKvLrsF1w8Vk SiXlBpPZ+A+lT4BOzyFNnBokex0OJ80UHL6X59VJiGyzQUGhpe9V26sfhf9dtjnIGM o1fuc38LMGe+Q== Received: from linux.gnuweeb.org (unknown [103.216.223.55]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 571AF3127ED5; Fri, 29 Aug 2025 04:36:39 +0000 (UTC) Date: Fri, 29 Aug 2025 11:36:35 +0700 From: Ammar Faizi To: Ahmad Gani Cc: Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: Re: [PATCH gwproxy v7 2/2] gwproxy: refactor code base to add experimental raw DNS backend Message-ID: <20250829043635.GA654699-ammarfaizi2@gnuweeb.org> References: <20250829033628.573589-1-reyuki@gnuweeb.org> <20250829033628.573589-3-reyuki@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250829033628.573589-3-reyuki@gnuweeb.org> X-Gw-Outgoing-Server-Hash: 01afd303c8b96d0c1d5e80aa96a4ee40ec69888f786fa24107c0862c0644af79 X-Gw-Message-ID: f66e2c0673c309173f11a2dd2f05263b1f1bfcc3aa293aef9966af3fbb359297 X-Gw-PM-Hash: 213f23c8a78e5e97f7487349a9477b383c89af6bc7f4f4c77d0f0a4495621c26 List-Id: On Fri, Aug 29, 2025 at 10:36:25AM +0700, Ahmad Gani wrote: > + close(e->udp_fd); Again, please use __sys_close() instead of close() for all code in src/gwproxy/. This rule applies to future patches too. > + default: > + assert(0); > + break; > + } > + > + txid = (uint16_t)rand(); > + r = gwdns_build_query(txid, name, af, e->payload, sizeof(e->payload)); This part is problematic when compiled without debug mode because 'assert(0)' is actually a macro that does nothing when compiled with -DNDEBUG. The compiler says: gcc -ggdb3 -rdynamic -O2 -fpic -fPIC -shared -o libgwpsocks5.so src/gwproxy/socks5.c.o -lpthread -lanl src/gwproxy/dns.c: In function ‘gwp_dns_queue’: src/gwproxy/dns.c:969:21: warning: ‘af’ may be used uninitialized [-Wmaybe-uninitialized] 969 | r = gwdns_build_query(txid, name, af, e->payload, sizeof(e->payload)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/gwproxy/dns.c:937:13: note: ‘af’ was declared here 937 | int af; | ^~ I suggest to return -EINVAL instead of break. Don't forget to free associated resources if needed. You can keep assert(0) for the debug mode. Keep in mind that assert() is a macro that disappears entirely when compiled with -DNDEBUG. I have added a GitHub CI build using './configure --debug' to cover breakage for both non-debug and debug build cases. You can push your changes to your GitHub fork and make sure everything is green before sending the patches to the list. You need to rebase your work on top of b2a7a2d33ba867 ("github: Test build with --debug flag"), obviously. -- Ammar Faizi