Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 172388 Details for
Bug 192462
[EMC/NetApp/Oracle RHEL 4.7 bug] Cannot specify ports to use with iscsi tools in RHEL4
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
black/white list portals
portal-blacklist2.patch (text/plain), 12.36 KB, created by
Mike Christie
on 2007-08-24 02:35:58 UTC
(
hide
)
Description:
black/white list portals
Filename:
MIME Type:
Creator:
Mike Christie
Created:
2007-08-24 02:35:58 UTC
Size:
12.36 KB
patch
obsolete
>Only in linux-iscsi-4.0.3.0.work/: cscope.files >Only in linux-iscsi-4.0.3.0.work/: cscope.out >diff -aurp linux-iscsi-4.0.3.0/daemon/include/iscsi-config.h linux-iscsi-4.0.3.0.work/daemon/include/iscsi-config.h >--- linux-iscsi-4.0.3.0/daemon/include/iscsi-config.h 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/daemon/include/iscsi-config.h 2007-08-22 14:10:07.000000000 -0500 >@@ -140,6 +140,7 @@ struct iscsi_subnet_config { > struct iscsi_connection_timeout_config connection_timeout_options; > struct iscsi_error_timeout_config error_timeout_options; > struct iscsi_tcp_config tcp_options; >+ int enabled; > }; > > struct iscsi_sendtargets_config { >diff -aurp linux-iscsi-4.0.3.0/daemon/include/iscsid.h linux-iscsi-4.0.3.0.work/daemon/include/iscsid.h >--- linux-iscsi-4.0.3.0/daemon/include/iscsid.h 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/daemon/include/iscsid.h 2007-08-22 13:37:16.000000000 -0500 >@@ -144,6 +144,7 @@ extern void free_session_process(struct > > /* Offline warn message function */ > extern void offline_warn(char *offline, struct iscsi_session_config *config); >+extern int find_host_no(struct iscsi_session_config *config); > > /* exit code for session processes that failed, but shouldn't be retried */ > #define ISCSI_SESSION_FAILED_NO_RETRY 100 >diff -aurp linux-iscsi-4.0.3.0/daemon/include/iscsi-hooks.h linux-iscsi-4.0.3.0.work/daemon/include/iscsi-hooks.h >--- linux-iscsi-4.0.3.0/daemon/include/iscsi-hooks.h 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/daemon/include/iscsi-hooks.h 2007-08-22 13:27:41.000000000 -0500 >@@ -41,6 +41,7 @@ extern void iscsi_init_config_defaults(s > extern int iscsi_session_process(struct iscsi_session_process *process, > struct iscsi_session_config *config); > extern void iscsi_kill_session(struct iscsi_session_process *process); >+extern void ioctl_terminate_session(struct iscsi_session_config *config); > > /* notifications from the main daemon that may effect existing sessions */ > extern void iscsi_lun_inventory_changed(struct iscsi_session_process *process); >diff -aurp linux-iscsi-4.0.3.0/daemon/iscsi-config.c linux-iscsi-4.0.3.0.work/daemon/iscsi-config.c >--- linux-iscsi-4.0.3.0/daemon/iscsi-config.c 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/daemon/iscsi-config.c 2007-08-22 14:18:25.000000000 -0500 >@@ -1464,8 +1464,9 @@ update_iscsi_config(const char *pathname > > if (value >= 0) { > if (current_entry) { >- if (current_entry->type == >- CONFIG_TYPE_TARGETNAME) { >+ switch (current_entry->type) { >+ case CONFIG_TYPE_TARGETNAME: >+ { > struct iscsi_targetname_config > *targetname_config = > current_entry-> >@@ -1484,7 +1485,29 @@ update_iscsi_config(const char *pathname > value ? > "enabled" : > "disabled"); >- } else { >+ break; >+ } >+ case CONFIG_TYPE_SUBNET: >+ { >+ struct iscsi_subnet_config *subnet_config = entry->config.subnet; >+ >+ subnet_config->enabled = >+ value; >+ debugmsg(5, >+ "config entry " >+ "%p subnet" >+ " %p to %s %s", >+ current_entry, >+ subnet_config, >+ subnet_config-> >+ ip_address, >+ value ? >+ "enabled" : >+ "disabled"); >+ >+ break; >+ } >+ default: > logmsg(AS_ERROR, > "error on line " > "%d of %s, " >@@ -1819,6 +1842,7 @@ update_iscsi_config(const char *pathname > entry->type = CONFIG_TYPE_SUBNET; > entry->config.subnet = subnet_config; > >+ subnet_config->enabled = 1; > subnet_config->subnet_mask = 0xFFFFFFFFU; > > /* look for a subnet mask */ >@@ -3050,6 +3074,42 @@ update_session_configs(struct iscsi_targ > return 1; > } > >+static int portal_enabled(struct iscsi_config *config, >+ struct iscsi_portal_descriptor *descriptor) >+{ >+ struct iscsi_config_entry *entry; >+ struct iscsi_subnet_config *subnet_config; >+ >+ for (entry = config->head; entry; entry = entry->next) { >+ if (entry->type != CONFIG_TYPE_SUBNET) >+ continue; >+ >+ subnet_config = entry->config.subnet; >+ if (descriptor->ip_length == 4) { >+ uint32_t a1, a2; >+ >+ a1 = descriptor-> ip[0] << 24; >+ a1 |= descriptor->ip[1] << 16; >+ a1 |= descriptor->ip[2] << 8; >+ a1 |= descriptor->ip[3]; >+ a1 &= subnet_config->subnet_mask; >+ >+ a2 = subnet_config->ip_address[0] << 24; >+ a2 |= subnet_config->ip_address[1] << 16; >+ a2 |= subnet_config->ip_address[2] << 8; >+ a2 |= subnet_config->ip_address[3]; >+ a2 &= subnet_config->subnet_mask; >+ >+ if (a1 != a2) >+ continue; >+ >+ if (!subnet_config->enabled) >+ return 0; >+ } >+ } >+ return 1; >+} >+ > /* create one or more session configs based on the target config. */ > void > create_session_configs(struct iscsi_target_config *target, >@@ -3106,11 +3166,24 @@ create_session_configs(struct iscsi_targ > target->TargetName); > break; > } >+ session->next = NULL; >+ session->target = target; >+ >+ portal->descriptor = descriptor; >+ /* only one portal */ >+ portal->next = NULL; >+ session->portal = portal; > > sprintf(ip_address,"%s",descriptor->address); > sprintf(tpgt, "%hu",descriptor->tag); >- if (!device_list) >+ if (!device_list) { >+ if (!portal_enabled(config, descriptor)) { >+ free(session); >+ free(portal); >+ continue; >+ } > goto driver_notup; >+ } > > dlist_for_each_data(device_list, cldev, > struct sysfs_class_device) { >@@ -3170,6 +3243,14 @@ create_session_configs(struct iscsi_targ > } > } > } >+ if (!portal_enabled(config, descriptor)) { >+ if (found) >+ offline_warn("PortalDisabled", session); >+ free(portal); >+ free(session); >+ continue; >+ } >+ > if (!found) { > int i; > >@@ -3185,6 +3266,7 @@ create_session_configs(struct iscsi_targ > } > } > } >+ > found = 0; > goto isid_done; > driver_notup: >@@ -3197,14 +3279,6 @@ driver_notup: > session->isid[5] = (path_number) & 0xFF; > session->path_number = path_number++; > isid_done: >- session->next = NULL; >- session->target = target; >- >- portal->descriptor = descriptor; >- /* only one portal */ >- portal->next = NULL; >- session->portal = portal; >- > debugmsg(1, "target config %p session #%d config %p portal %p " > "using descriptor %p", target, session->path_number, session, portal, descriptor); > >diff -aurp linux-iscsi-4.0.3.0/daemon/iscsid.c linux-iscsi-4.0.3.0.work/daemon/iscsid.c >--- linux-iscsi-4.0.3.0/daemon/iscsid.c 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/daemon/iscsid.c 2007-08-22 14:18:53.000000000 -0500 >@@ -949,7 +949,7 @@ alloc_portal_descriptor(void) > > static char discovery_buffer[256 * 1024]; > >-static int >+int > find_host_no(struct iscsi_session_config *config) > { > char isid[7], tpgt[10]; >@@ -1002,12 +1002,14 @@ offline_warn(char *offline, struct iscsi > > host_no = find_host_no(config); > >- if (host_no > -1) >- logmsg(AS_ERROR, "%s has been received on Host %d on %s. Set " >- "ConnFailTimeout to a low value like 5 secs through " >- "sysfs. Unmount all the mounted devices of this host if " >- "any. Shutdown Host number %d through sysfs.\n", offline, >- host_no, config->portal->descriptor->address, host_no); >+ if (host_no > -1) { >+ logmsg(AS_ERROR, "%s has been received on Host %d on %s. " >+ "Setting ConnFailTimeout to 5 secs and removing " >+ "session", offline, host_no, >+ config->portal->descriptor->address); >+ ioctl_terminate_session(config); >+ } else >+ logmsg(AS_ERROR, "Could not remove session for %s event."); > } > > static void >diff -aurp linux-iscsi-4.0.3.0/daemon/iscsi-linux.c linux-iscsi-4.0.3.0.work/daemon/iscsi-linux.c >--- linux-iscsi-4.0.3.0/daemon/iscsi-linux.c 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/daemon/iscsi-linux.c 2007-08-22 14:20:00.000000000 -0500 >@@ -43,6 +43,9 @@ static int stop_requested = 0; > static int reload_config = 0; > > #define ISCSI_DEVICE "/dev/iscsictl" >+#define SCSI_HOST_DIR "/sys/class/scsi_host" >+ >+static char sysfs_file[PATH_MAX]; > > static int control_fd = -1; > >@@ -354,7 +357,6 @@ ioctl_establish_session(struct iscsi_ses > struct iscsi_session_ioctl *ioctld = NULL; > struct sockaddr_in *addr; > >- > /* allocate an ioctl structure with enough space for > * all of the portal info > */ >@@ -566,8 +568,38 @@ iscsi_session_process(struct iscsi_sessi > void > ioctl_terminate_session(struct iscsi_session_config *config) > { >- debugmsg(1, "terminate session not implemented\n", >- __FILE__, __LINE__); >+ int host_no, fd; >+ >+ host_no = find_host_no(config); >+ if (host_no == -1) >+ goto fail; >+ >+ memset(sysfs_file, 0, PATH_MAX); >+ sprintf(sysfs_file, SCSI_HOST_DIR"/host%d/connfail_timeout", host_no); >+ fd = open(sysfs_file, O_WRONLY); >+ if (fd < 0) { >+ logmsg(AS_ERROR, "Could not set connfail_timeout for " >+ "session (host no %d) termination", host_no); >+ goto fail; >+ } >+ write(fd, "5", 1); >+ close(fd); >+ >+ memset(sysfs_file, 0, PATH_MAX); >+ sprintf(sysfs_file, SCSI_HOST_DIR"/host%d/shutdown", host_no); >+ fd = open(sysfs_file, O_WRONLY); >+ if (fd < 0) { >+ logmsg(AS_ERROR, "Could not open shutdown file for " >+ "session (host no %d) termination", host_no); >+ goto fail; >+ } >+ write(fd, "1", 1); >+ close(fd); >+ return; >+fail: >+ logmsg(AS_ERROR, "Could not delete session %p with host no %d", >+ config, host_no); >+ return; > } > > void >@@ -636,7 +668,6 @@ iscsi_config_changed(struct iscsi_sessio > if (new_config == NULL) { > /* This can happen only if target is deleted */ > offline_warn("Target Offline", current_config); >- ioctl_terminate_session(current_config); > return; > } > >diff -aurp linux-iscsi-4.0.3.0/man/iscsi.conf.5 linux-iscsi-4.0.3.0.work/man/iscsi.conf.5 >--- linux-iscsi-4.0.3.0/man/iscsi.conf.5 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/man/iscsi.conf.5 2007-08-22 14:42:37.000000000 -0500 >@@ -35,7 +35,7 @@ J) Per Target settings > .br > K) Per Subnet settings. > .br >-L) Enable/Disable Targets. >+L) Enable/Disable Targets or portals. > .br > M) Keeping Discovery Session Alive > .SH OPTIONS OF CATEGORY A: >@@ -275,13 +275,14 @@ Address=10.4.100.0 > .SS > .B Enabled=yes|no > The above parameter can be used to globally enable or disable targets >-or to selectively enable them under per Targetname option. Valid options are: >+or to selectively enable targets or portals under the Targetname >+or Address/Subnet option. Valid options are: > .TP > .B yes >-TargetNames mentioned after this line will be enabled by default >+TargetNames or portals mentioned after this line will be enabled by default > .TP > .B no >-TargetNames mentioned after this line will be disabled by default >+TargetNames portals mentioned after this line will be disabled by default > > .SH OPTIONS OF CATEGORY M: > .SS >diff -aurp linux-iscsi-4.0.3.0/misc/iscsi.conf linux-iscsi-4.0.3.0.work/misc/iscsi.conf >--- linux-iscsi-4.0.3.0/misc/iscsi.conf 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/misc/iscsi.conf 2007-08-22 14:43:27.000000000 -0500 >@@ -118,9 +118,9 @@ > # settings (e.g., target set for "always" and initiator set for "never"), the > # login will fail. > # >-# ---------------------- >-# ENABLE/DISABLE TARGETS >-# ---------------------- >+# ------------------------------------------ >+# ENABLE/DISABLE TARGETS OR SPECIFIC PORTALS >+# ------------------------------------------ > # To globally enable/disable group of targets use the following option. > # > # TargetNames mentioned after the below entry will be enabled by default. >@@ -135,6 +135,17 @@ > #TargetName=iqn.1987-05.com.cisco:00.0d1d898e8d66.t0 > # Enabled=yes > # >+# To specifically enable/disable a portal, use the following entry >+# under Address. >+#Address=192.168.0.10 >+# Enabled=no >+# >+# To specifically enable/disable a group of portals, use the following entry >+# >+#Subnet=192.168.10.0/24 >+# Enabled=no >+# >+# > # --------------------------- > # CONNECTION TIMEOUT SETTINGS > # --------------------------- >diff -aurp linux-iscsi-4.0.3.0/README linux-iscsi-4.0.3.0.work/README >--- linux-iscsi-4.0.3.0/README 2007-08-20 07:56:18.000000000 -0500 >+++ linux-iscsi-4.0.3.0.work/README 2007-08-22 14:43:02.000000000 -0500 >@@ -643,8 +643,8 @@ EDITING THE ISCSI.CONF FILE > command to complete before declaring > the reset command failed. > >- Enabled Enable/Disable a target or list of yes >- targets. >+ Enabled Enable/Disable a target, list of yes >+ targets or portals. > > InitialR2T Enabling/disabling of R2T flow control no > with the target.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 192462
: 172388 |
302166