Print this page
inet_pton

Split Close
Expand all
Collapse all
          --- old/usr/src/common/iscsit/iscsit_common.c
          +++ new/usr/src/common/iscsit/iscsit_common.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   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
       24 +/*
       25 + * Copyright (c) 2012, Nexenta Systems, Inc. All rights reserved.
       26 + */
  24   27  
  25   28  #include <sys/time.h>
  26   29  
  27   30  #if defined(_KERNEL)
  28   31  #include <sys/ddi.h>
  29   32  #include <sys/types.h>
  30   33  #include <sys/sunddi.h>
  31   34  #include <sys/socket.h>
  32   35  #include <inet/tcp.h>
       36 +#include <inet/ip.h>
  33   37  #else
  34   38  #include <stdio.h>
  35   39  #include <strings.h>
  36   40  #include <stdlib.h>
  37   41  #include <errno.h>
  38   42  #include <sys/types.h>
  39   43  #include <sys/socket.h>
  40   44  #include <netinet/in.h>
  41   45  #include <arpa/inet.h>
  42   46  #endif
↓ open down ↓ 111 lines elided ↑ open up ↑
 154  158          }
 155  159  
 156  160          sa->ss_family = af;
 157  161  
 158  162          sin = (struct sockaddr_in *)sa;
 159  163          if (af == AF_INET) {
 160  164                  if (inet_pton(af, addr_str,
 161  165                      (void *)&(sin->sin_addr.s_addr)) != 1) {
 162  166                          return (NULL);
 163  167                  }
 164      -                /*
 165      -                 * intet_pton does not seem to convert to network
 166      -                 * order in kernel. This is a workaround until the
 167      -                 * inet_pton works or we have our own inet_pton function.
 168      -                 */
 169      -#ifdef _KERNEL
 170      -                sin->sin_addr.s_addr = ntohl((uint32_t)sin->sin_addr.s_addr);
 171      -#endif
 172  168                  sin->sin_port = htons(tmp_port);
 173  169          } else {
 174  170                  sin6 = (struct sockaddr_in6 *)sa;
 175  171                  if (inet_pton(af, addr_str,
 176  172                      (void *)&(sin6->sin6_addr.s6_addr)) != 1) {
 177  173                          return (NULL);
 178  174                  }
 179  175                  sin6->sin6_port = htons(tmp_port);
 180  176          }
 181  177  
↓ open down ↓ 1407 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX