changeset 14038:2c7be0fb2e63

applying changes to wpa_supplicant sources for illumos integration as documented here https://bitbucket.org/enricop/illumos-gate/downloads/hostap-1_repo_diff_complete
author enricop <enricop@computer.org>
date Mon, 27 May 2013 16:45:48 +0200
parents 3252bc069dd8
children da5af0a9462a
files usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/common/defs.h usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/crypto/tls_openssl.c usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/drivers/drivers.c usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/utils/common.h usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/utils/os_unix.c
diffstat 5 files changed, 52 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/common/defs.h	Mon May 27 16:28:57 2013 +0200
+++ b/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/common/defs.h	Mon May 27 16:45:48 2013 +0200
@@ -17,6 +17,9 @@
 #endif
 typedef enum { FALSE = 0, TRUE = 1 } Boolean;
 
+#ifndef _WPASILLUMOS
+#define BIT(x) (1 << (x))
+#endif /* _WPASILLUMOS */
 
 #define WPA_CIPHER_NONE BIT(0)
 #define WPA_CIPHER_WEP40 BIT(1)
@@ -45,6 +48,7 @@
 #define WPA_KEY_MGMT_WAPI_CERT BIT(13)
 #define WPA_KEY_MGMT_CCKM BIT(14)
 
+#ifdef _WPASILLUMOS
 static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
 {
 	return !!(akm & (WPA_KEY_MGMT_IEEE8021X |
@@ -95,7 +99,7 @@
 {
 	return akm == WPA_KEY_MGMT_CCKM;
 }
-
+#endif /* _WPASILLUMOS */
 
 #define WPA_PROTO_WPA BIT(0)
 #define WPA_PROTO_RSN BIT(1)
--- a/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/crypto/tls_openssl.c	Mon May 27 16:28:57 2013 +0200
+++ b/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/crypto/tls_openssl.c	Mon May 27 16:45:48 2013 +0200
@@ -541,7 +541,7 @@
 	}
 }
 
-
+#ifndef __sun
 #ifndef OPENSSL_NO_ENGINE
 /**
  * tls_engine_load_dynamic_generic - load any openssl engine
@@ -685,10 +685,14 @@
 	return tls_engine_load_dynamic_generic(pre_cmd, NULL, engine_id);
 }
 #endif /* OPENSSL_NO_ENGINE */
+#endif /* __sun */
 
 
 void * tls_init(const struct tls_config *conf)
 {
+	#ifdef __sun
+		char *token_path = NULL;
+	#endif
 	SSL_CTX *ssl;
 
 	if (tls_openssl_ref_count == 0) {
@@ -755,6 +759,25 @@
 
 	SSL_CTX_set_info_callback(ssl, ssl_info_cb);
 
+#ifdef __sun
+ 	token_path = getenv("SOFTTOKEN_DIR");
+ 	if (token_path == NULL) {
+ 		wpa_printf(MSG_ERROR, "ENGINE: Failed reading SOFTTOKEN_DIR"
+ 		    "env variable");
+ 		tls_deinit(ssl);
+ 		return (NULL);
+ 	}
+ 	if (strcmp(token_path, "/etc/dladm") != 0) {
+ 		wpa_printf(MSG_ERROR, "ENGINE: SOFTTOKEN_DIR env variable"
+ 		    "mismatch");
+ 		tls_deinit(ssl);
+ 		return (NULL);
+         }
+ 
+         wpa_printf(MSG_DEBUG, "ENGINE: Loading pkcs11 engine plugin");
+         ENGINE_load_pk11();
+ 
+#else /* __sun */
 #ifndef OPENSSL_NO_ENGINE
 	if (conf &&
 	    (conf->opensc_engine_path || conf->pkcs11_engine_path ||
@@ -771,6 +794,7 @@
 		}
 	}
 #endif /* OPENSSL_NO_ENGINE */
+#endif /* __sun */
 
 	return ssl;
 }
--- a/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/drivers/drivers.c	Mon May 27 16:28:57 2013 +0200
+++ b/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/drivers/drivers.c	Mon May 27 16:45:48 2013 +0200
@@ -43,6 +43,9 @@
 #ifdef CONFIG_DRIVER_NONE
 extern struct wpa_driver_ops wpa_driver_none_ops; /* driver_none.c */
 #endif /* CONFIG_DRIVER_NONE */
+#ifdef CONFIG_DRIVER_SOLARIS
+extern struct wpa_driver_ops wpa_driver_solaris_ops; /* driver_solaris.c */
+#endif /* CONFIG_DRIVER_SOLARIS */
 
 
 struct wpa_driver_ops *wpa_drivers[] =
@@ -80,5 +83,8 @@
 #ifdef CONFIG_DRIVER_NONE
 	&wpa_driver_none_ops,
 #endif /* CONFIG_DRIVER_NONE */
+#ifdef CONFIG_DRIVER_SOLARIS
+	&wpa_driver_solaris_ops,
+#endif /* CONFIG_DRIVER_SOLARIS */
 	NULL
 };
--- a/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/utils/common.h	Mon May 27 16:28:57 2013 +0200
+++ b/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/utils/common.h	Mon May 27 16:45:48 2013 +0200
@@ -35,6 +35,17 @@
 #endif /* defined(__FreeBSD__) || defined(__NetBSD__) ||
 	* defined(__DragonFly__) || defined(__OpenBSD__) */
 
+#ifdef __sun
+#include <sys/byteorder.h>
+#define bswap_16 BSWAP_16
+#define bswap_32 BSWAP_32
+#ifdef _BIG_ENDIAN
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+#endif /* __sun */
+
 #ifdef __APPLE__
 #include <sys/types.h>
 #include <machine/endian.h>
@@ -464,8 +475,9 @@
 
 #define broadcast_ether_addr (const u8 *) "\xff\xff\xff\xff\xff\xff"
 
+#ifdef _WPASILLUMOS
 #include "wpa_debug.h"
-
+#endif /* _WPASILLUMOS */
 
 /*
  * gcc 4.4 ends up generating strict-aliasing warnings about some very common
--- a/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/utils/os_unix.c	Mon May 27 16:28:57 2013 +0200
+++ b/usr/src/cmd/cmd-inet/usr.lib/wpa_supplicant/src/utils/os_unix.c	Mon May 27 16:45:48 2013 +0200
@@ -155,9 +155,9 @@
 
 int os_daemonize(const char *pid_file)
 {
-#if defined(__uClinux__) || defined(__sun__)
+#ifdef __uClinux__
 	return -1;
-#else /* defined(__uClinux__) || defined(__sun__) */
+#else /* defined(__uClinux__) */
 	if (os_daemon(0, 0)) {
 		perror("daemon");
 		return -1;
@@ -172,7 +172,7 @@
 	}
 
 	return -0;
-#endif /* defined(__uClinux__) || defined(__sun__) */
+#endif /* defined(__uClinux__) */
 }