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_socket.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_socket.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) 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2015 Joyent, Inc.
  24   25   */
  25   26  
  26   27  /* This file contains all TCP kernel socket related functions. */
  27   28  
  28   29  #include <sys/types.h>
  29   30  #include <sys/strlog.h>
  30   31  #include <sys/policy.h>
  31   32  #include <sys/sockio.h>
  32   33  #include <sys/strsubr.h>
  33   34  #include <sys/strsun.h>
↓ open down ↓ 980 lines elided ↑ open up ↑
1014 1015           * Enter the squeue so that no new packets can come in
1015 1016           */
1016 1017          error = squeue_synch_enter(connp, NULL);
1017 1018          if (error != 0) {
1018 1019                  /* failed to enter, free all the pre-allocated messages. */
1019 1020                  freeb(stropt_mp);
1020 1021                  freeb(ordrel_mp);
1021 1022                  return (ENOMEM);
1022 1023          }
1023 1024  
     1025 +        /*
     1026 +         * Do not allow fallback on connections making use of SO_REUSEPORT.
     1027 +         */
     1028 +        if (tcp->tcp_rg_bind != NULL) {
     1029 +                freeb(stropt_mp);
     1030 +                freeb(ordrel_mp);
     1031 +                squeue_synch_exit(connp);
     1032 +                return (EINVAL);
     1033 +        }
     1034 +
1024 1035          /*
1025 1036           * Both endpoints must be of the same type (either STREAMS or
1026 1037           * non-STREAMS) for fusion to be enabled. So if we are fused,
1027 1038           * we have to unfuse.
1028 1039           */
1029 1040          if (tcp->tcp_fused)
1030 1041                  tcp_unfuse(tcp);
1031 1042  
1032 1043          if (tcp->tcp_listener != NULL) {
1033 1044                  /* The eager will deal with opts when accept() is called */
↓ open down ↓ 144 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX