summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-03-11 09:52:54 +0000
committermav <mav@FreeBSD.org>2015-03-11 09:52:54 +0000
commit6cffa62fefd8ca795a00d5772dc1732a48d428a9 (patch)
tree2064ff497d9722ac39b95066fab8efbcac85359f
parentbb2d9174ab9cbc151e93f4bf3c3326954ca56bb2 (diff)
downloadFreeBSD-src-6cffa62fefd8ca795a00d5772dc1732a48d428a9.zip
FreeBSD-src-6cffa62fefd8ca795a00d5772dc1732a48d428a9.tar.gz
MFC r279590: If target name starts with "naa.", set it as WWNN for CTL port.
-rw-r--r--usr.sbin/ctld/kernel.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c
index 59afbee..183aeef 100644
--- a/usr.sbin/ctld/kernel.c
+++ b/usr.sbin/ctld/kernel.c
@@ -897,9 +897,21 @@ kernel_port_add(struct port *port)
req.status);
return (1);
}
- } else if (port->p_pport)
+ } else if (port->p_pport) {
port->p_ctl_port = port->p_pport->pp_ctl_port;
+ if (strncmp(targ->t_name, "naa.", 4) == 0 &&
+ strlen(targ->t_name) == 20) {
+ bzero(&entry, sizeof(entry));
+ entry.port_type = CTL_PORT_NONE;
+ entry.targ_port = port->p_ctl_port;
+ entry.flags |= CTL_PORT_WWNN_VALID;
+ entry.wwnn = strtoull(targ->t_name + 4, NULL, 16);
+ if (ioctl(ctl_fd, CTL_SET_PORT_WWNS, &entry) == -1)
+ log_warn("CTL_SET_PORT_WWNS ioctl failed");
+ }
+ }
+
/* Explicitly enable mapping to block any access except allowed. */
lm.port = port->p_ctl_port;
lm.plun = UINT32_MAX;
OpenPOWER on IntegriCloud