Print this page
inet_pton

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/sockfs/nl7c.c
          +++ new/usr/src/uts/common/fs/sockfs/nl7c.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 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
       25 +/*
       26 + * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
       27 + */
  25   28  
  26   29  /*
  27   30   * NL7C (Network Layer 7 Cache) as part of SOCKFS provides an in-kernel
  28   31   * gateway cache for the request/response message based L7 protocol HTTP
  29   32   * (Hypertext Transfer Protocol, see HTTP/1.1 RFC2616) in a semantically
  30   33   * transparent manner.
  31   34   *
  32   35   * Neither the requesting user agent (client, e.g. web browser) nor the
  33   36   * origin server (e.g. webserver) that provided the response cached by
  34   37   * NL7C are impacted in any way.
↓ open down ↓ 18 lines elided ↑ open up ↑
  53   56  #include <inet/led.h>
  54   57  #include <inet/mi.h>
  55   58  #include <netinet/in.h>
  56   59  #include <fs/sockfs/nl7c.h>
  57   60  #include <fs/sockfs/nl7curi.h>
  58   61  #include <fs/sockfs/socktpi.h>
  59   62  
  60   63  #include <inet/nca/ncadoorhdr.h>
  61   64  #include <inet/nca/ncalogd.h>
  62   65  #include <inet/nca/ncandd.h>
       66 +#include <inet/ip.h>
  63   67  
  64   68  #include <sys/promif.h>
  65   69  
  66   70  /*
  67   71   * NL7C, NCA, NL7C logger enabled:
  68   72   */
  69   73  
  70   74  boolean_t       nl7c_enabled = B_FALSE;
  71   75  
  72   76  boolean_t       nl7c_logd_enabled = B_FALSE;
  73   77  boolean_t       nl7c_logd_started = B_FALSE;
  74   78  boolean_t       nl7c_logd_cycle = B_TRUE;
  75   79  
  76   80  /*
  77   81   * Some externs:
  78   82   */
  79      -
  80      -extern int      inet_pton(int, char *, void *);
  81      -
  82   83  extern void     nl7c_uri_init(void);
  83   84  extern boolean_t nl7c_logd_init(int, caddr_t *);
  84   85  extern void     nl7c_nca_init(void);
  85   86  
  86   87  /*
  87   88   * nl7c_addr_t - a singly linked grounded list, pointed to by *nl7caddrs,
  88   89   * constructed at init time by parsing "/etc/nca/ncaport.conf".
  89   90   *
  90   91   * This list is searched at bind(3SOCKET) time when an application doesn't
  91   92   * explicitly set AF_NCA but instead uses AF_INET, if a match is found then
↓ open down ↓ 233 lines elided ↑ open up ↑
 325  326          /* IPv4 address ? */
 326  327          if (inet_pton(AF_INET, s, &p->addr.v4) != 1) {
 327  328                  /* Nop, IPv6 address ? */
 328  329                  if (inet_pton(AF_INET6, s, &p->addr.v6) != 1) {
 329  330                          /* Nop, return error */
 330  331                          return (1);
 331  332                  }
 332  333                  p->family = AF_INET6;
 333  334          } else {
 334  335                  p->family = AF_INET;
 335      -                p->addr.v4 = ntohl(p->addr.v4);
 336  336          }
      337 +
 337  338          return (0);
 338  339  }
 339  340  
 340  341  /*
 341  342   * Open and read each line from "/etc/nca/ncaport.conf", the syntax of a
 342  343   * ncaport.conf file line is:
 343  344   *
 344  345   *      ncaport=IPaddr/Port[/Proxy]
 345  346   *
 346  347   * Where:
↓ open down ↓ 728 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX