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_DBL_BLOCKED_OPENDNS, 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=1757163577; bh=mVzj3qMyZALCHo97VmX3MbSuymP2uuTz6TmkxtOae0k=; 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=TdQd8Ns/oi90kP5ZQP8HlOj3SrGhRmzP9ohMW9kQNAdHWByaL2+gn8ekSTtOYywZU fDkY4SeyZ8s4gKx/MP9ejV/Tf8xnnnlor+WNfsMmjpRUpxyTvEoIVtmWAY/SmCKEmc jgAfUQOGmcNVL+c9sHX8/+LqsC7qcFzdlr+xeBVLcPeCTh817ZiEbAJl+QV/adyJBr 5dXQjFBQ3axjpMpJnIfYpjbAwbe9pnwmESzUYjqSO5dimarhPxwK0ynMnhvpVtGEAr Aaa4aZkuaH6RQ6u7dco9G4uVWg3r8+a8j50dNZ+AxmhZnz5keu6xH7/DmNf1QLLDAY KZS8lt+R5AO8g== Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 4CCAD31279C8 for ; Sat, 6 Sep 2025 12:59:37 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-55f6abcd26bso4584269e87.1 for ; Sat, 06 Sep 2025 05:59:37 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUfVFdeLe690rYzrKGCKlToEyYxjNdzdIdJtVwF6/V5fDeSYXmm0djvSLF43Ly8S6zQFrFG@vger.gnuweeb.org X-Gm-Message-State: AOJu0YypKChqgaz5EdePX1xqqrljw8tr/VjpGkJkiqOoYTc9yJ9CqXO0 Gc9YojenfRBsMm+6Qd8WMJLQmsE3dDplo0eXuvAjswDSwheOeDCIj76mnKe+c+ElCv1EHQNFTvS 1w77Dc9/V2lJMIWXvASo/VckmP/sC3Vs= X-Google-Smtp-Source: AGHT+IH6d3GzUTTPR11sdGFzRoJ9S5ewZePXX+K3vW1QrTlGIeW42L1+gFUplsn1ZsAZZk6oYX8WM88zFd94JC6bOo0= X-Received: by 2002:a05:651c:418e:b0:336:8dcf:1742 with SMTP id 38308e7fff4ca-3381e706ceamr14009051fa.12.1757163576530; Sat, 06 Sep 2025 05:59:36 -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 19:58:59 +0700 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXxmMCDIHfU2uKxwqu8OzlFpAXgKVFSFViV9YaXviPHwkrI4KqoElmTIyUk 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 6:27=E2=80=AFPM Ahmad Gani wrote: > On Sat, Sep 6, 2025 at 11:32=E2=80=AFAM Ahmad Gani wrote: > (( I'll finish this first before working on the single UDP socket model. = )) Now assuming we are using a single UDP socket, how do we match answers to the DNS queries with the corresponding proxy session? Currently this is achieved by one UDP socket for each query. In the epoll model, when the socket is ready for a particular event, it already stores the pointer to the corresponding proxy session (gwp_conn_pair). And if we are using only one UDP socket for all queries from all proxy sessions, we might not be able to rely on the pointer returned by epoll anymore. So, what are our options in this case? If you want to take a look, I've pushed new commits in the experimental-raw-dns branch [1]. [1]: Now the UDP socket only created once at: https://github.com/realyukii/gwproxy/blob/2b2a85b08b8b178775a064b7e3583540f= 7397956/src/gwproxy/dns.c#L826-L829 and only registered to epoll once at: https://github.com/realyukii/gwproxy/blob/2b2a85b08b8b178775a064b7e3583540f= 7397956/src/gwproxy/ev/epoll.c#L1163-L1171 it can send data over the socket just fine at: https://github.com/realyukii/gwproxy/blob/2b2a85b08b8b178775a064b7e3583540f= 7397956/src/gwproxy/ev/epoll.c#L816-L820 and the question is how we fill out udata upon receiving a response at: https://github.com/realyukii/gwproxy/blob/2b2a85b08b8b178775a064b7e3583540f= 7397956/src/gwproxy/ev/epoll.c#L1102 one option I can think of is to perform some sort of lookup at: https://github.com/realyukii/gwproxy/blob/2b2a85b08b8b178775a064b7e3583540f= 7397956/src/gwproxy/dns.c#L255-L263 after recv, we can use the txid received from the buffer as a key to look up the corresponding key in the array, what do you think? -- Ahmad Gani