From patchwork Mon Sep 23 13:41:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "flichtenheld (Code Review)" X-Patchwork-Id: 3863 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:10cd:b0:5b9:581e:f939 with SMTP id j13csp2173938mae; Mon, 23 Sep 2024 06:45:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVoVZNVNsVLLJPZ2BdyA/qm7xGIxgtj97w6WPsGERYLBHiEfsL2QhD+eHGMAaF5kiPmo6eOPRhiQH8=@openvpn.net X-Received: by 2002:a05:6602:15c2:b0:82b:42f:41d5 with SMTP id ca18e2360f4ac-83209e8f531mr966098839f.16.1727098893852; Mon, 23 Sep 2024 06:41:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECGjtqndeJpwDceTPb2ybTrGHNpysLKO+YJ624+izVzqxswm2k7tZ1kl+3yNhvKMaR6NXE X-Received: by 2002:a05:6602:15c2:b0:82b:42f:41d5 with SMTP id ca18e2360f4ac-83209e8f531mr966085639f.16.1727098892104; Mon, 23 Sep 2024 06:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727098892; cv=none; d=google.com; s=arc-20240605; b=ekVTGkCGt3ry8TPOmKli26odD5GiKKGzTVR0W7AHwgZuzYJKKsVMTIeYmj6211uOy5 ycFUmhF4z+a4KvfpMdEVLKWQ6jw8u+sY2gdWSvPnH7Dnn8DTRe9LsJvLlIDCYra0C6g7 PD/SlvtHzVGAK/y568lepaQ7rsu1+8q5THpcn4b5xACsvbhnFrRBmzv9MheWPMSfrseG 5PDu7wI+l9yKL0UTuPxe4zl3EEQQpVUx4fAJpjRg1e132rHbboJC3b7x3GR1pPxHs0tH HTEU4hl2JG1dofaTRurto1+5tAYwywfDgdrLVKRusiKQQgA2Mey292DFgtNYkiUf89De dntQ== 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=HdhpvResUNMXfgqPds9S5C9pwxYArisLLyiBYLdwgIs=; fh=U7wEyxtwz2o5+UdevFSA47vNeG9knhWH0KV//QhD5a0=; b=Dxmtj/9r8a8taK9374IEnx3KHZESswLtUmhu+YEdPis+iCwUYCNuKw0a9mGqMwGwGA ZGIYwH898ldzwlMgFcdeO+BGOSX6ce1B2FZoMo/bngovuO1q4CBduYH/JPFDUrsGB9wf lHtZd0DfIu4zjLz62jkPg1J/KkI9UQNTnQuEJ894T9MnozksdyeZVkWAFRmX1KVVNOfy pdvuvkaSSQ7slb4zxpR/puklQ7vLWdAbpUSk7FMgg46QcY1qHJBFLsmodYf9Q9s9U9kJ 6WVNTJtNDLjnTWT5iYcH/GjYdYEEeEWh9roYgVhqioEB9ivmCXTgCWuef1uDEkKz+9Y0 UkbQ==; 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=R++90JJG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=YC0LtvAk; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=eOfUz9a7; 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 8926c6da1cb9f-4d37ebe00fcsi9175953173.4.2024.09.23.06.41.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2024 06:41:32 -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=R++90JJG; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=YC0LtvAk; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=eOfUz9a7; 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-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1ssjJd-0007jS-3G; Mon, 23 Sep 2024 13:41:25 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ssjJc-0007jL-52 for openvpn-devel@lists.sourceforge.net; Mon, 23 Sep 2024 13:41:24 +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=0Y5rFMgaB2dXcv7O0QPJpzKDAQio8miSiyxfbZcp/bI=; b=R++90JJGb8bpObY92U3Uqf1NsR IO3G5uCLdfJhV+UTO0na7AAPeVf/fS0N0rS5r+uofZctKfN3oKidEands5IXUxP52ZGem2WcB+djc 7Opeaok/EhOvqezM/q45fzvtzNq6Mw7OJUighZj40Eh9kn4QXhpyguqA5RoDWlK4OMdI=; 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=0Y5rFMgaB2dXcv7O0QPJpzKDAQio8miSiyxfbZcp/bI=; b=Y C0LtvAkNKuD1Sx/wnjmW+4JKGyrAKPPWmgkkZg4aWaiagSQQ14f50UlbS/v1gMJ+nHrJoSvEVCYdh oGUi3Vu45qVNDn6nWYH34M1LfddnL7qi0zKJnA/R3kZ5e4ZUNEMHbCaLJZHcZRr/bTikB6JQ1ZJ6D ukgfYhGYVRPq78dM=; Received: from mail-wm1-f44.google.com ([209.85.128.44]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1ssjJb-0006pe-17 for openvpn-devel@lists.sourceforge.net; Mon, 23 Sep 2024 13:41:24 +0000 Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-42cae4eb026so42665065e9.0 for ; Mon, 23 Sep 2024 06:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1727098876; x=1727703676; 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=0Y5rFMgaB2dXcv7O0QPJpzKDAQio8miSiyxfbZcp/bI=; b=eOfUz9a73KB0qwowWDLsmo2HK9Yl5ehfhsN5mUHDP3TzcYKjm9zEHTpVHiGplnTiCa qJyhcNxU1qP4xbTtC0rg+gu070r4nEfMfW6twLd14+qUaF7OCYSdnHlfHLZUDzCRdrG5 X6yusofP0pPCyBRCCEpSsCrn+Etp1YrdqeYNPsYajO+XLK6Sc1UGF8xDulKNNJP7MGnL 9oNInkhvzToB5JSN4xjvk2Ydj9FYA7oH2O4z5jwunKMD53x/mBBPZ9NMXl44DU01xSr2 IEhXFR1wAePuCNo0OGxXFfBxQtpVRnLjDT4wJYjY+TVTb60Yh/BKtA68TT3scSJc4ZmQ w8Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727098876; x=1727703676; 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=0Y5rFMgaB2dXcv7O0QPJpzKDAQio8miSiyxfbZcp/bI=; b=I8VytNklmOa7Ft/aHGnRQG9q0UxCZ1Ffvcq9f4NKUxxCHhUtJeKrXrjsQgGaGd6j6W V/cGMe6x5eZvuWsnZfY9TsgjE7IaV2MTEts2qUq6gf+9xopgH64ICC0rQhvLbnpw6T/v 6pVHS4t4qnR4m3ZZTlAUWBhXFooQNRBC5Wr+tOwSQURy2xH6GQhh1znL+vCKX4i4TVyk 0W/XG5LpIGOJCEMV7lWHRmstfegEEExrpdN4n8ZXdlXOclH7t/lLtw6thLJJ412sepcC 3IM2T4MLlKG9w9c6eIv1DQr2LCRlHF7eqnqxzKNLQQdpt1GLVgIf7AzujhNKjdqeLQnD DcSA== X-Gm-Message-State: AOJu0Yw2ULCjizTcRB07N5PAAxJB4JH6jzyyV5CWi8PIYcgdx4LNKHWt rdV7XrT3PLYm0EldlbkHvFjnDXeVfFgT/nYteTk96quJzYsqkGqVsJPLFtuxnkl5szihJSmKmY6 t X-Received: by 2002:a05:600c:4fc8:b0:42c:d084:ed7e with SMTP id 5b1f17b1804b1-42e7c159b9bmr77168285e9.4.1727098876245; Mon, 23 Sep 2024 06:41:16 -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-42e7affca44sm100977175e9.46.2024.09.23.06.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 06:41:15 -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:15 +0000 To: plaisthos , flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I8eae2d3356bbcc5d632eeb4fbe80de8009d9b40d X-Gerrit-Change-Number: 758 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: d3dd4e11a8ae9809fed45fbb4fac72950accc34b References: Message-ID: <3d50cbad3bd2690fa9ce4171bfdabe5f39b17553-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-1.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 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.44 listed in list.dnswl.org] -0.9 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.44 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 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: 1ssjJb-0006pe-17 Subject: [Openvpn-devel] [M] Change in openvpn[master]: pass link_socket object to i/o functions 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?1810994447718945481?= X-GMAIL-MSGID: =?utf-8?q?1810994447718945481?= 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/+/758?usp=email to review the following change. Change subject: pass link_socket object to i/o functions ...................................................................... pass link_socket object to i/o functions In order to prepare the code to work with distinct sockets, it is essential that i/o functions do not operate on any hard-coded socket object (i.e. c->c2.link_socket). This patch changes all the low-level i/o functionis to work with a socket specified as argument rather than a fixed one. Change-Id: I8eae2d3356bbcc5d632eeb4fbe80de8009d9b40d Signed-off-by: Antonio Quartulli --- M src/openvpn/event.h M src/openvpn/forward.c M src/openvpn/forward.h M src/openvpn/mtcp.c M src/openvpn/mudp.c M src/openvpn/multi.h M src/openvpn/openvpn.c M src/openvpn/socket.c 8 files changed, 44 insertions(+), 36 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/758/1 diff --git a/src/openvpn/event.h b/src/openvpn/event.h index 844ea7b..57341e0 100644 --- a/src/openvpn/event.h +++ b/src/openvpn/event.h @@ -137,6 +137,7 @@ event_arg_t type; union { struct multi_instance *mi; /* if type = EVENT_ARG_MULTI_INSTANCE */ + struct link_socket *ls; /* if type = EVENT_ARG_LINK_SOCKET */ } u; }; diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index a88a4bb..16b4497 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -883,9 +883,9 @@ */ static inline void -socks_postprocess_incoming_link(struct context *c) +socks_postprocess_incoming_link(struct context *c, struct link_socket *ls) { - if (c->c2.link_socket->socks_proxy && c->c2.link_socket->info.proto == PROTO_UDP) + if (ls->socks_proxy && ls->info.proto == PROTO_UDP) { socks_process_incoming_udp(&c->c2.buf, &c->c2.from); } @@ -893,13 +893,14 @@ static inline void socks_preprocess_outgoing_link(struct context *c, + struct link_socket *ls, struct link_socket_actual **to_addr, int *size_delta) { - if (c->c2.link_socket->socks_proxy && c->c2.link_socket->info.proto == PROTO_UDP) + if (ls->socks_proxy && ls->info.proto == PROTO_UDP) { *size_delta += socks_process_outgoing_udp(&c->c2.to_link, c->c2.to_link_addr); - *to_addr = &c->c2.link_socket->socks_relay; + *to_addr = &ls->socks_relay; } } @@ -924,7 +925,7 @@ */ void -read_incoming_link(struct context *c) +read_incoming_link(struct context *c, struct link_socket *ls) { /* * Set up for recvfrom call to read datagram @@ -939,17 +940,17 @@ c->c2.buf = c->c2.buffers->read_link_buf; ASSERT(buf_init(&c->c2.buf, c->c2.frame.buf.headroom)); - status = link_socket_read(c->c2.link_socket, + status = link_socket_read(ls, &c->c2.buf, &c->c2.from); - if (socket_connection_reset(c->c2.link_socket, status)) + if (socket_connection_reset(ls, status)) { #if PORT_SHARE - if (port_share && socket_foreign_protocol_detected(c->c2.link_socket)) + if (port_share && socket_foreign_protocol_detected(ls)) { - const struct buffer *fbuf = socket_foreign_protocol_head(c->c2.link_socket); - const int sd = socket_foreign_protocol_sd(c->c2.link_socket); + const struct buffer *fbuf = socket_foreign_protocol_head(ls); + const int sd = socket_foreign_protocol_sd(ls); port_share_redirect(port_share, fbuf, sd); register_signal(c->sig, SIGTERM, "port-share-redirect"); } @@ -976,7 +977,7 @@ bool dco_win_timeout = tuntap_is_dco_win_timeout(c->c1.tuntap, status); /* check recvfrom status */ - check_status(status, "read", c->c2.link_socket, NULL); + check_status(status, "read", ls, NULL); if (dco_win_timeout) { @@ -984,7 +985,7 @@ } /* Remove socks header if applicable */ - socks_postprocess_incoming_link(c); + socks_postprocess_incoming_link(c, ls); perf_pop(); } @@ -1221,11 +1222,11 @@ } static void -process_incoming_link(struct context *c) +process_incoming_link(struct context *c, struct link_socket *ls) { perf_push(PERF_PROC_IN_LINK); - struct link_socket_info *lsi = get_link_socket_info(c); + struct link_socket_info *lsi = &ls->info; const uint8_t *orig_buf = c->c2.buf.data; process_incoming_link_part1(c, lsi, false); @@ -1724,7 +1725,7 @@ */ void -process_outgoing_link(struct context *c) +process_outgoing_link(struct context *c, struct link_socket *ls) { struct gc_arena gc = gc_new(); int error_code = 0; @@ -1767,7 +1768,7 @@ #if PASSTOS_CAPABILITY /* Set TOS */ - link_socket_set_tos(c->c2.link_socket); + link_socket_set_tos(ls); #endif /* Log packet send */ @@ -1778,7 +1779,7 @@ } #endif msg(D_LINK_RW, "%s WRITE [%d] to %s: %s", - proto2ascii(c->c2.link_socket->info.proto, c->c2.link_socket->info.af, true), + proto2ascii(ls->info.proto, ls->info.af, true), BLEN(&c->c2.to_link), print_link_socket_actual(c->c2.to_link_addr, &gc), PROTO_DUMP(&c->c2.to_link, &gc)); @@ -1789,10 +1790,12 @@ int size_delta = 0; /* If Socks5 over UDP, prepend header */ - socks_preprocess_outgoing_link(c, &to_addr, &size_delta); + socks_preprocess_outgoing_link(c, ls, &to_addr, &size_delta); /* Send packet */ - size = (int)link_socket_write(c->c2.link_socket, &c->c2.to_link, to_addr); + size = (int)link_socket_write(ls, + &c->c2.to_link, + to_addr); /* Undo effect of prepend */ link_socket_write_post_size_adjust(&size, size_delta, &c->c2.to_link); @@ -1821,7 +1824,7 @@ /* Check return status */ error_code = openvpn_errno(); - check_status(size, "write", c->c2.link_socket, NULL); + check_status(size, "write", ls, NULL); if (size > 0) { @@ -2257,7 +2260,7 @@ } void -process_io(struct context *c) +process_io(struct context *c, struct link_socket *ls) { const unsigned int status = c->c2.event_set_status; @@ -2272,7 +2275,7 @@ /* TCP/UDP port ready to accept write */ if (status & SOCKET_WRITE) { - process_outgoing_link(c); + process_outgoing_link(c, ls); } /* TUN device ready to accept write */ else if (status & TUN_WRITE) @@ -2282,10 +2285,10 @@ /* Incoming data on TCP/UDP port */ else if (status & SOCKET_READ) { - read_incoming_link(c); + read_incoming_link(c, ls); if (!IS_SIG(c)) { - process_incoming_link(c); + process_incoming_link(c, ls); } } /* Incoming data on TUN device */ diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index 422c591..f656634 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -72,7 +72,8 @@ void pre_select(struct context *c); -void process_io(struct context *c); +void process_io(struct context *ci, struct link_socket *ls); + /**********************************************************************/ /** @@ -128,10 +129,11 @@ * context associated with the appropriate VPN tunnel for which data is * available to be read. * - * @param c - The context structure which contains the external - * network socket from which to read incoming packets. + * @param c The context structure which contains the external + * network socket from which to read incoming packets. + * @param ls The socket where the packet can be read from. */ -void read_incoming_link(struct context *c); +void read_incoming_link(struct context *c, struct link_socket *ls); /** * Starts processing a packet read from the external network interface. @@ -197,10 +199,11 @@ * * If an error occurs, it is logged and the packet is dropped. * - * @param c - The context structure of the VPN tunnel associated with the - * packet. + * @param c The context structure of the VPN tunnel associated with the + * packet. + * @param ls The socket to be used to send the packet. */ -void process_outgoing_link(struct context *c); +void process_outgoing_link(struct context *c, struct link_socket *ls); /**************************************************************************/ diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index e47712a..c699e6e 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -484,7 +484,7 @@ ASSERT(mi); ASSERT(mi->context.c2.link_socket); set_prefix(mi); - read_incoming_link(&mi->context); + read_incoming_link(&mi->context, mi->context.c2.link_socket); clear_prefix(); if (!IS_SIG(&mi->context)) { diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 268b430..e09111f 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -317,7 +317,7 @@ msg_set_prefix("Connection Attempt"); m->top.c2.to_link = m->hmac_reply; m->top.c2.to_link_addr = m->hmac_reply_dest; - process_outgoing_link(&m->top); + process_outgoing_link(&m->top, &m->top.c2.link_socket[0]); m->hmac_reply_dest = NULL; } } @@ -380,7 +380,7 @@ /* Incoming data on UDP port */ else if (status & SOCKET_READ) { - read_incoming_link(&m->top); + read_incoming_link(&m->top, m->top.c2.link_socket); if (!IS_SIG(&m->top)) { multi_process_incoming_link(m, NULL, mpp_flags); diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index e403989..8e961ea 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -678,7 +678,7 @@ { bool ret = true; set_prefix(mi); - process_outgoing_link(&mi->context); + process_outgoing_link(&mi->context, mi->context.c2.link_socket); ret = multi_process_post(m, mi, mpp_flags); clear_prefix(); return ret; diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c index 16147b7..1db5422 100644 --- a/src/openvpn/openvpn.c +++ b/src/openvpn/openvpn.c @@ -91,7 +91,7 @@ } /* process the I/O which triggered select */ - process_io(c); + process_io(c, c->c2.link_socket); P2P_CHECK_SIG(); perf_pop(); diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 924e30c..302b106 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1828,6 +1828,7 @@ sock->sd = SOCKET_UNDEFINED; sock->ctrl_sd = SOCKET_UNDEFINED; sock->ev_arg.type = EVENT_ARG_LINK_SOCKET; + sock->ev_arg.u.ls = sock; return sock; }