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=1756452966; bh=7C9FU39/Bm36XpWCHJ7gVXUjxs7N4V03skBcDkALZtA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type: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=di6R9yCcERlQO7z08Puupt04BSiKdagzFq+iIaFNmCkX/YxCxoOinqQleHMwR1odZ 7xQLAZk7dv9EqBS4CiSkUxBl205CxH11GPRRSNaunrg72qTOWy8j23jacIQBsw9cPV Pd6dBEq8ADNSQlI02TdT5ppgiHs+D6ma5t9FvwGq9lA4Gd0vFiPknXrDxDpkwtl4lE uATN38GgORxYDxSAiVIGUMUDM92keaUXnZG07Prero86x96GDolZ4QpFHRp5pITF7V GksdyH90bmPrf6/9RiV3qv5E3hhoba7pdXCHecWAomjdhyCxsJskBERjsf07B9xwxk oBz+vPVp5kprA== Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 11ABE3127F77 for ; Fri, 29 Aug 2025 07:36:06 +0000 (UTC) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-55f6b0049fbso147195e87.0 for ; Fri, 29 Aug 2025 00:36:06 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVhqY/hBTvfrXz+TuAvMGlc7DxU2eoh+qDba6TdYbPeHj/wygobFCWPY8GdeZDCjRQeHfyn@vger.gnuweeb.org X-Gm-Message-State: AOJu0Yzq7Af5A8Xyk8LLdTlx/rEI7gQlQDZMj+rQBBJn3RUKqka5bEdt bWTvD8g7dWLGtv6QNOU8rBDkXTGrZoMGpT5rrv16pURyPn3l/n8h3y7BpK6nMjcfZWZSqTxgPfq 0bHXg0I+PnN4h+KqBtEzC437zgE5yjOk= X-Google-Smtp-Source: AGHT+IHMK3o+Mt80wCgr/21Hqt/qZhcgExFXh1QllYqZcd27aaOCvE/eREOn2sATW5zOKDfy+FZo9/y1+OL6UFeb1tk= X-Received: by 2002:a05:6512:6819:b0:55f:4926:df1c with SMTP id 2adb3069b0e04-55f4926e2e4mr4241361e87.46.1756452965449; Fri, 29 Aug 2025 00:36:05 -0700 (PDT) MIME-Version: 1.0 References: <20250829033628.573589-1-reyuki@gnuweeb.org> <20250829033628.573589-3-reyuki@gnuweeb.org> <20250829043635.GA654699-ammarfaizi2@gnuweeb.org> In-Reply-To: <20250829043635.GA654699-ammarfaizi2@gnuweeb.org> From: Ahmad Gani Date: Fri, 29 Aug 2025 14:35:28 +0700 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXz4B9M2Jv6-0Orwty-bhaFjbP4_hb3TlB1Wqn1fKepzRuceG1zPypGPkjw Message-ID: Subject: Re: [PATCH gwproxy v7 2/2] gwproxy: refactor code base to add experimental raw DNS backend To: Ammar Faizi Cc: Alviro Iskandar Setiawan , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: On Fri, Aug 29, 2025 at 11:36=E2=80=AFAM 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 =3D (uint16_t)rand(); > > + r =3D gwdns_build_query(txid, name, af, e->payload, sizeo= f(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/gwp= roxy/socks5.c.o -lpthread -lanl > src/gwproxy/dns.c: In function =E2=80=98gwp_dns_queue=E2=80=99: > src/gwproxy/dns.c:969:21: warning: =E2=80=98af=E2=80=99 may be used uni= nitialized [-Wmaybe-uninitialized] > 969 | r =3D gwdns_build_query(txid, name, af, e->payl= oad, sizeof(e->payload)); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~ > src/gwproxy/dns.c:937:13: note: =E2=80=98af=E2=80=99 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