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=1757156527; bh=aNT6fbcf95FKHBCtntzbiYsRstTs3JX0pXyg/eUzNyc=; 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=VacqO4QOXFYicWXjPl5VIq/Q8N56zmtJbw1clVW66FP9x72WvGQbDrHDhQLYJGGIi yqpCfXzvAHfPOQBA/uNxLtks43uXBEPYBy1KBm9X+kX8SZiKGNb2KwNBNNxsmzf/KB whqimk0TENnmAbhwz1oDMwM4IrW76UsL4Tjb/St0f6agyozwe/Ws+y7OE2laaB8niV q2kovG1N2+DKXhcM5mJZLn65qldtYI4O20WoCg79aY9V2eNx6cQYfn/+W7L297U1V0 OqmfsNkP2cESRonabK6IkCyR+ibZ2zYKEbv2oiq9ctsUMxWAXGq2J+vqtrXzK9EQQx yd7Czg0+66Gvw== Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 0D6A431278FB for ; Sat, 6 Sep 2025 11:02:07 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-336e16f4729so23013371fa.1 for ; Sat, 06 Sep 2025 04:02:07 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUV0jo5UYRuhnPxBfLPJdqHQ/fWgc0L1ltn3G0iV9NDCiVFKhKtV9ZRPlE3cUwhfs9fZhh7@vger.gnuweeb.org X-Gm-Message-State: AOJu0Yx4SMlUmiTn1ppUgJMF3HZ61s9A9u76CUkKz7Ll7s4GUd5bxp7c LBNkKwX+gcrN9MzXUpVWP3wIk6llJ+Q3A1Icr6iA0MnRNt3v8Rzz/MQyeePhxC89P6D2W1Az1dO EYUQQdRO8bHTsVEcA8eP9WmZVXy41+fs= X-Google-Smtp-Source: AGHT+IEApzN205krtIdL3o9BLWg5NLF1kWGLfWYamAok+pn8eLV8fWl/heK/5sVmENfLkt1A6T/mXKpaPCR6eu9TeKs= X-Received: by 2002:a2e:a36f:0:b0:338:875:bed3 with SMTP id 38308e7fff4ca-33b5738bca4mr4317121fa.36.1757156526379; Sat, 06 Sep 2025 04:02:06 -0700 (PDT) MIME-Version: 1.0 References: <20250829075557.598176-1-reyuki@gnuweeb.org> <20250829075557.598176-3-reyuki@gnuweeb.org> In-Reply-To: From: Ahmad Gani Date: Sat, 6 Sep 2025 18:01:29 +0700 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXyrysMEo_WoL8F5ptYEdb0TFQX4stz2Mikn1PdljjxCMqZjMi-uAaynxg8 Message-ID: Subject: Re: [PATCH gwproxy v8 2/2] gwproxy: refactor code base to add experimental raw DNS backend To: Alviro Iskandar Setiawan Cc: Ammar Faizi , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: On Sat, Sep 6, 2025 at 2:47=E2=80=AFPM Alviro Iskandar Setiawan wrote: > On Fri, Aug 29, 2025 at 2:56=E2=80=AFPM Ahmad Gani wrote: > > +#ifdef CONFIG_RAW_DNS > > + if (ctx->nr_entries =3D=3D ctx->entry_cap && realloc_en= tries(ctx)) > > + return NULL; > > + > > + r =3D __sys_socket(ctx->ns_addr.sa.sa_family, SOCK_DGRA= M | SOCK_NONBLOCK, 0); > > + if (r < 0) > > + goto out_free_e; > > + e->udp_fd =3D (int)r; > > + > > + switch (ctx->cfg.restyp) { > > + case GWP_DNS_RESTYP_PREFER_IPV4: > > + case GWP_DNS_RESTYP_IPV4_ONLY: > > + af =3D AF_INET; > > + break; > > + case GWP_DNS_RESTYP_PREFER_IPV6: > > + case GWP_DNS_RESTYP_IPV6_ONLY: > > + af =3D AF_INET6; > > + break; > > + default: > > + assert(0); > > + goto out_close_fd; > > + } > > + > > + txid =3D (uint16_t)rand(); > > + r =3D gwdns_build_query(txid, name, af, e->payload, siz= eof(e->payload)); > > + if (r < 0) > > + goto out_close_fd; > > + e->payloadlen =3D (int)r; > > +#endif > > Back to this section again. Isn't one of the advantages of > inventing your own DNS resolver is also to avoid opening and closing a > UDP socket for each DNS query? This design feels wrong, the txid here > means nothing if each query has its own UDP connection. Can't you use > the same UDP socket for all queries? Mhmmm, you have a point; I'll give some thought to the single UDP socket approach. -- Ahmad Gani