changeset 14083:eac51815a73b

3869 tcp anon port calculation wrong Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Marcel Telka <marcel@telka.sk> Approved by: Gordon Ross <gwr@nexenta.com>
author Matt Barden <matt.barden@nexenta.com>
date Thu, 18 Jul 2013 15:18:41 -0400
parents 6db1b9319cfc
children 9919574e3322
files usr/src/uts/common/inet/tcp/tcp_bind.c usr/src/uts/common/inet/udp/udp.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/inet/tcp/tcp_bind.c	Wed Jul 17 15:47:52 2013 -0400
+++ b/usr/src/uts/common/inet/tcp/tcp_bind.c	Thu Jul 18 15:18:41 2013 -0400
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -227,7 +228,8 @@
 		 * port to get the random port.  It should fall into the
 		 * valid anon port range.
 		 */
-		if (port < tcps->tcps_smallest_anon_port) {
+		if ((port < tcps->tcps_smallest_anon_port) ||
+		    (port > tcps->tcps_largest_anon_port)) {
 			port = tcps->tcps_smallest_anon_port +
 			    port % (tcps->tcps_largest_anon_port -
 			    tcps->tcps_smallest_anon_port);
--- a/usr/src/uts/common/inet/udp/udp.c	Wed Jul 17 15:47:52 2013 -0400
+++ b/usr/src/uts/common/inet/udp/udp.c	Thu Jul 18 15:18:41 2013 -0400
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
  */
 /* Copyright (c) 1990 Mentat Inc. */
 
@@ -2538,7 +2539,8 @@
 		 * port to get the random port.  It should fall into the
 		 * valid anon port range.
 		 */
-		if (port < us->us_smallest_anon_port) {
+		if ((port < us->us_smallest_anon_port) ||
+		    (port > us->us_largest_anon_port)) {
 			port = us->us_smallest_anon_port +
 			    port % (us->us_largest_anon_port -
 			    us->us_smallest_anon_port);