Print this page
5255 uts shouldn't open-code ISP2

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/udp/udp.c
          +++ new/usr/src/uts/common/inet/udp/udp.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  24   24   * Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
  25   25   */
  26   26  /* Copyright (c) 1990 Mentat Inc. */
  27   27  
       28 +#include <sys/sysmacros.h>
  28   29  #include <sys/types.h>
  29   30  #include <sys/stream.h>
  30   31  #include <sys/stropts.h>
  31   32  #include <sys/strlog.h>
  32   33  #include <sys/strsun.h>
  33   34  #define _SUN_TPI_VERSION 2
  34   35  #include <sys/tihdr.h>
  35   36  #include <sys/timod.h>
  36   37  #include <sys/ddi.h>
  37   38  #include <sys/sunddi.h>
↓ open down ↓ 4339 lines elided ↑ open up ↑
4377 4378  
4378 4379          /*
4379 4380           * The smallest anonymous port in the priviledged port range which UDP
4380 4381           * looks for free port.  Use in the option UDP_ANONPRIVBIND.
4381 4382           */
4382 4383          us->us_min_anonpriv_port = 512;
4383 4384  
4384 4385          us->us_bind_fanout_size = udp_bind_fanout_size;
4385 4386  
4386 4387          /* Roundup variable that might have been modified in /etc/system */
4387      -        if (us->us_bind_fanout_size & (us->us_bind_fanout_size - 1)) {
     4388 +        if (!ISP2(us->us_bind_fanout_size)) {
4388 4389                  /* Not a power of two. Round up to nearest power of two */
4389 4390                  for (i = 0; i < 31; i++) {
4390 4391                          if (us->us_bind_fanout_size < (1 << i))
4391 4392                                  break;
4392 4393                  }
4393 4394                  us->us_bind_fanout_size = 1 << i;
4394 4395          }
4395 4396          us->us_bind_fanout = kmem_zalloc(us->us_bind_fanout_size *
4396 4397              sizeof (udp_fanout_t), KM_SLEEP);
4397 4398          for (i = 0; i < us->us_bind_fanout_size; i++) {
↓ open down ↓ 2064 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX