mirror of
https://git.FreeBSD.org/ports.git
synced 2024-10-19 19:59:43 +00:00
Upgrade from 4.10 to 4.11. Most of my patches have been incorporated by
the upstream. Use -lmd instead of OpenSSL for MD5.
This commit is contained in:
parent
ef2e0817be
commit
1c2801d724
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=313015
@ -1,11 +1,8 @@
|
||||
# New ports collection makefile for: udt
|
||||
# Date created: 24 January 2012
|
||||
# Whom: Mikhail Teterin
|
||||
#
|
||||
# Created by: Mikhail Teterin
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= udt
|
||||
PORTVERSION= 4.10
|
||||
PORTVERSION= 4.11
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= SF
|
||||
DISTNAME= udt.sdk.${PORTVERSION}
|
||||
@ -16,7 +13,6 @@ COMMENT= C++ library containing the UDT API implementation
|
||||
PATCH_WRKSRC= ${WRKDIR}/udt${PORTVERSION:R}
|
||||
WRKSRC= ${PATCH_WRKSRC}/src
|
||||
MAKEFILE= ${FILESDIR}/BSDmakefile
|
||||
USE_OPENSSL= yes
|
||||
MAKE_JOBS_SAFE= yes
|
||||
EXTRACT_AFTER_ARGS= |${TAR} -xpf - --exclude '*md5*' \
|
||||
--exclude udt${PORTVERSION:R}/win
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (udt.sdk.4.10.tar.gz) = b690a717513119f5f5fac2f46789f19deb95f65e5e8a88f6229e173b0a7d6d2d
|
||||
SIZE (udt.sdk.4.10.tar.gz) = 145833
|
||||
SHA256 (udt.sdk.4.11.tar.gz) = aa25b6d7cbac474ca05b7c7b36f59e9a3cd5c61faed8bf1b7174ac118c3de1db
|
||||
SIZE (udt.sdk.4.11.tar.gz) = 147707
|
||||
|
@ -6,23 +6,15 @@ LIBDIR= ${PREFIX}/lib
|
||||
INCLUDEDIR= ${PREFIX}/include
|
||||
INCS= udt.h
|
||||
|
||||
LDADD= -lcrypto -lpthread
|
||||
LDADD= -lmd -lpthread
|
||||
|
||||
SRCS= common.cpp window.cpp list.cpp buffer.cpp packet.cpp channel.cpp \
|
||||
queue.cpp ccc.cpp cache.cpp core.cpp epoll.cpp api.cpp
|
||||
WARNS= 4
|
||||
|
||||
CXXFLAGS+= -D${MACHINE_ARCH:U:S/I386/IA32/:S/SPARC64/SPARC/} -DBSD
|
||||
#CXXFLAGS+= -Wsystem-headers -Werror -Wall -Wno-format-y2k -W \
|
||||
# -Wno-unused-parameter -Wpointer-arith -Wreturn-type \
|
||||
# -Wcast-qual -Wwrite-strings -Wswitch -Wcast-align \
|
||||
# -Wunused-parameter
|
||||
|
||||
.if defined(OPENSSLLIB) && ${OPENSSLLIB} != "/usr/lib"
|
||||
LDADD= -L${OPENSSLLIB}
|
||||
.endif
|
||||
.if defined(OPENSSLINC) && ${OPENSSLINC} != "/usr/include"
|
||||
CXXFLAGS+= -I${OPENSSLINC}
|
||||
.endif
|
||||
CXXFLAGS+= -Wsystem-headers -Werror -Wall -W \
|
||||
-Wpointer-arith -Wreturn-type \
|
||||
-Wwrite-strings -Wswitch -Wcast-align \
|
||||
-Wunused-parameter
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,105 @@
|
||||
Use OpenSSL's md5-implementation instead of UDT's own.
|
||||
Use BSD's message-digest library (-lmd) instead of UDT's own
|
||||
MD5-implementation.
|
||||
|
||||
Rejected by author because of concerns for Windows computers
|
||||
and mobile devices.
|
||||
Original proposed to use OpenSSL for portability, but rejected by
|
||||
the author anyway out of concern for Windows computers and mobile
|
||||
devices:
|
||||
|
||||
--- src/common.cpp 2011-12-26 12:09:11.000000000 -0500
|
||||
+++ src/common.cpp 2012-01-26 17:48:01.000000000 -0500
|
||||
https://sourceforge.net/p/udt/patches/5/
|
||||
|
||||
This new version also allows to pass the length of the input and
|
||||
modifies the only two callers (both in core.cpp) to do that -- to
|
||||
avoid a strlen().
|
||||
|
||||
-mi
|
||||
|
||||
--- src/common.h 2013-02-20 11:35:26.000000000 -0500
|
||||
+++ src/common.h 2013-02-26 13:53:52.000000000 -0500
|
||||
@@ -315,4 +315,5 @@
|
||||
{
|
||||
static void compute(const char* input, unsigned char result[16]);
|
||||
+ static void compute(const char* input, size_t ilen, unsigned char result[16]);
|
||||
};
|
||||
|
||||
--- src/common.cpp 2013-02-20 11:35:26.000000000 -0500
|
||||
+++ src/common.cpp 2013-02-26 13:56:57.000000000 -0500
|
||||
@@ -56,5 +56,5 @@
|
||||
|
||||
#include <cmath>
|
||||
-#include "md5.h"
|
||||
+#include <openssl/md5.h>
|
||||
+#include <md5.h>
|
||||
#include "common.h"
|
||||
|
||||
@@ -742,8 +742,4 @@
|
||||
void CMD5::compute(const char* input, unsigned char result[16])
|
||||
@@ -756,10 +756,15 @@
|
||||
|
||||
//
|
||||
-void CMD5::compute(const char* input, unsigned char result[16])
|
||||
+void CMD5::compute(const char* input, size_t ilen, unsigned char result[16])
|
||||
{
|
||||
- md5_state_t state;
|
||||
-
|
||||
+ MD5_CTX state;
|
||||
+
|
||||
+ MD5Init(&state);
|
||||
+ MD5Update(&state, (const void *)input, ilen);
|
||||
+ MD5Final(result, &state);
|
||||
+}
|
||||
|
||||
- md5_init(&state);
|
||||
- md5_append(&state, (const md5_byte_t *)input, strlen(input));
|
||||
- md5_finish(&state, result);
|
||||
+ MD5((const unsigned char *)input, strlen(input), result);
|
||||
+void CMD5::compute(const char* input, unsigned char result[16])
|
||||
+{
|
||||
+ compute(input, strlen(input), result);
|
||||
}
|
||||
--- src/core.cpp 2013-02-20 11:35:26.000000000 -0500
|
||||
+++ src/core.cpp 2013-02-26 18:49:00.000000000 -0500
|
||||
@@ -40,4 +40,5 @@
|
||||
|
||||
#ifndef WIN32
|
||||
+ #include <err.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
@@ -2460,12 +2461,28 @@
|
||||
|
||||
// SYN cookie
|
||||
- char clienthost[NI_MAXHOST];
|
||||
- char clientport[NI_MAXSERV];
|
||||
- getnameinfo(addr, (AF_INET == m_iVersion) ? sizeof(sockaddr_in) : sizeof(sockaddr_in6), clienthost, sizeof(clienthost), clientport, sizeof(clientport), NI_NUMERICHOST|NI_NUMERICSERV);
|
||||
+ char clientport[6]; /* Longest decimal representation of a short number */
|
||||
+ char cookiestr[(AF_INET == addr->sa_family ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN) +
|
||||
+ sizeof(clientport) + 64];
|
||||
+ int gaie = getnameinfo(addr, addr->sa_len, cookiestr, INET6_ADDRSTRLEN,
|
||||
+ clientport, sizeof(clientport), NI_NUMERICHOST|NI_NUMERICSERV);
|
||||
+ if (gaie) {
|
||||
+#ifndef WIN32
|
||||
+ warnx("getnameinfo: %s (addr->sa_family: %d -- %sAF_INET, family: %d, length: %u, "
|
||||
+ "size: %zd of %zd and %zd)",
|
||||
+ gai_strerror(gaie), addr->sa_family, addr->sa_family == AF_INET ? "" : "not ",
|
||||
+ addr->sa_family, (unsigned int)addr->sa_len,
|
||||
+ AF_INET == addr->sa_family ? sizeof(sockaddr_in) : sizeof(sockaddr_in6),
|
||||
+ sizeof(sockaddr_in), sizeof(sockaddr_in6));
|
||||
+#endif
|
||||
+ return -1;
|
||||
+ }
|
||||
int64_t timestamp = (CTimer::getTime() - m_StartTime) / 60000000; // secret changes every one minute
|
||||
- stringstream cookiestr;
|
||||
- cookiestr << clienthost << ":" << clientport << ":" << timestamp;
|
||||
+ size_t cookielen, saltedlen;
|
||||
+
|
||||
+ cookielen = strlen(cookiestr);
|
||||
+ cookielen += sprintf(cookiestr + cookielen, ":%s:", clientport);
|
||||
+ saltedlen = cookielen + sprintf(cookiestr + cookielen, "%jd", (intmax_t)timestamp);
|
||||
unsigned char cookie[16];
|
||||
- CMD5::compute(cookiestr.str().c_str(), cookie);
|
||||
+ CMD5::compute(cookiestr, saltedlen, cookie);
|
||||
|
||||
if (1 == hs.m_iReqType)
|
||||
@@ -2483,6 +2500,6 @@
|
||||
{
|
||||
timestamp --;
|
||||
- cookiestr << clienthost << ":" << clientport << ":" << timestamp;
|
||||
- CMD5::compute(cookiestr.str().c_str(), cookie);
|
||||
+ saltedlen = cookielen + sprintf(cookiestr + cookielen, "%jd", (intmax_t)timestamp);
|
||||
+ CMD5::compute(cookiestr, saltedlen, cookie);
|
||||
|
||||
if (hs.m_iCookie != *(int*)cookie)
|
||||
|
@ -1,16 +1,3 @@
|
||||
Accepted (largely) by the author already. See:
|
||||
|
||||
https://sourceforge.net/tracker/?func=detail&atid=670041&aid=3480628&group_id=115059
|
||||
|
||||
--- src/channel.cpp 2011-12-26 12:09:11.000000000 -0500
|
||||
+++ src/channel.cpp 2012-01-27 10:55:29.000000000 -0500
|
||||
@@ -252,5 +252,5 @@
|
||||
#ifndef WIN32
|
||||
msghdr mh;
|
||||
- mh.msg_name = (sockaddr*)addr;
|
||||
+ mh.msg_name = (void *)addr;
|
||||
mh.msg_namelen = m_iSockAddrSize;
|
||||
mh.msg_iov = (iovec*)packet.m_PacketVector;
|
||||
--- src/epoll.cpp 2011-12-26 12:09:11.000000000 -0500
|
||||
+++ src/epoll.cpp 2012-01-27 11:56:49.000000000 -0500
|
||||
@@ -108,5 +108,9 @@
|
||||
@ -24,105 +11,3 @@ https://sourceforge.net/tracker/?func=detail&atid=670041&aid=3480628&group_id=11
|
||||
+)
|
||||
{
|
||||
CGuard pg(m_EPollLock);
|
||||
--- src/queue.cpp 2011-12-26 12:09:11.000000000 -0500
|
||||
+++ src/queue.cpp 2012-01-27 10:55:29.000000000 -0500
|
||||
@@ -488,8 +488,8 @@
|
||||
}
|
||||
|
||||
-void CSndQueue::init(const CChannel* c, const CTimer* t)
|
||||
+void CSndQueue::init(CChannel* c, CTimer* t)
|
||||
{
|
||||
- m_pChannel = (CChannel*)c;
|
||||
- m_pTimer = (CTimer*)t;
|
||||
+ m_pChannel = c;
|
||||
+ m_pTimer = t;
|
||||
m_pSndUList = new CSndUList;
|
||||
m_pSndUList->m_pWindowLock = &m_WindowLock;
|
||||
@@ -710,5 +710,5 @@
|
||||
}
|
||||
|
||||
-void CHash::insert(const int32_t& id, const CUDT* u)
|
||||
+void CHash::insert(int32_t id, CUDT* u)
|
||||
{
|
||||
CBucket* b = m_pBucket[id % m_iHashSize];
|
||||
@@ -716,5 +716,5 @@
|
||||
CBucket* n = new CBucket;
|
||||
n->m_iID = id;
|
||||
- n->m_pUDT = (CUDT*)u;
|
||||
+ n->m_pUDT = u;
|
||||
n->m_pNext = b;
|
||||
|
||||
@@ -938,5 +938,5 @@
|
||||
}
|
||||
|
||||
-void CRcvQueue::init(const int& qsize, const int& payload, const int& version, const int& hsize, const CChannel* cc, const CTimer* t)
|
||||
+void CRcvQueue::init(int qsize, int payload, int version, int hsize, CChannel* cc, CTimer* t)
|
||||
{
|
||||
m_iPayloadSize = payload;
|
||||
@@ -947,6 +947,6 @@
|
||||
m_pHash->init(hsize);
|
||||
|
||||
- m_pChannel = (CChannel*)cc;
|
||||
- m_pTimer = (CTimer*)t;
|
||||
+ m_pChannel = cc;
|
||||
+ m_pTimer = t;
|
||||
|
||||
m_pRcvUList = new CRcvUList;
|
||||
@@ -1021,5 +1021,5 @@
|
||||
{
|
||||
if (NULL != self->m_pListener)
|
||||
- ((CUDT*)self->m_pListener)->listen(addr, unit->m_Packet);
|
||||
+ self->m_pListener->listen(addr, unit->m_Packet);
|
||||
else if (NULL != (u = self->m_pRendezvousQueue->retrieve(addr, id)))
|
||||
{
|
||||
@@ -1160,5 +1160,5 @@
|
||||
}
|
||||
|
||||
-int CRcvQueue::setListener(const CUDT* u)
|
||||
+int CRcvQueue::setListener(CUDT* u)
|
||||
{
|
||||
CGuard lslock(m_LSLock);
|
||||
@@ -1167,5 +1167,5 @@
|
||||
return -1;
|
||||
|
||||
- m_pListener = (CUDT*)u;
|
||||
+ m_pListener = u;
|
||||
return 0;
|
||||
}
|
||||
--- src/queue.h 2011-12-26 12:09:11.000000000 -0500
|
||||
+++ src/queue.h 2012-01-27 10:55:29.000000000 -0500
|
||||
@@ -312,5 +312,5 @@
|
||||
// None.
|
||||
|
||||
- void insert(const int32_t& id, const CUDT* u);
|
||||
+ void insert(int32_t id, CUDT* u);
|
||||
|
||||
// Functionality:
|
||||
@@ -385,5 +385,5 @@
|
||||
// None.
|
||||
|
||||
- void init(const CChannel* c, const CTimer* t);
|
||||
+ void init(CChannel* c, CTimer* t);
|
||||
|
||||
// Functionality:
|
||||
@@ -445,5 +445,5 @@
|
||||
// None.
|
||||
|
||||
- void init(const int& size, const int& payload, const int& version, const int& hsize, const CChannel* c, const CTimer* t);
|
||||
+ void init(int size, int payload, int version, int hsize, CChannel* c, CTimer* t);
|
||||
|
||||
// Functionality:
|
||||
@@ -480,5 +480,5 @@
|
||||
|
||||
private:
|
||||
- int setListener(const CUDT* u);
|
||||
+ int setListener(CUDT* u);
|
||||
void removeListener(const CUDT* u);
|
||||
|
||||
@@ -494,5 +494,5 @@
|
||||
private:
|
||||
pthread_mutex_t m_LSLock;
|
||||
- volatile CUDT* m_pListener; // pointer to the (unique, if any) listening UDT entity
|
||||
+ CUDT* m_pListener; // pointer to the (unique, if any) listening UDT entity
|
||||
CRendezvousQueue* m_pRendezvousQueue; // The list of sockets in rendezvous mode
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user