From patchwork Mon Sep 23 13:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "ralf_lici (Code Review)" X-Patchwork-Id: 3857 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:10cd:b0:5b9:581e:f939 with SMTP id j13csp2171977mae; Mon, 23 Sep 2024 06:41:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW8EkKmU0+58pS8Obvq7N9Dw8gips8VFMWQVVMcalh8sJe3aEI4/i1nKZ5EpTwlAiKTtG6464aZgeE=@openvpn.net X-Google-Smtp-Source: AGHT+IHl5ahXSf+I/7/ctsZuSOGEeEGwhjUcC0j3vJjLnuwpQ/LXLxWrAZI2Xqc1UDc0t6xKX+3W X-Received: by 2002:a05:6808:221c:b0:3e2:64cf:2d1b with SMTP id 5614622812f47-3e271b910b8mr8582458b6e.3.1727098901691; Mon, 23 Sep 2024 06:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727098901; cv=none; d=google.com; s=arc-20240605; b=iDj9gT96R+nmTSPihdt8EuTr3LUsAMLErh5AP19U69MRdCqB1S7VFZrdebqVShND0c 8wsxd8KCYKLYrIta7E2f21Ke/OwSECYCIgGAhgVkQnuIcyURvE9akt00bVjp+Z1d1C2h NjOxTDfaAjASFFdtjYEbd3RVYyg/RPJ/K8xgkcQfNKFLqovZqV0TCYOSnG2NIRaONAI8 J+5s51bXrEwwbY2MgL9fSV0j4AALqEeiasPeyhFzNw9WcLFlwydqHhNbdd4bxBizl8Qj PbyIXFFly3hpWONup3Q2ojloHOaF65KfBot1OmI0kroc2xBQNNjIqfjV1LaEjHPYnZfc Hm0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=Daj4Xu3I588u0z64aQS0Oyb4lT1BnTce3TJ6lhqxBGc=; fh=U7wEyxtwz2o5+UdevFSA47vNeG9knhWH0KV//QhD5a0=; b=lFo235/AVj16BKHveo0ZeteY3+ZyAM257p2OdZxLst7Ha82hJcKJIBV8euhHe4MFgL /S46zptBQErLxfz5NqaeONYshlfaDHXrESrIfze/T5/Tg6iL9H9LRUdcew74Z6dd11z0 fjRxG20GWKL4svlfxbUFQ3mL9XIxxXfOsgK8VRzaBnVAW6R4sedmOgpIWbovPZ8IiU0b VQQd/117UYOvGFiZAWyq4Z2u1U2494jSzQGPCVExfqpC/H+oNHbTOvV1h+5LcvU7rdte Jl1nP5ufLj+LLRTJmuR9BF+yoAb7/ETrVo/IKYD5QWq9FkAANAkr7nnw1C3N5r3tlojZ fFbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=nN92nrK1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ki0yitpQ; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Xnaf0WaF; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net; dara=fail header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-3e26b70eba1si4190752b6e.233.2024.09.23.06.41.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2024 06:41:41 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=nN92nrK1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ki0yitpQ; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Xnaf0WaF; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net; dara=fail header.i=@openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1ssjJo-0008Ql-D3; Mon, 23 Sep 2024 13:41:35 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ssjJn-0008Qd-DX for openvpn-devel@lists.sourceforge.net; Mon, 23 Sep 2024 13:41:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=NwgwY9PvchHolwZ8qjIrLd0lNn5VqZTN7/gsu5EaHXs=; b=nN92nrK1Gzv2dlK3pUcM6vBjuq BfEqXmmyW1SNuuaUJY0wppinIuCDK6KMEPI+YxHEO7YC/Q6xi7dwL/v+WNlKgjoOMWFzE2DUw55lg cn9ck4Yjavs+NV53oy4xg/0H484tihgH+crY6nIu0+x18aWaPmn4abBeUtPi68xDyAL4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=NwgwY9PvchHolwZ8qjIrLd0lNn5VqZTN7/gsu5EaHXs=; b=k i0yitpQnZ95mmwwwb5MEu4PXd1OIEhnaaXZZzXUV2ckJTWB5xwXjKrbHkTfH33BD+3PhbeF1myHQc ytMPEqM2d9hdGwHhn8Qz3gflW8ImBkCN/lqUG/gltkk+1wua0logqBbWCCwKdKThJaVUVVv9u7b0J ZAVnY4YoosREKsQk=; Received: from mail-wm1-f43.google.com ([209.85.128.43]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1ssjJl-0006qJ-Gs for openvpn-devel@lists.sourceforge.net; Mon, 23 Sep 2024 13:41:34 +0000 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42cb57f8b41so56523625e9.0 for ; Mon, 23 Sep 2024 06:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1727098881; x=1727703681; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=NwgwY9PvchHolwZ8qjIrLd0lNn5VqZTN7/gsu5EaHXs=; b=Xnaf0WaF7K98qNj/9EBYMOB5vQMdxARSDHQV7WHc4SFa5cmzmblTXqUMWbsWkVttEC NlJMYxIOg2lfE6qs6gS64gbbaTM/Z3xRiA1g9pHDj7rGK4wN+3UlS++1Bg7+XOQeIsqo gN/3AOljasC9uZ+TCDQb3UlxnQ1OrGPkBuX6FziJYH9AofewKTNZqSHjXZGwGofj7JoQ uLPfzWpWk0lfEqbF//kWcGDVH0t70w/eAQby+fdmQhs9SQXhE3Ttd+116unPyCHlqxiD RnbtVaFjNtmMtexkk7er2EBFRe4O9uX5cgs4yTSBNflU5O177sRqlqWu4886FGEBkjdW vBow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727098881; x=1727703681; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NwgwY9PvchHolwZ8qjIrLd0lNn5VqZTN7/gsu5EaHXs=; b=dYNPOQW0rxqwFxxkspXjT6PEwIuh6IV3XcoLHYiF4z5EViP6nHJSUW+qq4dwU1zYfZ b/uPLEtqC+t6aTOwyAYKHccnVrnWFSnrvRl5ewVLO7/dAUcQ8ULYOaPOMLlvXm+20Zho FV9O5XkrY10so7CgiT56A3D2x4kVglQ8MD4dmmtiogclI3ZCuKBAq4GVTTn3E2MQlUPc /or1WYu3yx8sGhgmaqISljzcEMo9W90XROKzGYo8wP3I0Whk/m4/7q67rIv02ZsGlcQL zgxOhdfkonezKg8C2zzPm7ARfCGRPhxwc0Hs99Nob7VJHA5BjOjANpBVR35awapAXU55 eWug== X-Gm-Message-State: AOJu0YwZAsgiTbDdnI50Q3Uv4bx3QRoub15oFtMnP73A4MEywWVmtnC6 wrWUJ1T22Ytglf7l4McU9CQND5aD0d9VqP0PF7lk4V+vWy1XDFGwgy8fZwTTdXs= X-Received: by 2002:a05:600c:190e:b0:42c:b555:43dd with SMTP id 5b1f17b1804b1-42e7abe4184mr127940885e9.3.1727098880644; Mon, 23 Sep 2024 06:41:20 -0700 (PDT) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e7affca44sm100978705e9.46.2024.09.23.06.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 06:41:20 -0700 (PDT) From: "its_Giaan (Code Review)" X-Google-Original-From: "its_Giaan (Code Review)" X-Gerrit-PatchSet: 1 Date: Mon, 23 Sep 2024 13:41:19 +0000 To: plaisthos , flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089 X-Gerrit-Change-Number: 759 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 721b4375dc4b0709d9ec9bc2d024f2602939453d References: Message-ID: <21db2574ae6d8f0857e3cfca56b85c0764a45d68-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -1.1 (-) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attention is currently required from: flichtenheld, ordex, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-1.1 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.43 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.9 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.43 listed in wl.mailspike.net] 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1ssjJl-0006qJ-Gs Subject: [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: gianmarco@mandelbit.com, arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com, a@unstable.cc Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1810994458080203397?= X-GMAIL-MSGID: =?utf-8?q?1810994458080203397?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld, ordex, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email to review the following change. Change subject: io_work: convert shift argument to uintptr_t ...................................................................... io_work: convert shift argument to uintptr_t Instead of passing the shift argument as pointer, pass directly its integer value. This will allow the code to distinguish a shift value from a real object pointer, like we already do in multi_tcp_process_io(). This change will allow us later to pass an event_arg object as event handler argument instead of a simple integer value. Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089 Signed-off-by: Antonio Quartulli --- M src/openvpn/forward.c 1 file changed, 12 insertions(+), 14 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/1 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 16b4497..1247ba3 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -2050,20 +2050,18 @@ unsigned int tuntap = 0; struct event_set_return esr[4]; - /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2) - * and are added to the shift. Check openvpn.h for more details. - */ - static int socket_shift = SOCKET_SHIFT; - static int tun_shift = TUN_SHIFT; - static int err_shift = ERR_SHIFT; + /* These shifts all depend on EVENT_READ and EVENT_WRITE */ + static uintptr_t socket_shift = 0; /* depends on SOCKET_READ and SOCKET_WRITE */ + static uintptr_t tun_shift = 2; /* depends on TUN_READ and TUN_WRITE */ + static uintptr_t err_shift = 4; /* depends on ES_ERROR */ #ifdef ENABLE_MANAGEMENT - static int management_shift = MANAGEMENT_SHIFT; + static uintptr_t management_shift = 6; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */ #endif #ifdef ENABLE_ASYNC_PUSH - static int file_shift = FILE_SHIFT; + static uintptr_t file_shift = FILE_SHIFT; #endif #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) - static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */ + static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */ #endif /* @@ -2077,7 +2075,7 @@ */ if (flags & IOW_WAIT_SIGNAL) { - wait_signal(c->c2.event_set, (void *)&err_shift); + wait_signal(c->c2.event_set, (void *)err_shift); } /* @@ -2171,7 +2169,7 @@ * Configure event wait based on socket, tuntap flags. */ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL); - tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL); + tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL); #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) if (socket & EVENT_READ && c->c2.did_open_tun) { @@ -2182,7 +2180,7 @@ #ifdef ENABLE_MANAGEMENT if (management) { - management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL); + management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL); } #endif @@ -2190,7 +2188,7 @@ /* arm inotify watcher */ if (c->options.mode == MODE_SERVER) { - event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift); + event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift); } #endif @@ -2233,7 +2231,7 @@ for (i = 0; i < status; ++i) { const struct event_set_return *e = &esr[i]; - c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg)); + c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg); } } else if (status == 0)