svn commit: r378009 - in branches/2015Q1/net/libutp: . files
Jan Beich
jbeich at FreeBSD.org
Tue Jan 27 13:55:30 UTC 2015
Author: jbeich
Date: Tue Jan 27 13:55:27 2015
New Revision: 378009
URL: https://svnweb.freebsd.org/changeset/ports/378009
QAT: https://qat.redports.org/buildarchive/r378009/
Log:
MFH: r377320 by riggs
Convert to USE_GITHUB
PR: 196616
Submitted by: jbeich at vfemail.net
Approved by: mi at FreeBSD.org (maintainer)
MFH: r377674 by mi
Add a patch fixing a long-standing security problem. Bump PORTREVISION.
PR: 196351
Differential Revision: D1593
Submitted by: Jan Beich
Security: https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-6129
While here, arrange for building a few of the small utilities bundled
with library, and install them along with another potentially useful
header-file.
Sponsored by: http://libpipe.com/
MFH: r377699 by mi
Add a patch to fix 64-bit specific warnings in the just-added utilities.
PR: 197009
Submitted by: Jan Beich
Approved by: portmgr (mat, bapt)
Approved by: bapt (mentor)
Added:
branches/2015Q1/net/libutp/files/BSDmakefile.utils
- copied unchanged from r377674, head/net/libutp/files/BSDmakefile.utils
branches/2015Q1/net/libutp/files/patch-CVE-2012-6129
- copied unchanged from r377674, head/net/libutp/files/patch-CVE-2012-6129
branches/2015Q1/net/libutp/files/patch-size_t
- copied unchanged from r377699, head/net/libutp/files/patch-size_t
Modified:
branches/2015Q1/net/libutp/Makefile
branches/2015Q1/net/libutp/distinfo
branches/2015Q1/net/libutp/files/BSDmakefile
branches/2015Q1/net/libutp/pkg-descr
branches/2015Q1/net/libutp/pkg-plist
Directory Properties:
branches/2015Q1/ (props changed)
Modified: branches/2015Q1/net/libutp/Makefile
==============================================================================
--- branches/2015Q1/net/libutp/Makefile Tue Jan 27 13:38:01 2015 (r378008)
+++ branches/2015Q1/net/libutp/Makefile Tue Jan 27 13:55:27 2015 (r378009)
@@ -3,15 +3,20 @@
PORTNAME= bittorrent-libutp
PORTVERSION= 0.20130514
-DISTVERSION= 7c4f19a
+PORTREVISION= 1
CATEGORIES= net devel
-MASTER_SITES= https://github.com/bittorrent/libutp/tarball/${DISTVERSION}/
MAINTAINER= mi at aldan.algebra.com
-COMMENT= The uTorrent Transport Protocol library
+COMMENT= The uTorrent Transport Protocol library and sample utilities
LICENSE= MIT
+USE_GITHUB= yes
+GH_ACCOUNT= ${PORTNAME:C/-.*//}
+GH_PROJECT= ${PORTNAME:C/.*-//}
+GH_TAGNAME= ${GH_COMMIT}
+GH_COMMIT= 7c4f19a
+
USES= dos2unix uidfix
MAKEFILE= ${FILESDIR}/BSDmakefile
USE_LDCONFIG= yes
@@ -19,4 +24,16 @@ USE_LDCONFIG= yes
pre-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/include/libutp
+post-build:
+ ${MAKE} -f ${FILESDIR}/BSDmakefile.utils -C ${WRKSRC}/utp_file PROG_CXX=utp_send
+ ${MAKE} -f ${FILESDIR}/BSDmakefile.utils -C ${WRKSRC}/utp_file PROG_CXX=utp_recv
+ ${MAKE} -f ${FILESDIR}/BSDmakefile.utils -C ${WRKSRC}/utp_test PROG_CXX=utp_test
+
+post-install:
+ ${INSTALL_PROGRAM} \
+ ${WRKSRC}/utp_file/utp_send \
+ ${WRKSRC}/utp_file/utp_recv \
+ ${WRKSRC}/utp_test/utp_test \
+ ${STAGEDIR}${PREFIX}/bin/
+
.include <bsd.port.mk>
Modified: branches/2015Q1/net/libutp/distinfo
==============================================================================
--- branches/2015Q1/net/libutp/distinfo Tue Jan 27 13:38:01 2015 (r378008)
+++ branches/2015Q1/net/libutp/distinfo Tue Jan 27 13:55:27 2015 (r378009)
@@ -1,2 +1,2 @@
-SHA256 (bittorrent-libutp-7c4f19a.tar.gz) = 305ae8aa43bee7d7d7d1411b07bcde246fab449fbdaf087673cf7b07659cb934
-SIZE (bittorrent-libutp-7c4f19a.tar.gz) = 71029
+SHA256 (bittorrent-libutp-0.20130514.tar.gz) = 305ae8aa43bee7d7d7d1411b07bcde246fab449fbdaf087673cf7b07659cb934
+SIZE (bittorrent-libutp-0.20130514.tar.gz) = 71029
Modified: branches/2015Q1/net/libutp/files/BSDmakefile
==============================================================================
--- branches/2015Q1/net/libutp/files/BSDmakefile Tue Jan 27 13:38:01 2015 (r378008)
+++ branches/2015Q1/net/libutp/files/BSDmakefile Tue Jan 27 13:55:27 2015 (r378009)
@@ -9,6 +9,8 @@ CXXFLAGS+= -Wall
INCLUDEDIR= ${PREFIX}/include/libutp
LIBDIR= ${PREFIX}/lib
-INCS= utp.h utp_utils.h utypes.h
+INCS= utp.h utp_utils.h utypes.h utp_file/udp.h
+
+WARNS= 5
.include <bsd.lib.mk>
Copied: branches/2015Q1/net/libutp/files/BSDmakefile.utils (from r377674, head/net/libutp/files/BSDmakefile.utils)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/2015Q1/net/libutp/files/BSDmakefile.utils Tue Jan 27 13:55:27 2015 (r378009, copy of r377674, head/net/libutp/files/BSDmakefile.utils)
@@ -0,0 +1,10 @@
+# PROG_CXX defined on command-line
+
+SRCS= ${PROG_CXX}.cpp
+NO_MAN= ha-ha
+LDADD= -L.. -lutp
+CXXFLAGS+= -I.. -DPOSIX
+
+WARNS= 3
+
+.include <bsd.prog.mk>
Copied: branches/2015Q1/net/libutp/files/patch-CVE-2012-6129 (from r377674, head/net/libutp/files/patch-CVE-2012-6129)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/2015Q1/net/libutp/files/patch-CVE-2012-6129 Tue Jan 27 13:55:27 2015 (r378009, copy of r377674, head/net/libutp/files/patch-CVE-2012-6129)
@@ -0,0 +1,52 @@
+Index: utp.cpp
+===================================================================
+--- utp.cpp (revision 13645)
++++ utp.cpp (revision 13646)
+@@ -1487,6 +1487,8 @@ size_t UTPSocket::selective_ack_bytes(uint base, c
+ return acked_bytes;
+ }
+
++enum { MAX_EACK = 128 };
++
+ void UTPSocket::selective_ack(uint base, const byte *mask, byte len)
+ {
+ if (cur_window_packets == 0) return;
+@@ -1499,7 +1501,7 @@ void UTPSocket::selective_ack(uint base, const byt
+ // resends is a stack of sequence numbers we need to resend. Since we
+ // iterate in reverse over the acked packets, at the end, the top packets
+ // are the ones we want to resend
+- int resends[32];
++ int resends[MAX_EACK];
+ int nr = 0;
+
+ LOG_UTPV("0x%08x: Got EACK [%032b] base:%u", this, *(uint32*)mask, base);
+@@ -1572,6 +1574,12 @@ void UTPSocket::selective_ack(uint base, const byt
+ if (((v - fast_resend_seq_nr) & ACK_NR_MASK) <= OUTGOING_BUFFER_MAX_SIZE &&
+ count >= DUPLICATE_ACKS_BEFORE_RESEND &&
+ duplicate_ack < DUPLICATE_ACKS_BEFORE_RESEND) {
++ // resends is a stack, and we're mostly interested in the top of it
++ // if we're full, just throw away the lower half
++ if (nr >= MAX_EACK - 2) {
++ memmove(resends, &resends[MAX_EACK/2], MAX_EACK/2 * sizeof(resends[0]));
++ nr -= MAX_EACK / 2;
++ }
+ resends[nr++] = v;
+ LOG_UTPV("0x%08x: no ack for %u", this, v);
+ } else {
+@@ -1580,13 +1588,12 @@ void UTPSocket::selective_ack(uint base, const byt
+ }
+ } while (--bits >= -1);
+
+- if (((base - 1 - fast_resend_seq_nr) & ACK_NR_MASK) < 256 &&
+- count >= DUPLICATE_ACKS_BEFORE_RESEND &&
+- duplicate_ack < DUPLICATE_ACKS_BEFORE_RESEND) {
++ if (((base - 1 - fast_resend_seq_nr) & ACK_NR_MASK) <= OUTGOING_BUFFER_MAX_SIZE &&
++ count >= DUPLICATE_ACKS_BEFORE_RESEND) {
+ // if we get enough duplicate acks to start
+ // resending, the first packet we should resend
+ // is base-1
+- resends[nr++] = base - 1;
++ resends[nr++] = (base - 1) & ACK_NR_MASK;
+ } else {
+ LOG_UTPV("0x%08x: not resending %u count:%d dup_ack:%u fast_resend_seq_nr:%u",
+ this, base - 1, count, duplicate_ack, fast_resend_seq_nr);
Copied: branches/2015Q1/net/libutp/files/patch-size_t (from r377699, head/net/libutp/files/patch-size_t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/2015Q1/net/libutp/files/patch-size_t Tue Jan 27 13:55:27 2015 (r378009, copy of r377699, head/net/libutp/files/patch-size_t)
@@ -0,0 +1,54 @@
+--- utp_file/utp_recv.cpp 2013-05-14 19:05:36.000000000 -0400
++++ utp_file/utp_recv.cpp 2015-01-22 16:45:03.000000000 -0500
+@@ -82,5 +82,5 @@
+ UTPSocket *utp_socket = NULL;
+ FILE *file = NULL;
+-size_t total_recv = 0;
++intmax_t total_recv = 0;
+ bool no_connection = true;
+
+@@ -205,5 +205,5 @@
+ {
+ assert(utp_socket == socket);
+- printf("utp on_write %u\n", count);
++ printf("utp on_write %zu\n", count);
+ assert(false);
+ }
+@@ -365,10 +365,10 @@
+ last_recv = total_recv;
+ last_time = cur_time;
+- printf("\r[%u] recv: %d %.1f bytes/s ", cur_time, total_recv, rate);
++ printf("\r[%u] recv: %jd %.1f bytes/s ", cur_time, total_recv, rate);
+ fflush(stdout);
+ }
+ }
+
+- printf("\nreceived: %d bytes\n", total_recv);
++ printf("\nreceived: %jd bytes\n", (intmax_t)total_recv);
+ fclose(file);
+ fclose(log_file);
+--- utp_file/utp_send.cpp 2013-05-14 19:05:36.000000000 -0400
++++ utp_file/utp_send.cpp 2015-01-22 16:45:03.000000000 -0500
+@@ -82,6 +82,6 @@
+ UTPSocket *utp_socket = NULL;
+ FILE *file = NULL;
+-size_t total_sent = 0;
+-size_t file_size = 0;
++intmax_t total_sent = 0;
++intmax_t file_size = 0;
+
+ void utp_log(char const* fmt, ...)
+@@ -252,5 +252,5 @@
+ {
+ assert(utp_socket == socket);
+- printf("utp on_read %u\n", count);
++ printf("utp on_read %zu\n", count);
+ assert(false);
+ }
+@@ -392,5 +392,5 @@
+ last_sent = total_sent;
+ last_time = cur_time;
+- printf("\r[%u] sent: %d/%d %.1f bytes/s ", cur_time, total_sent, file_size, rate);
++ printf("\r[%u] sent: %jd/%jd %.1f bytes/s ", cur_time, total_sent, file_size, rate);
+ fflush(stdout);
+ }
Modified: branches/2015Q1/net/libutp/pkg-descr
==============================================================================
--- branches/2015Q1/net/libutp/pkg-descr Tue Jan 27 13:38:01 2015 (r378008)
+++ branches/2015Q1/net/libutp/pkg-descr Tue Jan 27 13:55:27 2015 (r378009)
@@ -9,4 +9,4 @@ transport for uTorrent peer-to-peer conn
uTP is written in C++, but the external interface is strictly C
(ANSI C89).
-WWW: https://github.com/bittorrent/libutp
+WWW: https://github.com/bittorrent/libutp
Modified: branches/2015Q1/net/libutp/pkg-plist
==============================================================================
--- branches/2015Q1/net/libutp/pkg-plist Tue Jan 27 13:38:01 2015 (r378008)
+++ branches/2015Q1/net/libutp/pkg-plist Tue Jan 27 13:55:27 2015 (r378009)
@@ -1,6 +1,10 @@
+bin/utp_send
+bin/utp_recv
+bin/utp_test
lib/libutp.so.0
lib/libutp.so
lib/libutp.a
+include/libutp/udp.h
include/libutp/utp.h
include/libutp/utp_utils.h
include/libutp/utypes.h
More information about the svn-ports-branches
mailing list