Print this page
OS-4699 lxbrand netty complains about SO_LINGER (really IP_TOS)
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
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/ip/conn_opt.c
          +++ new/usr/src/uts/common/inet/ip/conn_opt.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) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2016 Joyent, Inc.
  24   25   */
  25   26  /* Copyright (c) 1990 Mentat Inc. */
  26   27  
  27   28  #include <sys/types.h>
  28   29  #include <sys/stream.h>
  29   30  #include <sys/strsun.h>
  30   31  #define _SUN_TPI_VERSION 2
  31   32  #include <sys/tihdr.h>
  32   33  #include <sys/xti_inet.h>
  33   34  #include <sys/ucred.h>
↓ open down ↓ 578 lines elided ↑ open up ↑
 612  613                          lgr->l_linger = connp->conn_lingertime;
 613  614                          }
 614  615                          return (sizeof (struct linger));
 615  616  
 616  617                  case SO_OOBINLINE:
 617  618                          *i1 = connp->conn_oobinline ? SO_OOBINLINE : 0;
 618  619                          break;
 619  620                  case SO_REUSEADDR:
 620  621                          *i1 = connp->conn_reuseaddr ? SO_REUSEADDR : 0;
 621  622                          break;  /* goto sizeof (int) option return */
      623 +                case SO_REUSEPORT:
      624 +                        *i1 = connp->conn_reuseport;
      625 +                        break;  /* goto sizeof (int) option return */
 622  626                  case SO_TYPE:
 623  627                          *i1 = connp->conn_so_type;
 624  628                          break;  /* goto sizeof (int) option return */
 625  629                  case SO_DONTROUTE:
 626  630                          *i1 = (ixa->ixa_flags & IXAF_DONTROUTE) ?
 627  631                              SO_DONTROUTE : 0;
 628  632                          break;  /* goto sizeof (int) option return */
 629  633                  case SO_USELOOPBACK:
 630  634                          *i1 = connp->conn_useloopback ? SO_USELOOPBACK : 0;
 631  635                          break;  /* goto sizeof (int) option return */
↓ open down ↓ 547 lines elided ↑ open up ↑
1179 1183          ip_pkt_t        *ipp = coa->coa_ipp;
1180 1184          int             *i1 = (int *)invalp;
1181 1185          boolean_t       onoff = (*i1 == 0) ? 0 : 1;
1182 1186          ipaddr_t        addr = (ipaddr_t)*i1;
1183 1187          uint_t          ifindex;
1184 1188          zoneid_t        zoneid = IPCL_ZONEID(connp);
1185 1189          ipif_t          *ipif;
1186 1190          ip_stack_t      *ipst = connp->conn_netstack->netstack_ip;
1187 1191          int             error;
1188 1192  
1189      -        if (connp->conn_family != AF_INET)
     1193 +        if (connp->conn_family == AF_INET6 &&
     1194 +            connp->conn_ipversion == IPV4_VERSION) {
     1195 +                /*
     1196 +                 * Allow certain IPv4 options to be set on an AF_INET6 socket
     1197 +                 * if the connection is still IPv4.
     1198 +                 */
     1199 +                switch (name) {
     1200 +                case IP_TOS:
     1201 +                case T_IP_TOS:
     1202 +                case IP_TTL:
     1203 +                case IP_DONTFRAG:
     1204 +                        break;
     1205 +                default:
     1206 +                        return (EINVAL);
     1207 +                }
     1208 +        } else if (connp->conn_family != AF_INET) {
1190 1209                  return (EINVAL);
     1210 +        }
1191 1211  
1192 1212          switch (name) {
1193 1213          case IP_TTL:
1194 1214                  /* Don't allow zero */
1195 1215                  if (*i1 < 1 || *i1 > 255)
1196 1216                          return (EINVAL);
1197 1217                  break;
1198 1218          case IP_MULTICAST_IF:
1199 1219                  if (addr == INADDR_ANY) {
1200 1220                          /* Clear */
↓ open down ↓ 1736 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX