Hello community, here is the log from the commit of package mozilla-nspr for openSUSE:Factory checked in at 2017-08-17 11:46:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mozilla-nspr (Old) and /work/SRC/openSUSE:Factory/.mozilla-nspr.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mozilla-nspr" Thu Aug 17 11:46:54 2017 rev:63 rq:516057 version:4.15 Changes: -------- --- /work/SRC/openSUSE:Factory/mozilla-nspr/mozilla-nspr.changes 2017-05-06 18:26:10.864608584 +0200 +++ /work/SRC/openSUSE:Factory/.mozilla-nspr.new/mozilla-nspr.changes 2017-08-17 11:46:57.413713139 +0200 @@ -1,0 +2,7 @@ +Sat Aug 5 13:09:55 UTC 2017 - [email protected] + +- update to version 4.15 + * added TCP Fast Open functionality + * various correctness fixes + +------------------------------------------------------------------- Old: ---- nspr-4.14.tar.gz New: ---- nspr-4.15.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mozilla-nspr.spec ++++++ --- /var/tmp/diff_new_pack.Cy8J5G/_old 2017-08-17 11:47:03.296882836 +0200 +++ /var/tmp/diff_new_pack.Cy8J5G/_new 2017-08-17 11:47:03.304881708 +0200 @@ -18,7 +18,7 @@ Name: mozilla-nspr -Version: 4.14 +Version: 4.15 Release: 0 Summary: Netscape Portable Runtime License: MPL-2.0 ++++++ nspr-4.14.tar.gz -> nspr-4.15.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/.hg_archival.txt new/nspr-4.15/nspr/.hg_archival.txt --- old/nspr-4.14/nspr/.hg_archival.txt 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/.hg_archival.txt 2017-06-05 22:16:00.000000000 +0200 @@ -1,4 +1,4 @@ repo: a4b34919bf34db2ee22acbbc305693c8980b6dc6 -node: 9b2937615f3fff76f68b04a9d8c0ad6886bee5c3 -branch: NSPR_4_14_BRANCH -tag: NSPR_4_14_RTM +node: cedc5c8d44fbdfbb1d1616d3752fb6bf33705d6a +branch: default +tag: NSPR_4_15_RTM diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/.hgignore new/nspr-4.15/nspr/.hgignore --- old/nspr-4.14/nspr/.hgignore 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/.hgignore 2017-06-05 22:16:00.000000000 +0200 @@ -3,3 +3,5 @@ *OPT.OBJ/* *DBG.OBJ/* *DBG.OBJD/* +Debug/ +Release/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/configure new/nspr-4.15/nspr/configure --- old/nspr-4.14/nspr/configure 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/configure 2017-06-05 22:16:00.000000000 +0200 @@ -2488,7 +2488,7 @@ program_prefix=${target_alias}- MOD_MAJOR_VERSION=4 -MOD_MINOR_VERSION=14 +MOD_MINOR_VERSION=15 MOD_PATCH_VERSION=0 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= @@ -5424,6 +5424,40 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma diagnostic" >&5 +$as_echo_n "checking for pragma diagnostic... " >&6; } +if test "$GNU_CC" = "1"; then + cat >dummy-hello.c <<EOF +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif +int main() { + char *dummy = ""; + return 0; +} +EOF + ${CC} -Werror=unused-but-set-variable -S dummy-hello.c -o dummy-hello.s 2>&5 + if test $? != 0; then + ${CC} -Werror=unused-but-set-variable -D_PR_HAS_PRAGMA_DIAGNOSTIC -S dummy-hello.c -o dummy-hello.s 2>&5 + if test $? = 0; then + CFLAGS="$CFLAGS -D_PR_HAS_PRAGMA_DIAGNOSTIC=1" + _res=yes + else + _res=no + fi + else + _res=no + fi + rm -f dummy-hello.c dummy-hello.s + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_res" >&5 +$as_echo "$_res" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + _SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" @@ -6524,6 +6558,13 @@ $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h + $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h + + HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'` + if test "$HOST_DARWIN_MAJOR" -ge 15 ; then + $as_echo "#define HAS_CONNECTX 1" >>confdefs.h + fi + AS='$(CC) -x assembler-with-cpp' CFLAGS="$CFLAGS -Wall -fno-common" case "${target_cpu}" in @@ -6975,6 +7016,8 @@ $as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h + $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h + case "${target}" in *-android*|*-linuxandroid*) OS_TARGET=Android diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/configure.in new/nspr-4.15/nspr/configure.in --- old/nspr-4.14/nspr/configure.in 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/configure.in 2017-06-05 22:16:00.000000000 +0200 @@ -15,7 +15,7 @@ dnl = Defaults dnl ======================================================== MOD_MAJOR_VERSION=4 -MOD_MINOR_VERSION=14 +MOD_MINOR_VERSION=15 MOD_PATCH_VERSION=0 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= @@ -716,6 +716,40 @@ fi dnl ======================================================== +dnl Check for pragma diagnostic +dnl ======================================================== + +AC_MSG_CHECKING([for pragma diagnostic]) +if test "$GNU_CC" = "1"; then + cat >dummy-hello.c <<EOF +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif +int main() { + char *dummy = ""; + return 0; +} +EOF + ${CC} -Werror=unused-but-set-variable -S dummy-hello.c -o dummy-hello.s 2>&5 + if test $? != 0; then + ${CC} -Werror=unused-but-set-variable -D_PR_HAS_PRAGMA_DIAGNOSTIC -S dummy-hello.c -o dummy-hello.s 2>&5 + if test $? = 0; then + CFLAGS="$CFLAGS -D_PR_HAS_PRAGMA_DIAGNOSTIC=1" + _res=yes + else + _res=no + fi + else + _res=no + fi + rm -f dummy-hello.c dummy-hello.s + AC_MSG_RESULT([$_res]) +else + AC_MSG_RESULT([no]) +fi + +dnl ======================================================== dnl Profile guided optimization dnl ======================================================== dnl Test for profiling options @@ -1349,6 +1383,12 @@ AC_DEFINE(DARWIN) AC_DEFINE(HAVE_BSD_FLOCK) AC_DEFINE(HAVE_SOCKLEN_T) + AC_DEFINE(HAVE_POINTER_LOCALTIME_R) + changequote(,) + HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'` + changequote([,]) + if test "$HOST_DARWIN_MAJOR" -ge 15 ; then + AC_DEFINE(HAS_CONNECTX) AS='$(CC) -x assembler-with-cpp' CFLAGS="$CFLAGS -Wall -fno-common" case "${target_cpu}" in @@ -1789,6 +1829,7 @@ AC_DEFINE(XP_UNIX) AC_DEFINE(_GNU_SOURCE) AC_DEFINE(HAVE_FCNTL_FILE_LOCKING) + AC_DEFINE(HAVE_POINTER_LOCALTIME_R) case "${target}" in *-android*|*-linuxandroid*) OS_TARGET=Android diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/lib/ds/plvrsion.c new/nspr-4.15/nspr/lib/ds/plvrsion.c --- old/nspr-4.14/nspr/lib/ds/plvrsion.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/lib/ds/plvrsion.c 2017-06-05 22:16:00.000000000 +0200 @@ -74,6 +74,10 @@ #endif /* XP_UNIX */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint() { #ifdef XP_UNIX @@ -88,6 +92,9 @@ #endif return &VERSION_DESC_NAME; } /* versionEntryPointType */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif /* plvrsion.c */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/lib/libc/src/plvrsion.c new/nspr-4.15/nspr/lib/libc/src/plvrsion.c --- old/nspr-4.14/nspr/lib/libc/src/plvrsion.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/lib/libc/src/plvrsion.c 2017-06-05 22:16:00.000000000 +0200 @@ -74,6 +74,10 @@ #endif /* XP_UNIX */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint() { #ifdef XP_UNIX @@ -88,6 +92,9 @@ #endif return &VERSION_DESC_NAME; } /* versionEntryPointType */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif /* plvrsion.c */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/lib/prstreams/plvrsion.c new/nspr-4.15/nspr/lib/prstreams/plvrsion.c --- old/nspr-4.14/nspr/lib/prstreams/plvrsion.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/lib/prstreams/plvrsion.c 2017-06-05 22:16:00.000000000 +0200 @@ -74,6 +74,10 @@ #endif /* XP_UNIX */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint() { #ifdef XP_UNIX @@ -88,6 +92,9 @@ #endif return &VERSION_DESC_NAME; } /* versionEntryPointType */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif /* plvrsion.c */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/include/md/_win95.h new/nspr-4.15/nspr/pr/include/md/_win95.h --- old/nspr-4.14/nspr/pr/include/md/_win95.h 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/include/md/_win95.h 2017-06-05 22:16:00.000000000 +0200 @@ -290,6 +290,9 @@ extern PRInt32 _MD_CloseSocket(PROsfd osfd); #define _MD_CLOSE_SOCKET _MD_CloseSocket #define _MD_SENDTO _PR_MD_SENDTO +#ifdef _WIN64 +#define _MD_TCPSENDTO _PR_MD_TCPSENDTO +#endif #define _MD_RECVFROM _PR_MD_RECVFROM #define _MD_SOCKETPAIR(s, type, proto, sv) -1 #define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/include/prinit.h new/nspr-4.15/nspr/pr/include/prinit.h --- old/nspr-4.14/nspr/pr/include/prinit.h 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/include/prinit.h 2017-06-05 22:16:00.000000000 +0200 @@ -31,9 +31,9 @@ ** The format of the version string is ** "<major version>.<minor version>[.<patch level>] [<Beta>]" */ -#define PR_VERSION "4.14" +#define PR_VERSION "4.15" #define PR_VMAJOR 4 -#define PR_VMINOR 14 +#define PR_VMINOR 15 #define PR_VPATCH 0 #define PR_BETA PR_FALSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/include/private/primpl.h new/nspr-4.15/nspr/pr/include/private/primpl.h --- old/nspr-4.14/nspr/pr/include/private/primpl.h 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/include/private/primpl.h 2017-06-05 22:16:00.000000000 +0200 @@ -1225,6 +1225,13 @@ const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout); #define _PR_MD_SENDTO _MD_SENDTO +#if defined(_WIN64) && defined(WIN95) +extern PRInt32 _PR_MD_TCPSENDTO( + PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, + const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout); +#define _PR_MD_TCPSENDTO _MD_TCPSENDTO +#endif + extern PRInt32 _PR_MD_SOCKETPAIR(int af, int type, int flags, PROsfd *osfd); #define _PR_MD_SOCKETPAIR _MD_SOCKETPAIR @@ -1747,6 +1754,18 @@ * requires knowing the address family of the * socket, we save the address family here. */ #endif + +#if defined(_WIN64) + /* This is necessary for TCP Fast Open. TCP Fast Open in windows must + * use ConnectEx function which uses OVERLAPPED. TCPSendTo will call + * ConnectEx to send fast open data. If ConnectEx returns + * ERROR_IO_PENDING we need to save OVERLAPPED structure and we will + * use it in ConnectContinue to get the final result of ConnectEx. + */ + PRBool alreadyConnected; + PRBool overlappedActive; + OVERLAPPED ol; +#endif }; #ifdef _WIN64 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/include/prtypes.h new/nspr-4.15/nspr/pr/include/prtypes.h --- old/nspr-4.14/nspr/pr/include/prtypes.h 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/include/prtypes.h 2017-06-05 22:16:00.000000000 +0200 @@ -231,7 +231,7 @@ ** to use <stdint.h>. A patch to do that is in NSPR bug 634793. */ -#if defined(__APPLE__) || defined(__ANDROID__) || defined(__OpenBSD__) +#if defined(__APPLE__) || defined(__OpenBSD__) #define PR_ALTERNATE_INT64_TYPEDEF #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/io/prio.c new/nspr-4.15/nspr/pr/src/io/prio.c --- old/nspr-4.14/nspr/pr/src/io/prio.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/io/prio.c 2017-06-05 22:16:00.000000000 +0200 @@ -119,6 +119,10 @@ fd->methods = methods; fd->secret->state = _PR_FILEDESC_OPEN; fd->secret->md.osfd = osfd; +#if defined(_WIN64) + fd->secret->alreadyConnected = PR_FALSE; + fd->secret->overlappedActive = PR_FALSE; +#endif _PR_MD_INIT_FILEDESC(fd); } else { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/io/prlayer.c new/nspr-4.15/nspr/pr/src/io/prlayer.c --- old/nspr-4.14/nspr/pr/src/io/prlayer.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/io/prlayer.c 2017-06-05 22:16:00.000000000 +0200 @@ -652,9 +652,11 @@ if ((NULL != names) && (identity < length)) { /* what we did is still okay */ - memcpy( - names, identity_cache.name, - identity_cache.length * sizeof(char*)); + if (identity_cache.length != 0) { + memcpy( + names, identity_cache.name, + identity_cache.length * sizeof(char*)); + } old = identity_cache.name; identity_cache.name = names; identity_cache.length = length; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/io/prsocket.c new/nspr-4.15/nspr/pr/src/io/prsocket.c --- old/nspr-4.14/nspr/pr/src/io/prsocket.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/io/prsocket.c 2017-06-05 22:16:00.000000000 +0200 @@ -7,6 +7,12 @@ #include <string.h> +#if defined(_WIN64) +#ifndef SO_UPDATE_CONNECT_CONTEXT +#define SO_UPDATE_CONNECT_CONTEXT 0x7010 +#endif +#endif + /************************************************************************/ /* These two functions are only used in assertions. */ @@ -304,6 +310,48 @@ } PR_ASSERT(out_flags & PR_POLL_WRITE); + +#if defined(_WIN64) + if (fd->secret->alreadyConnected) { + fd->secret->alreadyConnected = PR_FALSE; + } + /* TCP Fast Open on Windows must use ConnectEx, which uses overlapped + * input/output. + * To get result we need to use GetOverlappedResult. */ + if (fd->secret->overlappedActive) { + PR_ASSERT(fd->secret->nonblocking); + PRInt32 rvSent; + if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) { + fd->secret->overlappedActive = FALSE; + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("SocketConnectContinue GetOverlappedResult succeeded\n")); + /* When ConnectEx is used, all previously set socket options and + * property are not enabled and to enable them + * SO_UPDATE_CONNECT_CONTEXT option need to be set. */ + if (setsockopt((SOCKET)osfd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0) != 0) { + err = WSAGetLastError(); + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("SocketConnectContinue setting SO_UPDATE_CONNECT_CONTEXT failed %d\n", err)); + _PR_MD_MAP_SETSOCKOPT_ERROR(err); + return PR_FAILURE; + } + return PR_SUCCESS; + } else { + err = WSAGetLastError(); + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("SocketConnectContinue GetOverlappedResult failed %d\n", err)); + if (err != ERROR_IO_PENDING) { + _PR_MD_MAP_CONNECT_ERROR(err); + fd->secret->overlappedActive = FALSE; + return PR_FAILURE; + } else { + PR_SetError(PR_IN_PROGRESS_ERROR, 0); + return PR_FAILURE; + } + } + } +#endif + return PR_SUCCESS; #elif defined(XP_OS2) @@ -768,6 +816,56 @@ return count; } +#if defined(_WIN64) && defined(WIN95) +static PRInt32 PR_CALLBACK SocketTCPSendTo( + PRFileDesc *fd, const void *buf, PRInt32 amount, + PRIntn flags, const PRNetAddr *addr, PRIntervalTime timeout) +{ + PRInt32 temp, count; + const PRNetAddr *addrp = addr; +#if defined(_PR_INET6) + PRNetAddr addrCopy; +#endif + PRThread *me = _PR_MD_CURRENT_THREAD(); + + if (_PR_PENDING_INTERRUPT(me)) { + me->flags &= ~_PR_INTERRUPT; + PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0); + return -1; + } + if (_PR_IO_PENDING(me)) { + PR_SetError(PR_IO_PENDING_ERROR, 0); + return -1; + } + + PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE); +#if defined(_PR_INET6) + if (addr->raw.family == PR_AF_INET6) { + addrCopy = *addr; + addrCopy.raw.family = AF_INET6; + addrp = &addrCopy; + } +#endif + + count = 0; + while (amount > 0) { + temp = _PR_MD_TCPSENDTO(fd, buf, amount, flags, + addrp, PR_NETADDR_SIZE(addr), timeout); + if (temp < 0) { + count = -1; + break; + } + count += temp; + if (fd->secret->nonblocking) { + break; + } + buf = (const void*) ((const char*)buf + temp); + amount -= temp; + } + return count; +} +#endif + static PRInt32 PR_CALLBACK SocketRecvFrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout) { @@ -1066,6 +1164,15 @@ PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags) { *out_flags = 0; + +#if defined(_WIN64) + if (in_flags & PR_POLL_WRITE) { + if (fd->secret->alreadyConnected) { + out_flags = PR_POLL_WRITE; + return PR_POLL_WRITE; + } + } +#endif return in_flags; } /* SocketPoll */ @@ -1090,7 +1197,11 @@ SocketRecv, SocketSend, (PRRecvfromFN)_PR_InvalidInt, +#if defined(_WIN64) && defined(WIN95) + SocketTCPSendTo, /* This is for fast open. We imitate Linux interface. */ +#else (PRSendtoFN)_PR_InvalidInt, +#endif SocketPoll, SocketAcceptRead, SocketTransmitFile, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/md/windows/w95sock.c new/nspr-4.15/nspr/pr/src/md/windows/w95sock.c --- old/nspr-4.14/nspr/pr/src/md/windows/w95sock.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/md/windows/w95sock.c 2017-06-05 22:16:00.000000000 +0200 @@ -330,6 +330,167 @@ return bytesSent; } +#if defined(_WIN64) + +static PRCallOnceType _pr_has_connectex_once; +typedef BOOL (WINAPI *_pr_win_connectex_ptr)(SOCKET, const struct sockaddr *, int, PVOID, DWORD, LPDWORD, LPOVERLAPPED); +#ifndef WSAID_CONNECTEX +#define WSAID_CONNECTEX \ + {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}} +#endif +#ifndef SIO_GET_EXTENSION_FUNCTION_POINTER +#define SIO_GET_EXTENSION_FUNCTION_POINTER 0xC8000006 +#endif +#ifndef TCP_FASTOPEN +#define TCP_FASTOPEN 15 +#endif + +#ifndef SO_UPDATE_CONNECT_CONTEXT +#define SO_UPDATE_CONNECT_CONTEXT 0x7010 +#endif + +static _pr_win_connectex_ptr _pr_win_connectex; + +static PRStatus PR_CALLBACK _pr_set_connectex(void) +{ + _pr_win_connectex = NULL; + SOCKET sock; + PRInt32 dwBytes; + int rc; + + /* Dummy socket needed for WSAIoctl */ + sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock == INVALID_SOCKET) + return PR_SUCCESS; + + GUID guid = WSAID_CONNECTEX; + rc = WSAIoctl(sock, SIO_GET_EXTENSION_FUNCTION_POINTER, + &guid, sizeof(guid), + &_pr_win_connectex, sizeof(_pr_win_connectex), + &dwBytes, NULL, NULL); + if (rc != 0) { + _pr_win_connectex = NULL; + return PR_SUCCESS; + } + + rc = closesocket(sock); + return PR_SUCCESS; +} + +PRInt32 +_PR_MD_TCPSENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, + const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout) +{ + if (PR_CallOnce(&_pr_has_connectex_once, _pr_set_connectex) != PR_SUCCESS) { + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; + } + + if (_pr_win_connectex == NULL) { + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; + } + + PROsfd osfd = fd->secret->md.osfd; + PRInt32 rv, err; + PRInt32 bytesSent = 0; + DWORD rvSent; + + BOOL option = 1; + rv = setsockopt((SOCKET)osfd, IPPROTO_TCP, TCP_FASTOPEN, (char*)&option, sizeof(option)); + if (rv != 0) { + err = WSAGetLastError(); + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("_PR_MD_TCPSENDTO error set opt TCP_FASTOPEN failed %d\n", err)); + if (err == WSAENOPROTOOPT) { + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + } else { + _PR_MD_MAP_SETSOCKOPT_ERROR(err); + } + return -1; + } + + /* ConnectEx requires the socket to be initially bound. We will use INADDR_ANY. */ + PRNetAddr bindAddr; + memset(&bindAddr, 0, sizeof(bindAddr)); + if (addr->raw.family == PR_AF_INET) { + bindAddr.inet.family = PR_AF_INET; + } else if (addr->raw.family == PR_AF_INET6) { + bindAddr.ipv6.family = PR_AF_INET6; + } + rv = bind((SOCKET)osfd, (SOCKADDR*) &bindAddr, sizeof(bindAddr)); + if (rv != 0) { + err = WSAGetLastError(); + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("_PR_MD_TCPSENDTO error bind failed %d\n", err)); + _PR_MD_MAP_SETSOCKOPT_ERROR(err); + return -1; + } + + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("_PR_MD_TCPSENDTO calling _pr_win_connectex %d %p\n", amount, (char*)buf)); + + rvSent = 0; + memset(&fd->secret->ol, 0, sizeof(fd->secret->ol)); + /* ConnectEx return TRUE on a success and FALSE on an error. */ + if (_pr_win_connectex( (SOCKET)osfd, (struct sockaddr *) addr, + addrlen, buf, amount, + &rvSent, &fd->secret->ol) == TRUE) { + /* When ConnectEx is used, all previously set socket options and + * property are not enabled and to enable them + * SO_UPDATE_CONNECT_CONTEXT option need to be set. */ + rv = setsockopt((SOCKET)osfd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0); + if (rv != 0) { + err = WSAGetLastError(); + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("_PR_MD_TCPSENDTO setting SO_UPDATE_CONNECT_CONTEXT failed %d\n", err)); + _PR_MD_MAP_SETSOCKOPT_ERROR(err); + return -1; + } + /* We imitate Linux here. SendTo will return number of bytes send but + * it can not return connection success at the same time, so we return + * number of bytes send and "connection success" will be return on the + * connectcontinue. */ + fd->secret->alreadyConnected = PR_TRUE; + return rvSent; + } else { + err = WSAGetLastError(); + PR_LOG(_pr_io_lm, PR_LOG_MIN, + ("_PR_MD_TCPSENDTO error _pr_win_connectex failed %d\n", err)); + if (err != ERROR_IO_PENDING) { + _PR_MD_MAP_CONNECT_ERROR(err); + return -1; + } else if (fd->secret->nonblocking) { + /* Remember that overlapped structure is set. We will neede to get + * the final result of ConnectEx call. */ + fd->secret->overlappedActive = PR_TRUE; + _PR_MD_MAP_CONNECT_ERROR(WSAEWOULDBLOCK); + /* ConnectEx will copy supplied data to a internal buffer and send + * them during Fast Open or after connect. Therefore we can assumed + * this data already send. */ + return amount; + } + while (err == ERROR_IO_PENDING) { + rv = socket_io_wait(osfd, WRITE_FD, timeout); + if ( rv < 0 ) { + return -1; + } + rv = GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE); + if ( rv == TRUE ) { + return rvSent; + } else { + err = WSAGetLastError(); + if (err != ERROR_IO_PENDING) { + _PR_MD_MAP_CONNECT_ERROR(err); + return -1; + } + } + } + } + return -1; +} +#endif + PRInt32 _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/misc/praton.c new/nspr-4.15/nspr/pr/src/misc/praton.c --- old/nspr-4.14/nspr/pr/src/misc/praton.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/misc/praton.c 2017-06-05 22:16:00.000000000 +0200 @@ -177,19 +177,21 @@ case 2: /*%< a.b -- 8.24 bits */ if (val > 0xffffffU) return (0); - val |= parts[0] << 24; + val |= (unsigned int)parts[0] << 24; break; case 3: /*%< a.b.c -- 8.8.16 bits */ if (val > 0xffffU) return (0); - val |= (parts[0] << 24) | (parts[1] << 16); + val |= ((unsigned int)parts[0] << 24) | ((unsigned int)parts[1] << 16); break; case 4: /*%< a.b.c.d -- 8.8.8.8 bits */ if (val > 0xffU) return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + val |= ((unsigned int)parts[0] << 24) | + ((unsigned int)parts[1] << 16) | + ((unsigned int)parts[2] << 8); break; } *addr = PR_htonl(val); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/misc/prnetdb.c new/nspr-4.15/nspr/pr/src/misc/prnetdb.c --- old/nspr-4.14/nspr/pr/src/misc/prnetdb.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/misc/prnetdb.c 2017-06-05 22:16:00.000000000 +0200 @@ -1405,7 +1405,7 @@ PRStatus rv = PR_SUCCESS; if (!_pr_initialized) _PR_ImplicitInitialization(); - if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet)); + if (val != PR_IpAddrNull) memset(addr, 0, sizeof(*addr)); addr->inet.family = AF_INET; addr->inet.port = htons(port); switch (val) @@ -1777,18 +1777,12 @@ #ifdef IS_BIG_ENDIAN return n; #else - PRUint64 tmp; PRUint32 hi, lo; - LL_L2UI(lo, n); - LL_SHR(tmp, n, 32); - LL_L2UI(hi, tmp); + lo = (PRUint32)n; + hi = (PRUint32)(n >> 32); hi = PR_ntohl(hi); lo = PR_ntohl(lo); - LL_UI2L(n, lo); - LL_SHL(n, n, 32); - LL_UI2L(tmp, hi); - LL_ADD(n, n, tmp); - return n; + return ((PRUint64)lo << 32) + (PRUint64)hi; #endif } /* ntohll */ @@ -1797,18 +1791,12 @@ #ifdef IS_BIG_ENDIAN return n; #else - PRUint64 tmp; PRUint32 hi, lo; - LL_L2UI(lo, n); - LL_SHR(tmp, n, 32); - LL_L2UI(hi, tmp); + lo = (PRUint32)n; + hi = (PRUint32)(n >> 32); hi = htonl(hi); lo = htonl(lo); - LL_UI2L(n, lo); - LL_SHL(n, n, 32); - LL_UI2L(tmp, hi); - LL_ADD(n, n, tmp); - return n; + return ((PRUint64)lo << 32) + (PRUint64)hi; #endif } /* htonll */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/misc/prtime.c new/nspr-4.15/nspr/pr/src/misc/prtime.c --- old/nspr-4.14/nspr/pr/src/misc/prtime.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/misc/prtime.c 2017-06-05 22:16:00.000000000 +0200 @@ -495,6 +495,20 @@ #define MT_safe_localtime localtime_r +#elif defined(_MSC_VER) + +/* Visual C++ has had localtime_s() since Visual C++ 2005. */ + +static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result) +{ + errno_t err = localtime_s(result, clock); + if (err != 0) { + errno = err; + return NULL; + } + return result; +} + #else #define HAVE_LOCALTIME_MONITOR 1 /* We use 'monitor' to serialize our calls @@ -580,6 +594,7 @@ PRTimeParameters retVal; struct tm localTime; + struct tm *localTimeResult; time_t secs; PRTime secs64; PRInt64 usecPerSec; @@ -606,7 +621,12 @@ */ secs = 86400L; - (void) MT_safe_localtime(&secs, &localTime); + localTimeResult = MT_safe_localtime(&secs, &localTime); + PR_ASSERT(localTimeResult != NULL); + if (localTimeResult == NULL) { + /* Shouldn't happen. Use safe fallback for optimized builds. */ + return PR_GMTParameters(gmt); + } /* GMT is 00:00:00, 2nd of Jan. */ @@ -957,6 +977,7 @@ int hour = -1; int min = -1; int sec = -1; + struct tm *localTimeResult; const char *rest = string; @@ -1618,7 +1639,11 @@ zone_offset for the date we are parsing is the same as the zone offset on 00:00:00 2 Jan 1970 GMT. */ secs = 86400; - (void) MT_safe_localtime(&secs, &localTime); + localTimeResult = MT_safe_localtime(&secs, &localTime); + PR_ASSERT(localTimeResult != NULL); + if (localTimeResult == NULL) { + return PR_FAILURE; + } zone_offset = localTime.tm_min + 60 * localTime.tm_hour + 1440 * (localTime.tm_mday - 2); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/prvrsion.c new/nspr-4.15/nspr/pr/src/prvrsion.c --- old/nspr-4.14/nspr/pr/src/prvrsion.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/prvrsion.c 2017-06-05 22:16:00.000000000 +0200 @@ -74,6 +74,10 @@ #endif /* XP_UNIX */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void) { #ifdef XP_UNIX @@ -88,6 +92,9 @@ #endif return &VERSION_DESC_NAME; } /* versionEntryPointType */ +#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif /* prvrsion.c */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/src/pthreads/ptio.c new/nspr-4.15/nspr/pr/src/pthreads/ptio.c --- old/nspr-4.14/nspr/pr/src/pthreads/ptio.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/src/pthreads/ptio.c 2017-06-05 22:16:00.000000000 +0200 @@ -164,6 +164,9 @@ #ifndef TCP_CORK #define TCP_CORK 3 #endif +#ifndef MSG_FASTOPEN +#define MSG_FASTOPEN 0x20000000 +#endif #endif #ifdef _PR_IPV6_V6ONLY_PROBE @@ -1542,23 +1545,26 @@ pt_SockLen addr_len; const PRNetAddr *addrp = addr; #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6) - PRUint16 md_af = addr->raw.family; PRNetAddr addrCopy; #endif +#ifdef _PR_HAVE_SOCKADDR_LEN + PRUint16 md_af = addr->raw.family; +#endif if (pt_TestAbort()) return PR_FAILURE; PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE); addr_len = PR_NETADDR_SIZE(addr); -#if defined(_PR_INET6) - if (addr->raw.family == PR_AF_INET6) { - md_af = AF_INET6; -#ifndef _PR_HAVE_SOCKADDR_LEN - addrCopy = *addr; - addrCopy.raw.family = AF_INET6; - addrp = &addrCopy; +#ifdef _PR_INET6 + if (addr->raw.family == PR_AF_INET6) { +#ifdef _PR_HAVE_SOCKADDR_LEN + md_af = AF_INET6; +#else + addrCopy = *addr; + addrCopy.raw.family = AF_INET6; + addrp = &addrCopy; #endif - } + } #endif #ifdef _PR_HAVE_SOCKADDR_LEN @@ -1732,9 +1738,11 @@ pt_SockLen addr_len; const PRNetAddr *addrp = addr; #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6) - PRUint16 md_af = addr->raw.family; PRNetAddr addrCopy; #endif +#ifdef _PR_HAVE_SOCKADDR_LEN + PRUint16 md_af = addr->raw.family; +#endif if (pt_TestAbort()) return PR_FAILURE; @@ -1749,15 +1757,16 @@ } } -#if defined(_PR_INET6) - if (addr->raw.family == PR_AF_INET6) { - md_af = AF_INET6; -#ifndef _PR_HAVE_SOCKADDR_LEN - addrCopy = *addr; - addrCopy.raw.family = AF_INET6; - addrp = &addrCopy; +#ifdef _PR_INET6 + if (addr->raw.family == PR_AF_INET6) { +#ifdef _PR_HAVE_SOCKADDR_LEN + md_af = AF_INET6; +#else + addrCopy = *addr; + addrCopy.raw.family = AF_INET6; + addrp = &addrCopy; #endif - } + } #endif addr_len = PR_NETADDR_SIZE(addr); @@ -1989,22 +1998,25 @@ pt_SockLen addr_len; const PRNetAddr *addrp = addr; #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6) - PRUint16 md_af = addr->raw.family; PRNetAddr addrCopy; #endif +#ifdef _PR_HAVE_SOCKADDR_LEN + PRUint16 md_af = addr->raw.family; +#endif if (pt_TestAbort()) return bytes; PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE); -#if defined(_PR_INET6) - if (addr->raw.family == PR_AF_INET6) { - md_af = AF_INET6; -#ifndef _PR_HAVE_SOCKADDR_LEN - addrCopy = *addr; - addrCopy.raw.family = AF_INET6; - addrp = &addrCopy; +#ifdef _PR_INET6 + if (addr->raw.family == PR_AF_INET6) { +#ifdef _PR_HAVE_SOCKADDR_LEN + md_af = AF_INET6; +#else + addrCopy = *addr; + addrCopy.raw.family = AF_INET6; + addrp = &addrCopy; #endif - } + } #endif addr_len = PR_NETADDR_SIZE(addr); @@ -2044,6 +2056,101 @@ return bytes; } /* pt_SendTo */ +#if defined(LINUX) || defined(DARWIN) +/* Linux uses SendTo to send data during TCP Fast Open. OSX uses connectx, but + * we will make it imitate the Linux's interface. */ +static PRInt32 pt_TCP_SendTo( + PRFileDesc *fd, const void *buf, + PRInt32 amount, PRIntn flags, const PRNetAddr *addr, + PRIntervalTime timeout) +{ +#if defined(LINUX) || HAS_CONNECTX + PRInt32 syserrno, bytes = -1; + PRBool fNeedContinue = PR_FALSE; + pt_SockLen addr_len; + const PRNetAddr *addrp = addr; +#if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6) + PRNetAddr addrCopy; +#endif +#ifdef _PR_HAVE_SOCKADDR_LEN + PRUint16 md_af = addr->raw.family; +#endif + + if (pt_TestAbort()) return bytes; + + PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE); + addr_len = PR_NETADDR_SIZE(addr); +#if defined(_PR_INET6) + if (addr->raw.family == PR_AF_INET6) { +#ifdef _PR_HAVE_SOCKADDR_LEN + md_af = AF_INET6; +#else + /* If _PR_INET6 is defined and it is PR_AF_INET6 we set family + * to AF_INET6. */ + addrCopy = *addr; + addrCopy.raw.family = AF_INET6; + addrp = &addrCopy; +#endif + } +#endif + +#ifdef _PR_HAVE_SOCKADDR_LEN + /* if _PR_HAVE_SOCKADDR_LEN is defined and it is PR_AF_INET6 we set family + * to AF_INET6 and we set address length. */ + addrCopy = *addr; + ((struct sockaddr*)&addrCopy)->sa_len = addr_len; + ((struct sockaddr*)&addrCopy)->sa_family = md_af; + addrp = &addrCopy; +#endif + +#ifndef HAS_CONNECTX + bytes = sendto( + fd->secret->md.osfd, buf, amount, MSG_FASTOPEN, + (struct sockaddr*)addrp, addr_len); +#else + sa_endpoints_t endpoints; + endpoints.sae_srcif = 0; + endpoints.sae_srcaddr = NULL; + endpoints.sae_srcaddrlen = 0; + endpoints.sae_dstaddr = (struct sockaddr *)addrp; + endpoints.sae_dstaddrlen = addr_len; + struct iovec iov[1]; + iov[0].iov_base = buf; + iov[0].iov_len = amount; + PRInt32 rv = connectx(fd->secret->md.osfd, &endpoints, SAE_ASSOCID_ANY, + CONNECT_DATA_IDEMPOTENT, iov, 1, &bytes, NULL); +#endif + syserrno = errno; + if ( (bytes == -1) && (syserrno == EWOULDBLOCK || syserrno == EAGAIN) + && (!fd->secret->nonblocking) ) { + if (PR_INTERVAL_NO_WAIT == timeout) syserrno = ETIMEDOUT; + else fNeedContinue = PR_TRUE; + } + if (fNeedContinue == PR_TRUE) { + pt_Continuation op; + op.arg1.osfd = fd->secret->md.osfd; + op.arg2.buffer = (void*)buf; + op.arg3.amount = amount; + op.arg4.flags = flags; + op.arg5.addr = (PRNetAddr*)addrp; + op.timeout = timeout; + op.result.code = 0; /* initialize the number sent */ + op.function = pt_sendto_cont; + op.event = POLLOUT | POLLPRI; + bytes = pt_Continue(&op); + syserrno = op.syserrno; + } + if (bytes < 0) { + pt_MapError(_PR_MD_MAP_SENDTO_ERROR, syserrno); + } + return bytes; +#else /* !HAS_CONNECTX */ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return -1; +#endif +} /* pt_TCP_SendTo */ +#endif /* LINUX || DARWIN */ + static PRInt32 pt_RecvFrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout) { @@ -3155,7 +3262,11 @@ pt_Recv, pt_Send, (PRRecvfromFN)_PR_InvalidInt, +#if defined(LINUX) || defined(DARWIN) + pt_TCP_SendTo, /* This is for TCP Fast Open. Linux uses SendTo function for this. OSX uses connectx, but we imitate Linux. */ +#else (PRSendtoFN)_PR_InvalidInt, +#endif pt_Poll, pt_AcceptRead, pt_TransmitFile, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nspr-4.14/nspr/pr/tests/vercheck.c new/nspr-4.15/nspr/pr/tests/vercheck.c --- old/nspr-4.14/nspr/pr/tests/vercheck.c 2017-03-24 11:50:01.000000000 +0100 +++ new/nspr-4.15/nspr/pr/tests/vercheck.c 2017-06-05 22:16:00.000000000 +0200 @@ -39,7 +39,7 @@ "4.9.6", "4.10", "4.10.1", "4.10.2", "4.10.3", "4.10.4", "4.10.5", "4.10.6", "4.10.7", "4.10.8", "4.10.9", - "4.10.10", "4.11", "4.12", "4.13", + "4.10.10", "4.11", "4.12", "4.13", "4.14" PR_VERSION }; @@ -55,8 +55,8 @@ "3.0", "3.0.1", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.5", "3.5.1", - "4.14.1", - "4.15", "4.15.1", + "4.15.1", + "4.16", "4.16.1", "10.0", "11.1", "12.14.20" };
