Print this page
OS-4018 lxbrand support TCP SO_REUSEPORT
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Cody Mello <cody.mello@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp/tcp.c
          +++ new/usr/src/uts/common/inet/tcp/tcp.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  24      - * Copyright (c) 2011, Joyent Inc. All rights reserved.
       24 + * Copyright 2015 Joyent, Inc.
  25   25   * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  26   26   * Copyright (c) 2013,2014 by Delphix. All rights reserved.
  27   27   * Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
  28   28   */
  29   29  /* Copyright (c) 1990 Mentat Inc. */
  30   30  
  31   31  #include <sys/types.h>
  32   32  #include <sys/stream.h>
  33   33  #include <sys/strsun.h>
  34   34  #include <sys/strsubr.h>
↓ open down ↓ 1381 lines elided ↑ open up ↑
1416 1416          ASSERT(tcp->tcp_rthdrlen == 0);
1417 1417  
1418 1418          /*
1419 1419           * Following is really a blowing away a union.
1420 1420           * It happens to have exactly two members of identical size
1421 1421           * the following code is enough.
1422 1422           */
1423 1423          tcp_close_mpp(&tcp->tcp_conn.tcp_eager_conn_ind);
1424 1424  
1425 1425          /*
     1426 +         * Destroy any association with SO_REUSEPORT group.
     1427 +         */
     1428 +        if (tcp->tcp_rg_bind != NULL) {
     1429 +                /*
     1430 +                 * This is only necessary for connections which enabled
     1431 +                 * SO_REUSEPORT but were never bound.  Such connections should
     1432 +                 * be the one and only member of the tcp_rg_tp to which they
     1433 +                 * have been associated.
     1434 +                 */
     1435 +                VERIFY(tcp_rg_remove(tcp->tcp_rg_bind, tcp));
     1436 +                tcp_rg_destroy(tcp->tcp_rg_bind);
     1437 +                tcp->tcp_rg_bind = NULL;
     1438 +        }
     1439 +
     1440 +        /*
1426 1441           * If this is a non-STREAM socket still holding on to an upper
1427 1442           * handle, release it. As a result of fallback we might also see
1428 1443           * STREAMS based conns with upper handles, in which case there is
1429 1444           * nothing to do other than clearing the field.
1430 1445           */
1431 1446          if (connp->conn_upper_handle != NULL) {
1432 1447                  if (IPCL_IS_NONSTR(connp)) {
1433 1448                          (*connp->conn_upcalls->su_closed)(
1434 1449                              connp->conn_upper_handle);
1435 1450                          tcp->tcp_detached = B_TRUE;
↓ open down ↓ 611 lines elided ↑ open up ↑
2047 2062  }
2048 2063  
2049 2064  /*
2050 2065   * Force values to zero that need be zero.
2051 2066   * Do not touch values asociated with the BOUND or LISTEN state
2052 2067   * since the connection will end up in that state after the reinit.
2053 2068   * NOTE: tcp_reinit_values MUST have a line for each field in the tcp_t
2054 2069   * structure!
2055 2070   */
2056 2071  static void
2057      -tcp_reinit_values(tcp)
2058      -        tcp_t *tcp;
     2072 +tcp_reinit_values(tcp_t *tcp)
2059 2073  {
2060 2074          tcp_stack_t     *tcps = tcp->tcp_tcps;
2061 2075          conn_t          *connp = tcp->tcp_connp;
2062 2076  
2063 2077  #ifndef lint
2064 2078  #define DONTCARE(x)
2065 2079  #define PRESERVE(x)
2066 2080  #else
2067 2081  #define DONTCARE(x)     ((x) = (x))
2068 2082  #define PRESERVE(x)     ((x) = (x))
↓ open down ↓ 2415 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX