From patchwork Thu Mar 18 08:27:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kristof Provost via Openvpn-devel X-Patchwork-Id: 1628 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director14.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id aNJ8EaDiU2BUDAAAIUCqbw (envelope-from ) for ; Thu, 18 Mar 2021 19:30:40 -0400 Received: from proxy12.mail.ord1d.rsapps.net ([172.30.191.6]) by director14.mail.ord1d.rsapps.net with LMTP id wOlTEaDiU2A4EAAAeJ7fFg (envelope-from ) for ; Thu, 18 Mar 2021 19:30:40 -0400 Received: from smtp34.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy12.mail.ord1d.rsapps.net with LMTPS id 8GwoEaDiU2CxdQAA7PHxkg (envelope-from ) for ; Thu, 18 Mar 2021 19:30:40 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp34.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=pass header.d=lists.sourceforge.net; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=fox-it.com; dmarc=pass (p=none; dis=none) header.from=lists.sourceforge.net X-Suspicious-Flag: NO X-Classification-ID: f2b6bb7a-8841-11eb-8c7b-545200247500-1-1 Received: from [216.105.38.7] ([216.105.38.7:40090] helo=lists.sourceforge.net) by smtp34.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 73/71-14228-F92E3506; Thu, 18 Mar 2021 19:30:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:Message-ID:Date:To:Sender:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=34zytXYeDm0bivJ0QkrNhyDc8xTyFU89k5qOKGwe1ik=; b=eEaxZIHoX9aCpiTen4uSoNDqlB 7GaEhTj8QmmdcWDv78OjgMQ9lZW0ZKn/prTuVxlaUat6oQZqfUpjw8sYirqJeQJGMTgiOCQQA2Nkl jvuS0LZd4ToZMVTztJtDHf42qd83ArpwtaY1iEBnNLojUSywtKUR0nJ4b6HRn2qIK7KM=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lN23q-00055h-Lv; Thu, 18 Mar 2021 23:28:14 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lN23k-00055V-Ii for openvpn-devel@lists.sourceforge.net; Thu, 18 Mar 2021 23:28:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Transfer-Encoding:Content-Type :Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/6ZSGopj1BlOyae3pur7lZnRJyHiG6kJgjEmF/vtCow=; b=Vnt+a8SV0zXfu2vVbnUzDtdEhP rcrM3cbFSAGGtyFDijj8rCvNhMHaALNz1tMsxtoIR4onoHnVhDPQMkOk2o29dr94LwqnHSWHhF5Da BuyzBGVS/jwdNHqvyEIXNnTK8lQiRDxDFCLLtTSfRrk+LDuLeU6+bnrr/0k3Mo5E/CNM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Transfer-Encoding:Content-Type:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=/6ZSGopj1BlOyae3pur7lZnRJyHiG6kJgjEmF/vtCow=; b=S ukS99KiaJR3n2ac9wvUhoUeURvnYQkRQxtmrJLLjrSiRxOvDfBT2dsNJHhV82D/Smi5bu68uRd3Q6 VAT81Mo3NR4Nv1xNHbF9kthoKXhkT/YxLihZ9FQzuY3Szg45o8GhAMZSgphdFNO62rdCPZgmu7sap 5FLhnf8Kgbjve/kM=; Received: from mail-eopbgr20055.outbound.protection.outlook.com ([40.107.2.55] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lN23O-0000U7-Rv for openvpn-devel@lists.sourceforge.net; Thu, 18 Mar 2021 23:28:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOPI1MWVrq0vp6RZlV5mjBuTeibwbVyYYEL4jx4cpCTA3o0x1y6RuJkT9poKCro/2inW+xTTCSTK6ihFnLveCCIFguq8WCa4P2uFz6232aXyPSg4n+aMwUfXtSll0i+tS6xbqqPzigqragqMACfNoAnqHG1X7gQYp1Dji9UN7pm+eZ+OZtcKvl/gr43jDsGiJKn+7/4x3UVq/PDmA/wyYbcY/wbMqDxIGupRUZqpMFl3SDGBgrhOqCdKJuWxWTPCcBWAoJQA+xltedstQ1JWI0WM2+E9VKa1XJoAhzZuc/e9Qvs9EJ0BeWMQZBeJxXYUBO5ho2cOorFy8P1r8+pGkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/6ZSGopj1BlOyae3pur7lZnRJyHiG6kJgjEmF/vtCow=; b=KeVcF/TahNXuiTeCLN+M4x2CUTinRfbJNyCJYA/5ShFZGaVn97b5Z04vn8QbF5hFb6ldlz7DCrwYia+igmh5UciJItUbMq2rt+9sqKsR9quuulvtNnRdeVJIBT7Zyrfsn25ulFWXUeCxSi14QBdhTim6BPe54cUEpJA0q4rdwzZQWq4xU7vRsZrv7MTsrZj9PJvLvrN1HS4xcyVDWaofylgUcvpj2EZLZbcwVsjFvG0ely2lQr8bjPAd3b8FGaYJVGAuICNHCVtbDftXyJXI+tnSohdHbPn7X2xXr7Oat+b568isIPKBYU9JMqlJc7fwAL71ZXP9KgyL3qSbMGhk5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fox-it.com; dmarc=pass action=none header.from=fox-it.com; dkim=pass header.d=fox-it.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fox-it.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/6ZSGopj1BlOyae3pur7lZnRJyHiG6kJgjEmF/vtCow=; b=hN/XtYlVNNktL5QzouOAc3p08BN4DmpxPKJ4T1izf6WZ3pYz2bQYxnD6sBTxaWo/LSgPiSsZdUKRgF1BVAZQhGN8c6da22kR136ety0jCZucau4FB0hN64gqUS/OYAh90LWP2vBhnBfn+bFEX2VcK9ZE1PM8MGbGXgdJBTxRIR7zbPHHxOjAaVSHoDxGQqamI8e7vbdzqH9vXrItIBv8LIN6lhq29slMVNFpodz//mBkGo7Eu42P/Ap6PzKEz9MgwadcbpQbKOWSphTt5AdiDsUSVq3OHPlZhV32t8raHVWpDnaO53qhawDKccGpRi/oGP4Ebi0hhx5Wvp17/JfUvw== Received: from AM0PR04MB5331.eurprd04.prod.outlook.com (2603:10a6:208:65::25) by AM0PR04MB5394.eurprd04.prod.outlook.com (2603:10a6:208:11c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Thu, 18 Mar 2021 19:27:31 +0000 Received: from AM0PR04MB5331.eurprd04.prod.outlook.com ([fe80::de8:7eb8:7b4c:3a7]) by AM0PR04MB5331.eurprd04.prod.outlook.com ([fe80::de8:7eb8:7b4c:3a7%6]) with mapi id 15.20.3955.018; Thu, 18 Mar 2021 19:27:30 +0000 To: "openvpn-devel@lists.sourceforge.net" Thread-Topic: [PATCH] reliable: retransmit if 3 follow-up ACKs are received Thread-Index: AdccKHWypeJO2HnJSnSb4DC3cEPMIQ== Date: Thu, 18 Mar 2021 19:27:30 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 461c1386-3e7d-4d40-00ae-08d8ea43df9d x-ms-traffictypediagnostic: AM0PR04MB5394: x-microsoft-antispam-prvs: campaign: C_Default signature: S_NoSignature disclaimer: D_NoDisclaimer x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5iXE+Pw747ok+7G0cJ2GxEEVPyiEc6wbFnVckbDuFdriFCQikTNMjjVYtxcs9RFvfBpviHb+aze/RLpCAKmolPm/vmD+icX9mXVAE6u3Cm9JPn1F0MSt975TZnfEhX4QkCyU1rJCgR/ylKI22aTbPM/g93gI1BWJPFrjD566dqTQSKO7BYG/kHaExwFtpbPxtufuPzKOJ30XJAGBSRVlZhM1vZQSyuSHfeQjpnJE/CKXndAWnbuYFuveS0L0mIpT/ltvKeYmISGrAuRuNUWI8eRx4urZHhJqFOJxBTK1kBjWcLEKGPBF2Zegzh2SMUtypZwz28qWIP+MWOyL2MrmNuX4M0ZKesgierhCGHFo+D6EIRgSgE47P452xYaRr0KFNZdokp+NcIwwr6LKtnnpbtQ1KjCYM5kmrzrM9JHyzBRBoeqB/Ek37yx4NPftQUmmtD+cyEDd8N8TRI54tZD5tvALMZprtZA10taSWPZRiRJrTIutYr4mzn2Aha7awVKQWlB4oZxi9oWwGXT/Ba6ElL6p0QcleLyQu9YgPcebVCwNE0D9o3yPjXUwSwOLdPhk4ehRqry1lu4NMGgbPpdxmHUvwet2jBfruDMLGwELgWw= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5331.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(396003)(366004)(136003)(346002)(39850400004)(55016002)(478600001)(9686003)(38100700001)(5660300002)(8936002)(7696005)(6506007)(2906002)(71200400001)(6916009)(8676002)(26005)(316002)(186003)(52536014)(66476007)(64756008)(86362001)(66946007)(76116006)(66556008)(66446008)(44832011)(33656002)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: W2WAW/s+83xvtqYedQChR0XGESY28uLuuHlfJd7Ms+3yO/QLUj4AjfSIUHeZfhKffTt5CKy1W2ogXPAyZ6x2psdwkhYK2mBYSs4kYWnxECwMu2f3AK7TlycEsl4xr1h3aw6oR1X3GRBRL7WvpUbZNSbzEhd4x4F1zcLH/JiTBZZVI7adSGU/9HZ/f1A/8uMoJudAz07kY848Uat+vmu5MdeaEVc1KdXsoR83xGLI1+cyAdVxKw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-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5331.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 461c1386-3e7d-4d40-00ae-08d8ea43df9d X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2021 19:27:30.7452 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a41111be-486b-45f6-8bd0-ee01a62f368e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7bGnXywChDEHMqzalLUTSfp8iiNR2rBkoUDoCoHYQeyXd41tZbDsow3bhsnh8A8hSu/7rZRubOuml+IoVgpikuFJboZol//Tj5AsCQIFHgA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5394 X-OriginatorOrg: fox-it.com X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.2.55 listed in wl.mailspike.net] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: fox-it.com] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -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_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1lN23O-0000U7-Rv Subject: [Openvpn-devel] [PATCH] reliable: retransmit if 3 follow-up ACKs are received 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: , X-Patchwork-Original-From: Maximilian Fillinger via Openvpn-devel From: Kristof Provost via Openvpn-devel Reply-To: Maximilian Fillinger Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Hi! I'm currently preparing the OpenVPN-NL 2.5 release at Fox-IT. (We're a bit behind the times...) I thought that one of our patches, by Steffan Karger, could be useful in regular OpenVPN. He said that he hadn't submitted it yet, and thought it would be a good idea to ask. The patch increases the performance of the control channel when there is a small amount of packet loss by resending packets more aggressively. In reliable_send, packets are resent before the timeout expires if at least 3 later packets have been ACK'd. The reasoning is that if we receive ACKs for later packets, the connection seems to be functional and we should be able to try again. This policy is similar to many TCP implementations. Please let me know if you think this is useful, and if you would like me to make any changes to the patch. Signed-off-by: Steffan Karger --- src/openvpn/reliable.c | 14 +++++++++++--- src/openvpn/reliable.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/openvpn/reliable.c b/src/openvpn/reliable.c index 6c1f2da1..04d053bd 100644 --- a/src/openvpn/reliable.c +++ b/src/openvpn/reliable.c @@ -41,6 +41,8 @@ #include "memdbg.h" +#define N_ACK_RETRANSMIT 3 + /* * verify that test - base < extent while allowing for base or test wraparound */ @@ -382,7 +384,10 @@ reliable_send_purge(struct reliable *rel, const struct reliable_ack *ack) } #endif e->active = false; - break; + } + else if (e->active && e->packet_id < pid) + { + e->n_acks++; } } } @@ -555,7 +560,7 @@ reliable_can_send(const struct reliable *rel) if (e->active) { ++n_active; - if (now >= e->next_try) + if (now >= e->next_try || e->n_acks >= N_ACK_RETRANSMIT) { ++n_current; } @@ -581,7 +586,8 @@ reliable_send(struct reliable *rel, int *opcode) for (i = 0; i < rel->size; ++i) { struct reliable_entry *e = &rel->array[i]; - if (e->active && local_now >= e->next_try) + if (e->active + && (e->n_acks >= N_ACK_RETRANSMIT || local_now >= e->next_try)) { if (!best || reliable_pid_min(e->packet_id, best->packet_id)) { @@ -599,6 +605,7 @@ reliable_send(struct reliable *rel, int *opcode) /* constant timeout, no backoff */ best->next_try = local_now + best->timeout; #endif + best->n_acks = 0; *opcode = best->opcode; dmsg(D_REL_DEBUG, "ACK reliable_send ID " packet_id_format " (size=%d to=%d)", (packet_id_print_type)best->packet_id, best->buf.len, @@ -686,6 +693,7 @@ reliable_mark_active_incoming(struct reliable *rel, struct buffer *buf, e->opcode = opcode; e->next_try = 0; e->timeout = 0; + e->n_acks = 0; dmsg(D_REL_DEBUG, "ACK mark active incoming ID " packet_id_format, (packet_id_print_type)e->packet_id); return; } diff --git a/src/openvpn/reliable.h b/src/openvpn/reliable.h index a84d4290..bf0b561b 100644 --- a/src/openvpn/reliable.h +++ b/src/openvpn/reliable.h @@ -72,6 +72,7 @@ struct reliable_entry interval_t timeout; time_t next_try; packet_id_type packet_id; + size_t n_acks; int opcode; struct buffer buf; };