From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
To: Ahmad Gani <reyuki@gnuweeb.org>
Cc: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>,
GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>
Subject: Re: [PATCH gwproxy v7 2/2] gwproxy: refactor code base to add experimental raw DNS backend
Date: Fri, 29 Aug 2025 11:36:35 +0700 [thread overview]
Message-ID: <20250829043635.GA654699-ammarfaizi2@gnuweeb.org> (raw)
In-Reply-To: <20250829033628.573589-3-reyuki@gnuweeb.org>
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
next prev parent reply other threads:[~2025-08-29 4:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 3:36 [PATCH gwproxy v7 0/2] Initial work on integration of DNS parser lib in gwproxy Ahmad Gani
2025-08-29 3:36 ` [PATCH gwproxy v7 1/2] dnsparser: Add dns parser code Ahmad Gani
2025-08-29 4:39 ` Ammar Faizi
2025-08-29 3:36 ` [PATCH gwproxy v7 2/2] gwproxy: refactor code base to add experimental raw DNS backend Ahmad Gani
2025-08-29 4:36 ` Ammar Faizi [this message]
2025-08-29 7:35 ` Ahmad Gani
2025-08-29 7:39 ` Ammar Faizi
2025-08-29 4:36 ` [PATCH gwproxy v7 0/2] Initial work on integration of DNS parser lib in gwproxy Ammar Faizi
2025-08-29 6:57 ` Ahmad Gani
2025-08-29 7:22 ` Ammar Faizi
2025-08-29 7:30 ` Ammar Faizi
2025-08-29 7:39 ` Ahmad Gani
2025-08-29 7:45 ` Ammar Faizi
2025-08-29 7:36 ` Ammar Faizi
2025-08-29 7:51 ` Ahmad Gani
2025-08-29 8:00 ` Ammar Faizi
2025-08-29 8:06 ` Ahmad Gani
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=20250829043635.GA654699-ammarfaizi2@gnuweeb.org \
--to=ammarfaizi2@gnuweeb.org \
--cc=alviro.iskandar@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