Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Feb 2019 17:55:31 +0000 (UTC)
From:      Dmitry Marakasov <amdmi3@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r492146 - in head/security/i2pd: . files
Message-ID:  <201902041755.x14HtVP7078099@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: amdmi3
Date: Mon Feb  4 17:55:30 2019
New Revision: 492146
URL: https://svnweb.freebsd.org/changeset/ports/492146

Log:
  - Add upstream patch to fix occasional crashes
  
  See https://github.com/PurpleI2P/i2pd/issues/1290

Added:
  head/security/i2pd/files/patch-bc3f02cb6b89cb00b83439330c942006039e1cba   (contents, props changed)
Modified:
  head/security/i2pd/Makefile

Modified: head/security/i2pd/Makefile
==============================================================================
--- head/security/i2pd/Makefile	Mon Feb  4 17:29:30 2019	(r492145)
+++ head/security/i2pd/Makefile	Mon Feb  4 17:55:30 2019	(r492146)
@@ -3,6 +3,7 @@
 
 PORTNAME=	i2pd
 PORTVERSION=	2.23.0
+PORTREVISION=	1
 CATEGORIES=	security net-p2p
 
 MAINTAINER=	amdmi3@FreeBSD.org

Added: head/security/i2pd/files/patch-bc3f02cb6b89cb00b83439330c942006039e1cba
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/i2pd/files/patch-bc3f02cb6b89cb00b83439330c942006039e1cba	Mon Feb  4 17:55:30 2019	(r492146)
@@ -0,0 +1,52 @@
+From bc3f02cb6b89cb00b83439330c942006039e1cba Mon Sep 17 00:00:00 2001
+From: orignal <i2porignal@yandex.ru>
+Date: Thu, 31 Jan 2019 16:03:10 -0500
+Subject: [PATCH] fix #1290. copy correct size if message didn't fit previous
+
+---
+ libi2pd/TunnelGateway.cpp | 25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+diff --git a/libi2pd/TunnelGateway.cpp b/libi2pd/TunnelGateway.cpp
+index e6bfdd844..7d0069a93 100644
+--- libi2pd/TunnelGateway.cpp
++++ libi2pd/TunnelGateway.cpp
+@@ -51,6 +51,19 @@ namespace tunnel
+ 		// create fragments
+ 		const std::shared_ptr<I2NPMessage> & msg = block.data;
+ 		size_t fullMsgLen = diLen + msg->GetLength () + 2; // delivery instructions + payload + 2 bytes length
++		
++		if (!messageCreated && fullMsgLen > m_RemainingSize) // check if we should complete previous message
++		{
++			size_t numFollowOnFragments = fullMsgLen / TUNNEL_DATA_MAX_PAYLOAD_SIZE;
++			// length of bytes doesn't fit full tunnel message
++			// every follow-on fragment adds 7 bytes
++			size_t nonFit = (fullMsgLen + numFollowOnFragments*7) % TUNNEL_DATA_MAX_PAYLOAD_SIZE;
++			if (!nonFit || nonFit > m_RemainingSize)
++			{
++				CompleteCurrentTunnelDataMessage ();
++				CreateCurrentTunnelDataMessage ();
++			}
++		}
+ 		if (fullMsgLen <= m_RemainingSize)
+ 		{
+ 			// message fits. First and last fragment
+@@ -65,18 +78,6 @@ namespace tunnel
+ 		}
+ 		else
+ 		{
+-			if (!messageCreated) // check if we should complete previous message
+-			{
+-				size_t numFollowOnFragments = fullMsgLen / TUNNEL_DATA_MAX_PAYLOAD_SIZE;
+-				// length of bytes don't fit full tunnel message
+-				// every follow-on fragment adds 7 bytes
+-				size_t nonFit = (fullMsgLen + numFollowOnFragments*7) % TUNNEL_DATA_MAX_PAYLOAD_SIZE;
+-				if (!nonFit || nonFit > m_RemainingSize)
+-				{
+-					CompleteCurrentTunnelDataMessage ();
+-					CreateCurrentTunnelDataMessage ();
+-				}
+-			}
+ 			if (diLen + 6 <= m_RemainingSize)
+ 			{
+ 				// delivery instructions fit



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902041755.x14HtVP7078099>