From: Ahmad Gani <reyuki@gnuweeb.org>
To: Ammar Faizi <ammarfaizi2@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 14:35:28 +0700 [thread overview]
Message-ID: <CAADvAgrzB095duRcVxeTNG3mA0AqZLaJn0m=RvaRTNOWF4i0LA@mail.gmail.com> (raw)
In-Reply-To: <20250829043635.GA654699-ammarfaizi2@gnuweeb.org>
On Fri, Aug 29, 2025 at 11:36 AM Ammar Faizi wrote:
> 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.
Oops, sorry for the oversight. I will replace it.
> > + 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.
The function returns NULL in case of error.
> 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 was not aware of the warning because I compiled it in debug mode.
Thanks for the notice. I will fix it.
> 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.
Okay, I will make sure it's all green first.
> You need to rebase your work on top of b2a7a2d33ba867 ("github: Test
> build with --debug flag"), obviously.
FYI: This patchset is already rebased on top of b2a7a2d33ba867.
--
Ahmad Gani
next prev parent reply other threads:[~2025-08-29 7: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
2025-08-29 7:35 ` Ahmad Gani [this message]
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='CAADvAgrzB095duRcVxeTNG3mA0AqZLaJn0m=RvaRTNOWF4i0LA@mail.gmail.com' \
--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