/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <syslog.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <time.h>
#include <libdevinfo.h>
#include <sys/iscsi_protocol.h>
#include <ima.h>
#include "iscsiadm.h"
#include "sun_ima.h"
/* LINTED E_STATIC_UNUSED */
/* LINTED E_STATIC_UNUSED */
/* LINTED E_STATIC_UNUSED */
/* LINTED E_STATIC_UNUSED */
/* LINTED E_STATIC_UNUSED */
/* LINTED E_STATIC_UNUSED */
/* Forward declaration */
#define PARAM_OP_OK 0
static int open_driver(int *fd);
void *pProps,
void *pProps,
const IMA_AUTHMETHOD *pMethodList);
/* OK */
#define DISC_ADDR_OK 0
/* Incorrect IP address */
/* Error converting text IP address to numeric binary form */
/* LINTED E_STATIC_UNUSED */
IMA_OID_LIST **ppList);
static IMA_STATUS getConnOidList(
static IMA_STATUS getConnProps(
/* LINTED E_STATIC_UNUSED */
{
}
char *
_strlwr(char *s)
{
char *t = s;
while (t != NULL && *t) {
if (*t >= 'A' && *t <= 'Z')
*t += 32;
t++;
}
return (s);
}
/* LINTED E_STATIC_UNUSED */
{
#if defined(BUILD_DATE)
}
#else
#endif
}
/*
* Non-IMA defined function.
*/
)
{
int fd;
int i;
int status;
int out_cnt;
/* LINTED E_FUNC_SET_NOT_USED */
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/*
* Issue ISCSI_DISCOVERY_ADDR_LIST_GET ioctl
* We have allocated space for one entry, if more than one
* address is going to be returned, we will re-issue the ioctl
*/
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* we need to allocate more space, save off the out_cnt
* and free ialp
*/
discovery_addr_list_size = sizeof (iscsi_addr_list_t);
discovery_addr_list_size += (sizeof (iscsi_addr_t) *
out_cnt - 1);
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/*
* Issue ISCSI_DISCOVERY_ADDR_LIST_GET ioctl again to obtain all
* the discovery addresses.
*/
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
sizeof (SUN_IMA_DISC_ADDR_PROP_LIST) +
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
for (i = 0; i < ialp->al_out_cnt; i++) {
sizeof (struct in_addr)) {
sizeof (struct in6_addr)) {
} else {
sizeof (discovery_addr_str));
}
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
/* LINTED */
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
"ISCSI_STATIC_GET ioctl failed, errno: %d", status);
return (IMA_ERROR_OBJECT_NOT_FOUND);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
sizeof (struct in_addr)) {
/* IPv4 */
sizeof (struct in6_addr)) {
/* IPv6 */
} else {
/* Should not happen */
"ISCSI_STATIC_GET returned bad address");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
} else {
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
int fd;
int target_in_addr_size;
int status;
union {
} target_in;
/*
* staticConfig.address may come in with port number at its trailer.
* Parse it to separate the IP address and port number.
* Also translate the hostname to IP address if needed.
*/
ipv4Address == IMA_FALSE) {
target_in_addr_size = sizeof (struct in6_addr);
} else {
target_in_addr_size = sizeof (struct in_addr);
}
sizeof (struct in6_addr));
} else {
return (IMA_ERROR_INVALID_PARAMETER);
}
} else {
}
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/*
* Encountered problem setting the IP address and port for
* the target just added.
*/
"ISCSI_STATIC_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
"ISCSI_TARGET_PROPS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
(sizeof (IMA_WCHAR) * SUN_IMA_NODE_ALIAS_LEN));
if (prop.p_alias_len > 0) {
}
/* Initialize the discovery method to unknown method. */
}
}
}
}
} else {
}
} else {
}
return (IMA_STATUS_SUCCESS);
}
/*
* This function only sets CHAP params since we only support CHAP for now.
*/
const IMA_INITIATOR_AUTHPARMS *pParms
)
{
int fd;
if (method != IMA_AUTHMETHOD_CHAP)
return (IMA_ERROR_INVALID_PARAMETER);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_CHAP_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
!= IMA_STATUS_SUCCESS) {
}
return (IMA_STATUS_SUCCESS);
}
)
{
int af;
int fd;
int status;
union {
} radius_in;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/* Get first because other data fields may already exist */
/* EMPTY */
/* It's fine if other data fields are not there. */
}
} else {
}
return (IMA_ERROR_INVALID_PARAMETER);
}
switch (af) {
case AF_INET:
break;
case AF_INET6:
break;
}
/* Allow resetting the RADIUS shared secret to NULL */
}
"ISCSI_RADIUS_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int af;
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* IPv4 */
/* IPv6 */
} else {
/*
* It's legitimate that the existing RADIUS record does not
* have configuration data.
*/
return (IMA_STATUS_SUCCESS);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/* Get first because other data fields may already exist */
if (radiusAccess == IMA_TRUE) {
/*
* Cannot enable RADIUS if no RADIUS configuration
* can be found.
*/
"RADIUS config data not found - "
"cannot enable RADIUS, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
} else {
/* EMPTY */
/* Otherwise it's fine to disable RADIUS */
}
}
/*
* Cannot enable RADIUS if no RADIUS configuration
* can be found.
*/
if (radiusAccess == IMA_TRUE) {
"RADIUS config data not found - "
"cannot enable RADIUS");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
"ISCSI_RADIUS_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_ERROR_OBJECT_NOT_FOUND);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
)
{
char *colonPos;
int fd;
int ctr;
int stl_sz;
int status;
/* LINTED */
sizeof (iscsi_sendtgts_entry_t));
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* IPv4 */
} else {
/* IPv6 */
}
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/*
* Issue ioctl to obtain the SendTargets list
*/
"ISCSI_SENDTGTS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* check if all targets received */
sizeof (iscsi_sendtgts_entry_t));
stl_hdr = (iscsi_sendtgts_list_t *)
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
goto retry_sendtgts;
} else {
/*
* don't retry after 2 attempts. The target list
* shouldn't continue to growing. Justs continue
* on and display what was found.
*/
"ISCSI_SENDTGTS_GET overflow: "
"failed to obtain all targets");
}
}
/* allocate for caller return buffer */
sizeof (SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES) +
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
sizeof (struct in_addr)) {
sizeof (struct in6_addr)) {
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/* Get first because other data fields may already exist */
/* EMPTY */
/* It is fine if there is no other data fields. */
}
"ISCSI_AUTH_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
"ISCSI_CREATE_OID ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/*
* It could be that the target exists but the associated
* target_param does not, and that is legitimate.
*/
"ISCSI_TARGET_PARAM_CLEAR ioctl failed, errno: %d", errno);
}
/* Issue ISCSI_CHAP_CLEAR ioctl */
/*
* It could be that the CHAP of this target has never
* been set.
*/
"ISCSI_CHAP_CLEAR ioctl failed, errno: %d", errno);
}
/*
* Issue ISCSI_AUTH_CLEAR ioctl, in which the authentication information
* is removed and the target that is not discovered by initiator
* is removed from the memory. So this ioctl should be called at last
*/
/*
* It could be that the auth data of this target has
* never been set.
*/
"ISCSI_AUTH_CLEAR ioctl failed, errno: %d", errno);
}
return (IMA_STATUS_SUCCESS);
}
)
{
/* We only support one preference of digest algorithm. */
if (algorithmCount > 1) {
"More than one digest algorithm specified.");
return (IMA_ERROR_NOT_SUPPORTED);
}
switch (algorithmList[0]) {
case SUN_IMA_DIGEST_NONE:
break;
case SUN_IMA_DIGEST_CRC32:
break;
default:
break;
}
}
)
{
/* We only support one preference of digest algorithm. */
if (algorithmCount > 1) {
"More than one digest algorithm specified.");
return (IMA_ERROR_NOT_SUPPORTED);
}
switch (algorithmList[0]) {
case SUN_IMA_DIGEST_NONE:
break;
case SUN_IMA_DIGEST_CRC32:
break;
default:
break;
}
}
)
{
}
)
{
}
typedef struct walk_devlink {
char *path;
char **linkpp;
)
{
int j;
int fd;
int openStatus;
return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
}
/*
* get list of lun oids for all targets
*/
if (!IMA_SUCCESS(status)) {
return (status);
}
for (j = 0; j < pLunList->ll_out_cnt; j++) {
/*
* for each lun, check if match is found
*/
/*
* match found, break out of lun loop
*/
break;
}
}
}
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/*
* get lun properties
*/
return (SUN_IMA_ERROR_SYSTEM_ERROR | openStatus);
}
"ISCSI_LUN_PROPS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* set property values
*/
/*
* lun.lp_status is defined as
* LunValid = 0
* LunDoesNotExist = 1
* IMA_LU_PROPS.exposedtoOS is defined as an IMA_BOOL
* IMA_TRUE = 1
* IMA_FALSE = 0
*/
== NULL) {
}
(MAXPATHLEN -1)) {
/*
* lun.lp_pathname length too long
*/
return (IMA_STATUS_SUCCESS);
}
/*
* modify returned pathname to obtain the 2nd slice
* of the raw disk
*/
}
minor_path = lunpath +
strlen("/devices");
} else {
}
} else {
minor_path = NULL;
}
/*
* Pathname returned by driver is the physical device path.
* This name needs to be converted to the OS device name.
*/
} else {
/* OS device name is asynchronously made */
}
(void) di_devlink_fini(&hdl);
} else {
}
} else {
}
return (IMA_STATUS_SUCCESS);
}
static int
{
return (DI_WALK_CONTINUE);
}
return (DI_WALK_TERMINATE);
}
/*
* SUN_IMA_GetConnectionOidList -
*
* Non-IMA defined function.
*/
)
{
int i;
} else {
} else {
return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
}
}
if (imaStatus != IMA_STATUS_SUCCESS) {
return (imaStatus);
}
/*
* Based on the results a SUN_IMA_CONN_LIST structure is allocated.
*/
if (imaOidList == NULL) {
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* The data is transfered from iscsiConnList to imaConnList. */
for (i = 0; i < iscsiConnList->cl_out_cnt; i++) {
}
/* The pointer to the SUN_IMA_CONN_LIST structure is returned. */
*ppList = imaOidList;
return (IMA_STATUS_SUCCESS);
}
/*
* SUN_IMA_GetConnProperties -
*
* Non-IMA defined function.
*/
)
{
/* LINTED */
/* LINTED */
int i;
/* If there is any error *pProps should be set to NULL */
sizeof (SUN_IMA_CONN_PROPERTIES));
if (pImaConnProps == NULL) {
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
if (imaStatus != IMA_STATUS_SUCCESS) {
return (imaStatus);
}
/*
* Walk the list returned to find our connection.
*/
for (i = 0; i < pConnList->cl_out_cnt; i++) {
/* This is our connection. */
&pConnProps);
if (imaStatus != IMA_STATUS_SUCCESS) {
return (imaStatus);
}
/*
* Local Propeties
*/
} else {
}
/*
* Peer Propeties
*/
} else {
}
break;
}
}
*pProps = pImaConnProps;
return (IMA_STATUS_SUCCESS);
}
/*
* SUN_IMA_GetConfigSessions -
*
* Non-IMA defined function.
*/
)
{
int fd;
int status;
/* Allocate and setup initial buffer */
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Open driver devctl for ioctl */
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/* Issue ioctl request */
"ISCSI_GET_CONFIG_SESSIONS ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* Check if we need to collect more information */
if (idx > 1) {
/* Free old buffer and reallocate re-sized buffer */
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue ioctl request */
"ISCSI_GET_CONFIG_SESSIONS ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
/* Allocate output buffer */
size = sizeof (SUN_IMA_CONFIG_SESSIONS) +
if ((*pConfigSessions) == NULL) {
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Copy output information */
(*pConfigSessions)->bound =
sizeof (struct in_addr)) {
} else {
}
}
return (IMA_STATUS_SUCCESS);
}
/*
* SUN_IMA_SetConfigSessions -
*
* Non-IMA defined function.
*/
)
{
int fd;
int status;
/* verify allowed range of sessions */
return (IMA_ERROR_INVALID_PARAMETER);
}
/* allocate record config_sess size */
/* setup config_sess information */
ipv4Address == IMA_TRUE) {
sizeof (struct in_addr);
sizeof (struct in_addr));
} else {
sizeof (struct in6_addr);
sizeof (struct in6_addr));
}
}
/* open driver */
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/* issue ioctl request */
"ISCSI_SET_CONFIG_SESSIONS ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to obtain iSCSI node parameters. */
static IMA_STATUS
int paramType,
void *pProps,
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
"ISCSI_PARAM_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
switch (paramType) {
case MIN_MAX_PARAM:
break;
case BOOL_PARAM:
break;
default:
break;
}
/* Issue ISCSI_PARAM_GET ioctl again to obtain connection parameters. */
"ISCSI_PARAM_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to set iSCSI node parameters. */
static IMA_STATUS
int paramType,
void *pProp,
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
switch (paramType) {
case MIN_MAX_PARAM:
break;
case BOOL_PARAM:
break;
default:
break;
}
"ISCSI_PARAM_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
static int
)
{
}
static int
)
{
ipv4Address == IMA_FALSE) {
} else {
}
return (DISC_ADDR_OK);
}
)
{
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
"ISCSI_DISCOVERY_CLEAR ioctl failed, errno: %d",
status);
return (IMA_ERROR_LU_IN_USE);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
} else {
/* Set the discovery method */
"ISCSI_DISCOVERY_SET ioctl failed, errno: %d",
status);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
}
/* LINTED E_STATIC_UNUSED */
)
{
IMA_UINT i;
for (i = 0; i < maxEntries; i++) {
if (methodList[i] == matchingMethod) {
return (IMA_TRUE);
}
}
return (IMA_FALSE);
}
{
int fd;
int i;
int target_list_size;
int status;
int out_cnt;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/*
* Issue ioctl. Space has been allocted for one entry.
* If more than one entry should be returned, we will re-issue the
* entry with the right amount of space allocted
*/
"ISCSI_TARGET_OID_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
target_list_size = sizeof (iscsi_target_list_t);
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue the same ioctl again to obtain all the OIDs. */
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
for (i = 0; i < idlp->tl_out_cnt; i++) {
}
return (IMA_STATUS_SUCCESS);
}
{
int fd;
int lun_list_size;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* get lun oid list for all targets */
} else {
/* get lun oid list for single target */
}
/*
* Issue ioctl to retrieve the target luns. Space has been allocted
* for one entry. If more than one entry should be returned, we
* will re-issue the entry with the right amount of space allocted
*/
"ISCSI_LUN_LIST_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
illp_saved = illp;
lun_list_size = sizeof (iscsi_lun_list_t);
lun_list_size += (sizeof (iscsi_if_lun_t) *
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue the same ioctl again to get all the target LUN list */
"ISCSI_LUN_LIST_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to obtain digest algorithms. */
static IMA_STATUS
int ioctlCmd,
)
{
ioctlCmd)) != IMA_STATUS_SUCCESS) {
return (status);
}
switch (pProps.defaultValue) {
case ISCSI_DIGEST_NONE:
break;
case ISCSI_DIGEST_CRC32C:
break;
case ISCSI_DIGEST_CRC32C_NONE:
break;
case ISCSI_DIGEST_NONE_CRC32C:
break;
default:
/* Error */
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* The configured value */
switch (pProps.currentValue) {
case ISCSI_DIGEST_NONE:
algorithm->currentAlgorithms[0] =
break;
case ISCSI_DIGEST_CRC32C:
algorithm->currentAlgorithms[0] =
break;
case ISCSI_DIGEST_CRC32C_NONE:
algorithm->currentAlgorithms[0] =
break;
case ISCSI_DIGEST_NONE_CRC32C:
algorithm->currentAlgorithms[0] =
break;
default:
/* Error */
"Invalid configured digest: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
} else {
}
return (IMA_STATUS_SUCCESS);
}
/*
* getConnOidList -
*/
)
{
int fd;
int status;
int out_cnt;
/* Preset it to NULL to prepare for the case of failure */
*ppConnList = NULL;
/* We try to open the driver now. */
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
sizeof (iscsi_conn_list_t));
if (iscsiConnList == NULL) {
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
} else {
}
/*
* Issue ioctl to retrieve the connection OIDs. Space has been
* allocated for one entry. If more than one entry should be
* returned, we will re-issue the entry with the right amount of
* space allocted
*/
"ISCSI_CONN_OID_LIST_GET ioctl failed, errno: %d", errno);
*ppConnList = NULL;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
allocLen = sizeof (iscsi_conn_list_t);
if (iscsiConnList == NULL) {
*ppConnList = NULL;
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
} else {
}
/* Issue the same ioctl again to obtain all the OIDs */
"ISCSI_CONN_OID_LIST_GET ioctl failed, errno: %d",
errno);
*ppConnList = NULL;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* The connection list grew between the first and second
* ioctls.
*/
"The connection list has grown. There could be "
"more connections than listed.");
}
}
return (IMA_STATUS_SUCCESS);
}
/*
* getConnProps -
*/
)
{
int fd;
int status;
/* We try to open the driver. */
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
sizeof (*iscsiConnProps));
if (iscsiConnProps == NULL) {
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* The IOCTL is submitted. */
/* IOCTL failed */
"ISCSI_AUTH_CLEAR ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to set authentication method. */
static IMA_STATUS
const IMA_AUTHMETHOD *pMethodList
)
{
int fd;
int i;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/*
* Get the current auth fields so they don't need to be reset
* here.
*/
/* EMPTY */
/* Initializing auth structure with current settings */
}
for (i = 0; i < *pMethodCount; i++) {
switch (pMethodList[i]) {
case IMA_AUTHMETHOD_CHAP:
break;
default:
break;
}
}
"ISCSI_AUTH_SET failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to set authentication method. */
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
"ISCSI_AUTH_GET failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
*pMethodCount = 1;
} else {
int i = 0;
pMethodList[i++] = IMA_AUTHMETHOD_CHAP;
}
*pMethodCount = i;
}
return (IMA_STATUS_SUCCESS);
}
/* Helper function to open driver */
int open_driver(
int *fd
)
{
int ret = 0;
}
return (ret);
}
/*
* Iscsi driver does not support OID for discovery address. Create
* a modified version of IMA_RemoveDiscoveryAddress that takes
* discoveryAddress (instead of an OID) as input argument.
*/
)
{
int fd;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
DISC_ADDR_OK) {
return (IMA_ERROR_INVALID_PARAMETER);
}
/*
* Issue ioctl to get the number of discovery address.
*/
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (al_info.al_out_cnt == 0) {
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
addr_list_size = sizeof (iscsi_addr_list_t);
addr_list_size += (sizeof (iscsi_addr_t) *
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* issue the same ioctl to get all the discovery addresses */
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* find the matched discovery address
*/
for (i = 0; i < idlp->al_out_cnt; i++) {
continue;
}
break;
}
}
insize) == 0) {
break;
}
}
}
if (matched_addr == NULL) {
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
"ISCSI_DISCOVERY_ADDR_CLEAR ioctl failed, errno: %d",
errno);
return (IMA_ERROR_LU_IN_USE);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
const IMA_AUTHMETHOD *pMethodList
)
{
}
int digestType,
if (digestType == ISCSI_LOGIN_PARAM_HEADER_DIGEST) {
} else {
}
switch (digest) {
case ISCSI_DIGEST_NONE:
break;
case ISCSI_DIGEST_CRC32C:
break;
case ISCSI_DIGEST_CRC32C_NONE:
break;
case ISCSI_DIGEST_NONE_CRC32C:
break;
default:
"Invalid negotiated digest: %d",
digest);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
} else {
}
return (IMA_STATUS_SUCCESS);
}
/*
* Non-IMA defined function.
*/
)
{
int fd;
int i;
int status;
int out_cnt;
/* LINTED */
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/*
* Issue ioctl to retrieve the isns server addresses. Space has been
* allocted for one entry. If more than one entry should be returned,
* we will re-issue the entry with the right amount of space allocted
*/
"ISCSI_ISNS_SERVER_ADDR_LIST_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
isns_server_addr_list_size = sizeof (iscsi_addr_list_t);
isns_server_addr_list_size += (sizeof (iscsi_addr_t) *
out_cnt - 1);
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/*
* Issue ISCSI_ISNS_SERVER_ADDR_LIST_GET ioctl again to obtain
* the list of all the iSNS server addresses
*/
"ISCSI_ISNS_SERVER_ADDR_LIST_GET ioctl failed, "
"errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
sizeof (SUN_IMA_DISC_ADDR_PROP_LIST) +
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
for (i = 0; i < ialp->al_out_cnt; i++) {
sizeof (struct in_addr)) {
sizeof (struct in6_addr)) {
} else {
sizeof (isns_server_addr_str));
}
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
/*
* Remove iSNS Server Address
*/
)
{
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
DISC_ADDR_OK) {
return (IMA_ERROR_INVALID_PARAMETER);
}
"ISCSI_ISNS_SERVER_ADDR_CLEAR ioctl failed, errno: %d",
status);
return (IMA_ERROR_LU_IN_USE);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
DISC_ADDR_OK) {
return (IMA_ERROR_INVALID_PARAMETER);
}
/*
* Encountered problem setting the discovery address.
*/
"ISCSI_ISNS_SERVER_ADDR_SET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int ctr;
int server_pg_list_sz;
int status;
server_pg_list_sz = sizeof (*server_pg_list) +
((ISNS_SERVER_DEFAULT_NUM_TARGETS - 1) *
sizeof (isns_portal_group_t));
if (server_pg_list == NULL) {
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
!= DISC_ADDR_OK)) {
return (IMA_ERROR_INVALID_PARAMETER);
}
}
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
/*
* Issue ioctl to obtain the ISNS Portal Group List list
*/
"ISCSI_ISNS_SERVER_GET ioctl failed, errno: %d", tmp_errno);
} else {
}
return (return_status);
}
/* check if all targets received */
server_pg_list_sz = sizeof (*server_pg_list) +
sizeof (isns_server_portal_group_list_t));
if (server_pg_list == NULL) {
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
goto retry_isns;
} else {
/*
* don't retry after 2 attempts. The target list
* shouldn't continue growing. Just continue
* on and display what was found.
*/
"ISCSI_SENDTGTS_GET overflow: "
"failed to obtain all targets");
}
}
/* allocate for caller return buffer */
sizeof (SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES) +
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
sizeof (struct in6_addr)) {
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
}
/*ARGSUSED*/
)
{
int fd;
return (IMA_ERROR_INVALID_PARAMETER);
}
return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
}
if (method != IMA_AUTHMETHOD_CHAP) {
return (IMA_ERROR_INVALID_PARAMETER);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_CHAP_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
tgtName[0] = L'\0';
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_BOOTPROP_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI Target name covert to WCHAR fail");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
} else {
}
}
return (rtn);
}
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_BOOTPROP_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
} else {
}
} else {
}
}
return (rtn);
}
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_BOOTPROP_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (bootProp.hba_mpxio_enabled) {
} else {
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
*pIscsiBoot = 0;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_BOOTPROP_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
{
int fd;
if (pSvcEnabled == NULL)
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
*pSvcEnabled = 0;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_SVC_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (status == ISCSI_SERVICE_ENABLED) {
*pSvcEnabled = 1;
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int status;
return (SUN_IMA_ERROR_SYSTEM_ERROR | status);
}
return (IMA_STATUS_SUCCESS);
}