diff options
author | Peter Dunlap <Peter.Dunlap@Sun.COM> | 2008-11-10 15:33:00 -0700 |
---|---|---|
committer | Peter Dunlap <Peter.Dunlap@Sun.COM> | 2008-11-10 15:33:00 -0700 |
commit | bf604c6405d5cbc4e94e3d0ecc9e6e074ed4ea67 (patch) | |
tree | be9bfe678ff1cb30b9adc54520ff59716d61ad17 /usr/src/lib/libiscsit | |
parent | a126dc1ad668882a9be92c984e6849b9f7852115 (diff) | |
download | illumos-joyent-bf604c6405d5cbc4e94e3d0ecc9e6e074ed4ea67.tar.gz |
6752414 After execution of whole test suite, itadm can change the defaults auth-method to anything
6741677 Targets remaing visible on iSNS server after iSNS client is disabled
6764776 osn panics, possible memory corruption
6764100 libiscsit and iscsit_common.h should be restructured
Diffstat (limited to 'usr/src/lib/libiscsit')
-rw-r--r-- | usr/src/lib/libiscsit/common/libiscsit.c | 18 | ||||
-rw-r--r-- | usr/src/lib/libiscsit/common/libiscsit.h | 231 |
2 files changed, 14 insertions, 235 deletions
diff --git a/usr/src/lib/libiscsit/common/libiscsit.c b/usr/src/lib/libiscsit/common/libiscsit.c index a9b2edeae4..881f2a6a3a 100644 --- a/usr/src/lib/libiscsit/common/libiscsit.c +++ b/usr/src/lib/libiscsit/common/libiscsit.c @@ -35,7 +35,6 @@ #include <libstmf.h> #include <libiscsit.h> -#include <sys/iscsit/iscsit_common.h> #include <sys/iscsi_protocol.h> #include <sys/iscsit/isns_protocol.h> @@ -1562,6 +1561,8 @@ it_validate_configprops(nvlist_t *nvl, nvlist_t *errs) char *name; char *val; struct sockaddr_storage sa; + boolean_t update_rad_server = B_FALSE; + char *rad_server; char *auth = NULL; if (!nvl) { @@ -1642,7 +1643,6 @@ it_validate_configprops(nvlist_t *nvl, nvlist_t *errs) } } else if (strcmp(name, PROP_RADIUS_SERVER) == 0) { struct sockaddr_storage sa; - if (!val) { PROPERR(errs, name, gettext("must be a string value")); @@ -1660,11 +1660,9 @@ it_validate_configprops(nvlist_t *nvl, nvlist_t *errs) * rewrite this property to ensure port * number is added. */ - char *rad = NULL; - if (sockaddr_to_str(&sa, &rad) == 0) { - (void) nvlist_add_string(nvl, - name, rad); + if (sockaddr_to_str(&sa, &rad_server) == 0) { + update_rad_server = B_TRUE; } } } else { @@ -1675,6 +1673,14 @@ it_validate_configprops(nvlist_t *nvl, nvlist_t *errs) } /* + * If we successfully reformatted the radius server to add the port + * number then update the nvlist + */ + if (update_rad_server) { + (void) nvlist_add_string(nvl, name, rad_server); + } + + /* * if auth = radius, ensure radius server & secret are set. */ if (auth) { diff --git a/usr/src/lib/libiscsit/common/libiscsit.h b/usr/src/lib/libiscsit/common/libiscsit.h index 598a46a09c..5a5de0ae5d 100644 --- a/usr/src/lib/libiscsit/common/libiscsit.h +++ b/usr/src/lib/libiscsit/common/libiscsit.h @@ -31,13 +31,12 @@ #include <sys/socket.h> #endif +#include <sys/iscsit/iscsit_common.h> + #ifdef __cplusplus extern "C" { #endif -#define ISCSIT_MODNAME "iscsit" -#define ISCSIT_NODE "/devices/pseudo/iscsit@0:iscsit" - #define MAX_TPGT 256 #define CFG_TPGTLIST "tpgt-list" @@ -85,232 +84,6 @@ extern "C" { * from the global config. */ -/* Maximum size of a Target Portal Group name */ -#define MAX_TPG_NAMELEN 256 /* XXX */ - -/* Maximum size of an iSCSI Target Node name */ -#define MAX_ISCSI_NODENAMELEN 256 /* XXX */ - -/* - * A target portal group tag is a binding between a target and a target - * portal group along with a numerical value associated with that binding. - * The numerical identifier is used as the 'target portal group tag' defined - * in RFC3720. - * - * tpgt_tpg_name The name of the target portal group associated with - * this target portal group tag. - * tpgt_generation Generation number which is incremented each time the - * structure changes. - * tpgt_next Next target portal group tag in th list of target portal - * group tags. If tpgt_next is NUL, then this is the last - * target portal group in the list. - * tpgt_tag A numerical identifier that uniquely identifies a - * target portal group within the associated target node. - */ -typedef struct it_tpgt_s { - char tpgt_tpg_name[MAX_TPG_NAMELEN]; - uint64_t tpgt_generation; - struct it_tpgt_s *tpgt_next; - uint16_t tpgt_tag; -} it_tpgt_t; - -/* - * An iSCSI target node is represented by an it_tgt_structure. Each - * target node includes a list of associated target portal group tags - * and a list of properties. - * - * tgt_name The iSCSI target node name in either IQN or EUI - * format (see RFC3720). - * tgt_generation Generation number which is incremented each time - * the structure changes. - * tgt_next Next target in the list of targets. If tgt_next - * is NULL, then this is the last target in the list. - * tgt_tpgt_list A linked list representing the current target - * portal group tags associated with this target. - * tgt_tpgt_count The number of currently defined target portal - * group tags. - * tgt_properties An nvlist representation of the properties - * associated with this target. This list can be - * manipulated using libnvpair(3lib), and should be - * validated and stored using it_tgt_setprop(). - * - * Target nvlist Properties: - * - * nvlist Key Type Valid Values - * -------------------------------------------------------------------- - * targetchapuser string any string or "none" to remove - * targetchapsecret string string of at least 12 characters - * but not more than 255 characters. - * secret will be base64 encoded when - * stored. - * alias string any string or "none" to remove - * auth string "radius", "chap", or "none" - * - */ -typedef struct it_tgt_s { - char tgt_name[MAX_ISCSI_NODENAMELEN]; - uint64_t tgt_generation; - struct it_tgt_s *tgt_next; - it_tpgt_t *tgt_tpgt_list; - uint32_t tgt_tpgt_count; - nvlist_t *tgt_properties; -} it_tgt_t; - -/* - * A target portal is represented by an IP address and a listening - * TCP port. - * - * portal_addr sockaddr_storage structure representing the - * IPv4 or IPv6 address and TCP port associated - * with the portal. - * portal_next Next portal in the list of portals. If - * portal_next is NULL, this is the last portal - * in the list. - */ -typedef struct it_portal_s { - struct sockaddr_storage portal_addr; - struct it_portal_s *next; -} it_portal_t; - -/* - * A portal is an IP address and TCP port and a portal group is a set - * of portals. Each defined portal belongs to exactly one portal group. - * Applications can associate a target portal group with a particular - * target using a target portal group name. Initiators can only connect - * to targets through the portals associated with the target's target - * portal group tags. - * - * tpg_name Identifier for the target portal group. - * tpg_generation Generation number which is incremented each - * time this structure changes. - * tpg_next Next target portal group in the list of target - * portal groups. If tpg_next is NULL, this is the - * last target portal group in the list. - * tpg_portal_count Number of it_portal_t structures in the list. - * tpg_portal_list Linked list of it_portal_t structures. - */ -typedef struct it_tpg_s { - char tpg_name[MAX_TPG_NAMELEN]; - uint64_t tpg_generation; - struct it_tpg_s *tpg_next; - uint32_t tpg_portal_count; - it_portal_t *tpg_portal_list; -} it_tpg_t; - -/* - * A context representing a remote iSCSI initiator node. The purpose - * of this structure is to maintain information specific to a remote - * initiator such as the CHAP username and CHAP secret. - * - * ini_name the iSCSI node name of the remote initiator. - * ini_generation Generation number which is incremented each - * time this structure changes. - * ini_next Next initiator in the list of initiators. - * If ini_next is NULL, this is the last initiator - * in the list. - * ini_properties Name/Value list containing the properties - * associated with the initiator context. This list - * can be manipulated using libnvpair(3lib), and should - * be validated and stored using it_ini_setprop(). - * - * Initiator nvlist Properties: - * - * nvlist Key Type Valid Values - * -------------------------------------------------------------------- - * chapuser string any string - * chapsecret string string of at least 12 characters - * but not more than 255 characters. - * secret will be base64 encoded when - * stored. - */ -typedef struct it_ini_s { - char ini_name[MAX_ISCSI_NODENAMELEN]; - uint64_t ini_generation; - struct it_ini_s *ini_next; - nvlist_t *ini_properties; -} it_ini_t; - - -/* - * This structure represents a complete configuration for the iscsit - * port provider. In addition to the global configuration, it_config_t - * includes lists of child objects including targets, target portal - * groups and initiator contexts. Each object includes a "generation" - * value which is used by the iscsit kernel driver to identify changes - * from one configuration update to the next. - * - * stmf_token A uint64_t that contains the value returned from a - * successful call to stmfGetProviderDataProt(3STMF). - * This token is used to verify that the configuration - * data persistently stored in COMSTAR has not been - * modified since this version was loaded. - * config_version Version number for this configuration structure - * config_tgt_list Linked list of target contexts representing the - * currently defined targets. Applications can add - * targets to or remove targets from this list using - * the it_tgt_create and it_tgt_delete functions. - * config_tgt_count The number of currently defined targets. - * config_tpg_list Linked list of target portal group contexts. - * Applications can add or remove target portal groups - * to/from this list using the it_tpg_create and - * it_tpg_delete functions. - * config_tpg_count The number of currently defined target portal groups - * config_ini_list Linked list of initiator contexts. Applications - * can add initiator contexts or remove initiator - * contexts from this list using the it_ini_create - * and it_ini_delete functions. - * config_ini_count The number of currently defined initiator contexts. - * config_global_properties - * Name/Value list representing the current global - * property settings. This list can be manipulated - * using libnvpair(3lib), and should be validated - * and stored using it_config_setprop(). - * config_isns_svr_list - * Linked list of currently defined iSNS servers. - * Applications can add or remove iSNS servers by - * using the it_config_setprop() function and changing - * the array of iSNS servers stored in the "isnsserver" - * property. - * config_isns_svr_count - * The number of currently defined iSNS servers. - * - * Global nvlist Properties: - * - * nvlist Key Type Valid Values - * -------------------------------------------------------------------- - * alias string any string - * auth string "radius", "chap", or "none" - * isns boolean B_TRUE, B_FALSE - * isnsserver string array Array of portal specifications of - * the form IPaddress:port. Port - * is optional; if not specified, the - * default iSNS port number of 3205 will - * be used. IPv6 addresses should - * be enclosed in square brackets '[' ']'. - * If "none" is specified, all defined - * iSNS servers will be removed from the - * configuration. - * radiusserver string IPaddress:port specification as - * described for 'isnsserver'. - * radiussecret string string of at least 12 characters - * but not more than 255 characters. - * secret will be base64 encoded when - * stored. - */ -typedef struct it_config_s { - uint64_t stmf_token; - uint32_t config_version; - it_tgt_t *config_tgt_list; - uint32_t config_tgt_count; - it_tpg_t *config_tpg_list; - uint32_t config_tpg_count; - it_ini_t *config_ini_list; - uint32_t config_ini_count; - it_portal_t *config_isns_svr_list; - uint32_t config_isns_svr_count; - nvlist_t *config_global_properties; -} it_config_t; - /* * Function: it_config_load() * |