Print this page
inet_pton

@@ -19,19 +19,23 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  */
+/*
+ * Copyright (c) 2012, Nexenta Systems, Inc. All rights reserved.
+ */
 
 #include <sys/time.h>
 
 #if defined(_KERNEL)
 #include <sys/ddi.h>
 #include <sys/types.h>
 #include <sys/sunddi.h>
 #include <sys/socket.h>
 #include <inet/tcp.h>
+#include <inet/ip.h>
 #else
 #include <stdio.h>
 #include <strings.h>
 #include <stdlib.h>
 #include <errno.h>

@@ -159,18 +163,10 @@
         if (af == AF_INET) {
                 if (inet_pton(af, addr_str,
                     (void *)&(sin->sin_addr.s_addr)) != 1) {
                         return (NULL);
                 }
-                /*
-                 * intet_pton does not seem to convert to network
-                 * order in kernel. This is a workaround until the
-                 * inet_pton works or we have our own inet_pton function.
-                 */
-#ifdef _KERNEL
-                sin->sin_addr.s_addr = ntohl((uint32_t)sin->sin_addr.s_addr);
-#endif
                 sin->sin_port = htons(tmp_port);
         } else {
                 sin6 = (struct sockaddr_in6 *)sa;
                 if (inet_pton(af, addr_str,
                     (void *)&(sin6->sin6_addr.s6_addr)) != 1) {