From 79f2bd8e3a1eead996e0e18e68eac42e128b4f1c Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Fri, 23 May 2014 10:51:29 -0700 Subject: [PATCH] Bug 891551: Update NSPR to NSPR_4_10_6_BETA1, which also includes fixes for bug 1003946, bug 1009270, and bug 1011861. --- nsprpub/TAG-INFO | 2 +- nsprpub/config/nsinstall.c | 1 - nsprpub/config/prdepend.h | 1 - nsprpub/configure | 2 +- nsprpub/configure.in | 2 +- nsprpub/pr/include/md/_linux.h | 2 +- nsprpub/pr/include/prinit.h | 6 +++--- nsprpub/pr/include/prio.h | 4 ++++ nsprpub/pr/src/io/prmapopt.c | 12 +++++++++--- nsprpub/pr/src/misc/prsystem.c | 5 ++++- nsprpub/pr/src/pthreads/ptio.c | 2 ++ nsprpub/pr/tests/sockopt.c | 10 ++++++++++ nsprpub/pr/tests/vercheck.c | 9 +++++---- 13 files changed, 41 insertions(+), 17 deletions(-) diff --git a/nsprpub/TAG-INFO b/nsprpub/TAG-INFO index c07d5a069b0..cfba5776944 100644 --- a/nsprpub/TAG-INFO +++ b/nsprpub/TAG-INFO @@ -1 +1 @@ -NSPR_4_10_5_RTM +NSPR_4_10_6_BETA1 diff --git a/nsprpub/config/nsinstall.c b/nsprpub/config/nsinstall.c index 3396dcb8ecc..f1d2cff26de 100644 --- a/nsprpub/config/nsinstall.c +++ b/nsprpub/config/nsinstall.c @@ -208,7 +208,6 @@ main(int argc, char **argv) todir = malloc(PATH_MAX + 1); todir = getcwd(todir, PATH_MAX); #endif - tdlen = strlen(todir); xchdir(cwd); tdlen = strlen(todir); diff --git a/nsprpub/config/prdepend.h b/nsprpub/config/prdepend.h index 6c66b37ca0f..e49e92677e3 100644 --- a/nsprpub/config/prdepend.h +++ b/nsprpub/config/prdepend.h @@ -10,4 +10,3 @@ */ #error "Do not include this header file." - diff --git a/nsprpub/configure b/nsprpub/configure index 92d4e7c391c..c7ed0b68624 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -2487,7 +2487,7 @@ test -n "$target_alias" && MOD_MAJOR_VERSION=4 MOD_MINOR_VERSION=10 -MOD_PATCH_VERSION=5 +MOD_PATCH_VERSION=6 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= diff --git a/nsprpub/configure.in b/nsprpub/configure.in index f68093a91b9..d8539846578 100644 --- a/nsprpub/configure.in +++ b/nsprpub/configure.in @@ -16,7 +16,7 @@ dnl = Defaults dnl ======================================================== MOD_MAJOR_VERSION=4 MOD_MINOR_VERSION=10 -MOD_PATCH_VERSION=5 +MOD_PATCH_VERSION=6 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= diff --git a/nsprpub/pr/include/md/_linux.h b/nsprpub/pr/include/md/_linux.h index 43e6da2430f..278f90cd6c9 100644 --- a/nsprpub/pr/include/md/_linux.h +++ b/nsprpub/pr/include/md/_linux.h @@ -80,7 +80,7 @@ #define NO_DLOPEN_NULL #endif -#ifdef __FreeBSD_kernel__ +#if defined(__FreeBSD_kernel__) || defined(__GNU__) #define _PR_HAVE_SOCKADDR_LEN #endif diff --git a/nsprpub/pr/include/prinit.h b/nsprpub/pr/include/prinit.h index 36b3b596f4f..24b76c05778 100644 --- a/nsprpub/pr/include/prinit.h +++ b/nsprpub/pr/include/prinit.h @@ -31,11 +31,11 @@ PR_BEGIN_EXTERN_C ** The format of the version string is ** ".[.] []" */ -#define PR_VERSION "4.10.5" +#define PR_VERSION "4.10.6 Beta" #define PR_VMAJOR 4 #define PR_VMINOR 10 -#define PR_VPATCH 5 -#define PR_BETA PR_FALSE +#define PR_VPATCH 6 +#define PR_BETA PR_TRUE /* ** PRVersionCheck diff --git a/nsprpub/pr/include/prio.h b/nsprpub/pr/include/prio.h index 72397c8ea2d..c7e85db41f3 100644 --- a/nsprpub/pr/include/prio.h +++ b/nsprpub/pr/include/prio.h @@ -211,6 +211,8 @@ typedef enum PRSockOption PR_SockOpt_NoDelay, /* don't delay send to coalesce packets */ PR_SockOpt_MaxSegment, /* maximum segment size */ PR_SockOpt_Broadcast, /* enable broadcast */ + PR_SockOpt_Reuseport, /* allow local address & port reuse on + * platforms that support it */ PR_SockOpt_Last } PRSockOption; @@ -234,6 +236,8 @@ typedef struct PRSocketOptionData PRUintn tos; /* IP type of service and precedence */ PRBool non_blocking; /* Non-blocking (network) I/O */ PRBool reuse_addr; /* Allow local address reuse */ + PRBool reuse_port; /* Allow local address & port reuse on + * platforms that support it */ PRBool keep_alive; /* Keep connections alive */ PRBool mcast_loopback; /* IP multicast loopback */ PRBool no_delay; /* Don't delay send to coalesce packets */ diff --git a/nsprpub/pr/src/io/prmapopt.c b/nsprpub/pr/src/io/prmapopt.c index 43e8f9cb766..f92a76b2bd6 100644 --- a/nsprpub/pr/src/io/prmapopt.c +++ b/nsprpub/pr/src/io/prmapopt.c @@ -85,6 +85,7 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat case PR_SockOpt_Keepalive: case PR_SockOpt_NoDelay: case PR_SockOpt_Broadcast: + case PR_SockOpt_Reuseport: { #ifdef WIN32 /* Winsock */ BOOL value; @@ -236,6 +237,7 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt case PR_SockOpt_Keepalive: case PR_SockOpt_NoDelay: case PR_SockOpt_Broadcast: + case PR_SockOpt_Reuseport: { #ifdef WIN32 /* Winsock */ BOOL value; @@ -412,10 +414,14 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt #define TCP_MAXSEG _PR_NO_SUCH_SOCKOPT #endif -#ifndef SO_BROADCAST /* enable broadcast on udp sockets */ +#ifndef SO_BROADCAST /* enable broadcast on UDP sockets */ #define SO_BROADCAST _PR_NO_SUCH_SOCKOPT #endif +#ifndef SO_REUSEPORT /* allow local address & port reuse */ +#define SO_REUSEPORT _PR_NO_SUCH_SOCKOPT +#endif + PRStatus _PR_MapOptionName( PRSockOption optname, PRInt32 *level, PRInt32 *name) { @@ -424,14 +430,14 @@ PRStatus _PR_MapOptionName( 0, SO_LINGER, SO_REUSEADDR, SO_KEEPALIVE, SO_RCVBUF, SO_SNDBUF, IP_TTL, IP_TOS, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MULTICAST_IF, IP_MULTICAST_TTL, IP_MULTICAST_LOOP, - TCP_NODELAY, TCP_MAXSEG, SO_BROADCAST + TCP_NODELAY, TCP_MAXSEG, SO_BROADCAST, SO_REUSEPORT }; static PRInt32 socketLevels[PR_SockOpt_Last] = { 0, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET, IPPROTO_IP, IPPROTO_IP, IPPROTO_IP, IPPROTO_IP, IPPROTO_IP, IPPROTO_IP, IPPROTO_IP, - IPPROTO_TCP, IPPROTO_TCP, SOL_SOCKET + IPPROTO_TCP, IPPROTO_TCP, SOL_SOCKET, SOL_SOCKET }; if ((optname < PR_SockOpt_Linger) diff --git a/nsprpub/pr/src/misc/prsystem.c b/nsprpub/pr/src/misc/prsystem.c index 9579fcc931f..7a250713a68 100644 --- a/nsprpub/pr/src/misc/prsystem.c +++ b/nsprpub/pr/src/misc/prsystem.c @@ -33,6 +33,7 @@ #if defined(DARWIN) #include #include +#include #endif #if defined(HPUX) @@ -297,13 +298,15 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) #elif defined(DARWIN) + mach_port_t mach_host = mach_host_self(); struct host_basic_info hInfo; mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; - int result = host_info(mach_host_self(), + int result = host_info(mach_host, HOST_BASIC_INFO, (host_info_t) &hInfo, &count); + mach_port_deallocate(mach_task_self(), mach_host); if (result == KERN_SUCCESS) bytes = hInfo.max_mem; diff --git a/nsprpub/pr/src/pthreads/ptio.c b/nsprpub/pr/src/pthreads/ptio.c index b92749bb118..125f1f93f53 100644 --- a/nsprpub/pr/src/pthreads/ptio.c +++ b/nsprpub/pr/src/pthreads/ptio.c @@ -2854,6 +2854,7 @@ static PRStatus pt_GetSocketOption(PRFileDesc *fd, PRSocketOptionData *data) case PR_SockOpt_Keepalive: case PR_SockOpt_NoDelay: case PR_SockOpt_Broadcast: + case PR_SockOpt_Reuseport: { PRIntn value; length = sizeof(PRIntn); @@ -2973,6 +2974,7 @@ static PRStatus pt_SetSocketOption(PRFileDesc *fd, const PRSocketOptionData *dat case PR_SockOpt_Keepalive: case PR_SockOpt_NoDelay: case PR_SockOpt_Broadcast: + case PR_SockOpt_Reuseport: { PRIntn value = (data->value.reuse_addr) ? 1 : 0; rv = setsockopt( diff --git a/nsprpub/pr/tests/sockopt.c b/nsprpub/pr/tests/sockopt.c index 66b40277636..158b8292554 100644 --- a/nsprpub/pr/tests/sockopt.c +++ b/nsprpub/pr/tests/sockopt.c @@ -11,6 +11,10 @@ #include "plerror.h" +#ifdef XP_UNIX +#include /* SO_REUSEPORT */ +#endif + static PRFileDesc *err = NULL; static PRBool failed = PR_FALSE; @@ -54,6 +58,7 @@ int main(int argc, char **argv) "PR_SockOpt_NoDelay", /* don't delay send to coalesce packets */ "PR_SockOpt_MaxSegment", /* maximum segment size */ "PR_SockOpt_Broadcast", /* Enable broadcast */ + "PR_SockOpt_Reuseport", /* allow local address & port reuse */ "PR_SockOpt_Last" }; @@ -129,6 +134,11 @@ int main(int argc, char **argv) fd = udp; data.value.broadcast = PR_TRUE; break; +#endif +#ifdef SO_REUSEPORT + case PR_SockOpt_Reuseport: + data.value.reuse_port = PR_TRUE; + break; #endif default: continue; } diff --git a/nsprpub/pr/tests/vercheck.c b/nsprpub/pr/tests/vercheck.c index 7af0594cb15..256e5ed304e 100644 --- a/nsprpub/pr/tests/vercheck.c +++ b/nsprpub/pr/tests/vercheck.c @@ -20,10 +20,10 @@ #include /* - * This release (4.10.5) is backward compatible with the + * This release (4.10.6) is backward compatible with the * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x, - * 4.8.x, 4.9.x, 4.10, 4.10.1, 4.10.2, 4.10.3, and 4.10.4 - * releases. + * 4.8.x, 4.9.x, 4.10, 4.10.1, 4.10.2, 4.10.3, 4.10.4, and + * 4.10.5 releases. * It, of course, is compatible with itself. */ static char *compatible_version[] = { @@ -39,6 +39,7 @@ static char *compatible_version[] = { "4.9", "4.9.1", "4.9.2", "4.9.3", "4.9.4", "4.9.5", "4.9.6", "4.10", "4.10.1", "4.10.2", "4.10.3", "4.10.4", + "4.10.5", PR_VERSION }; @@ -54,7 +55,7 @@ static char *incompatible_version[] = { "3.0", "3.0.1", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.5", "3.5.1", - "4.10.6", + "4.10.7", "4.11", "4.11.1", "10.0", "11.1", "12.14.20" };