# HG changeset patch # User Matt Barden # Date 1374175121 14400 # Node ID eac51815a73bb2e398607dff91bbef476c0166cc # Parent 6db1b9319cfcd5f23109ba95411f8f267736e413 3869 tcp anon port calculation wrong Reviewed by: Dan McDonald Reviewed by: Robert Mustacchi Reviewed by: Marcel Telka Approved by: Gordon Ross diff -r 6db1b9319cfc -r eac51815a73b usr/src/uts/common/inet/tcp/tcp_bind.c --- 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 @@ -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); diff -r 6db1b9319cfc -r eac51815a73b usr/src/uts/common/inet/udp/udp.c --- 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);