Print this page
195 Need replacement for nfs/lockd+klm
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Jeremy Jones <jeremy@delphix.com>
Reviewed by: Jeff Biseda <jbiseda@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c
          +++ new/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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   * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - */
  24      -/*
  25   24   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright (c) 2012 by Delphix. All rights reserved.
  26   26   */
  27   27  
  28   28  
  29   29  /*
  30   30   * nfs_tbind.c, common part for nfsd and lockd.
  31   31   */
  32   32  
  33   33  #include <tiuser.h>
  34   34  #include <fcntl.h>
  35   35  #include <netconfig.h>
↓ open down ↓ 1655 lines elided ↑ open up ↑
1691 1691  
1692 1692  /*
1693 1693   * Create an address mask appropriate for the transport.
1694 1694   * The mask is used to obtain the host-specific part of
1695 1695   * a network address when comparing addresses.
1696 1696   * For an internet address the host-specific part is just
1697 1697   * the 32 bit IP address and this part of the mask is set
1698 1698   * to all-ones. The port number part of the mask is zeroes.
1699 1699   */
1700 1700  static int
1701      -set_addrmask(fd, nconf, mask)
1702      -        struct netconfig *nconf;
1703      -        struct netbuf *mask;
     1701 +set_addrmask(int fd,
     1702 +        struct netconfig *nconf,
     1703 +        struct netbuf *mask)
1704 1704  {
1705 1705          struct t_info info;
1706 1706  
1707 1707          /*
1708 1708           * Find the size of the address we need to mask.
1709 1709           */
1710 1710          if (t_getinfo(fd, &info) < 0) {
1711 1711                  t_error("t_getinfo");
1712 1712                  return (-1);
1713 1713          }
↓ open down ↓ 4 lines elided ↑ open up ↑
1718 1718                   * (it is identified by -1 in addr field of t_info structure),
1719 1719                   * so don't build the netmask for them. It's a special case
1720 1720                   * that should be handled properly.
1721 1721                   */
1722 1722                  if ((info.addr == -1) &&
1723 1723                      (0 == strcmp(nconf->nc_protofmly, NC_LOOPBACK))) {
1724 1724                          memset(mask, 0, sizeof (*mask));
1725 1725                          return (0);
1726 1726                  }
1727 1727  
1728      -                syslog(LOG_ERR, "set_addrmask: address size: %ld",
1729      -                        info.addr);
     1728 +                syslog(LOG_ERR, "set_addrmask: address size: %ld", info.addr);
1730 1729                  return (-1);
1731 1730          }
1732 1731  
1733 1732          mask->buf = (char *)malloc(mask->len);
1734 1733          if (mask->buf == NULL) {
1735 1734                  syslog(LOG_ERR, "set_addrmask: no memory");
1736 1735                  return (-1);
1737 1736          }
1738 1737          (void) memset(mask->buf, 0, mask->len); /* reset all mask bits */
1739 1738  
1740 1739          if (strcmp(nconf->nc_protofmly, NC_INET) == 0) {
1741 1740                  /*
1742 1741                   * Set the mask so that the port is ignored.
1743 1742                   */
1744 1743                  /* LINTED pointer alignment */
1745 1744                  ((struct sockaddr_in *)mask->buf)->sin_addr.s_addr =
1746      -                                                                (ulong_t)~0;
     1745 +                    (ulong_t)~0;
1747 1746                  /* LINTED pointer alignment */
1748 1747                  ((struct sockaddr_in *)mask->buf)->sin_family =
1749      -                                                                (ushort_t)~0;
     1748 +                    (ushort_t)~0;
1750 1749          } else if (strcmp(nconf->nc_protofmly, NC_INET6) == 0) {
1751 1750                  /* LINTED pointer alignment */
1752 1751                  (void) memset(&((struct sockaddr_in6 *)mask->buf)->sin6_addr,
1753      -                        (uchar_t)~0, sizeof (struct in6_addr));
     1752 +                    (uchar_t)~0, sizeof (struct in6_addr));
1754 1753                  /* LINTED pointer alignment */
1755 1754                  ((struct sockaddr_in6 *)mask->buf)->sin6_family =
1756      -                                                                (ushort_t)~0;
     1755 +                    (ushort_t)~0;
1757 1756          } else {
1758 1757  
1759 1758                  /*
1760 1759                   * Set all mask bits.
1761 1760                   */
1762 1761                  (void) memset(mask->buf, 0xFF, mask->len);
1763 1762          }
1764 1763          return (0);
1765 1764  }
1766 1765  
↓ open down ↓ 11 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX