Print this page
inet_pton

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_doorclt.c
          +++ new/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_doorclt.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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 2000 by Cisco Systems, Inc.  All rights reserved.
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  25   26   *
  26   27   * iSCSI Software Initiator
  27   28   */
  28   29  
  29   30  #include <sys/types.h>
  30   31  #include <sys/errno.h>
  31   32  #include <sys/conf.h>
  32   33  #include <sys/cmn_err.h>
  33   34  #include <sys/stat.h>
  34   35  #include <sys/pathname.h>
↓ open down ↓ 201 lines elided ↑ open up ↑
 236  237  )
 237  238  {
 238  239          door_arg_t              arg;
 239  240          mybuffer_t              *buffer;
 240  241          size_t                  msg_size = ISCSI_DOOR_MAX_DATA_SIZE;
 241  242          size_t                  hostent_size = ISCSI_DOOR_MAX_DATA_SIZE;
 242  243          size_t                  buffer_size;
 243  244          getipnodebyname_req_t   *req;
 244  245          getipnodebyname_cnf_t   *cnf;
 245  246          struct hostent          *hptr;
 246      -        int                     i;
 247      -        uint16_t                *swap;
 248  247  
 249  248  
 250  249          buffer_size = msg_size + hostent_size + sizeof (mybuffer_t);
 251  250          buffer = (mybuffer_t *)kmem_zalloc(buffer_size, KM_SLEEP);
 252  251  
 253  252          if (buffer) {
 254  253  
 255  254                  /*
 256  255                   * The buffer was successfully allocated.
 257  256                   *
↓ open down ↓ 47 lines elided ↑ open up ↑
 305  304                  }
 306  305                  if ((msg_size < hptr->h_length) ||
 307  306                      (hostent_size < sizeof (char *))) {
 308  307                          kfreehostent(hptr);
 309  308                          *error_num = NO_RECOVERY;
 310  309                          return (NULL);
 311  310                  }
 312  311                  if (inet_pton(af, (char *)name, cnf) == 1) {
 313  312                          /*
 314  313                           * inet_pton converted the string successfully.
 315      -                         * reset to network order.  swaps based on nfs code
 316  314                           */
 317      -                        if (af == AF_INET) {
 318      -                                *((uint32_t *)cnf) = htonl(*((uint32_t *)cnf));
 319      -                        } else {
 320      -                                for (swap = ((void *)cnf), i = 0;
 321      -                                    i < hptr->h_length / sizeof (uint16_t);
 322      -                                    i++) {
 323      -                                        swap[i] = htons(swap[i]);
 324      -                                }
 325      -                        }
 326  315                          hptr->h_addrtype = af;
 327  316                          hptr->h_addr_list = (char **)((char *)hptr +
 328  317                              sizeof (struct hostent));
 329  318                          *hptr->h_addr_list = (char *)cnf;
 330  319                          return (hptr);
 331  320                  }
 332  321  
 333  322                  /*
 334  323                   * The name couldn't ne converted by inet_pton.  The door is
 335  324                   * called.
↓ open down ↓ 75 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX