From 5bee45bc9ffab51eb612b7d95822914ff90a5273 Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 21 Apr 2014 18:00:23 +0000 Subject: [PATCH] Start passing the initiator and target name in the show command. --- usr.sbin/iscsid/iscsid.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index df339323c24..0faa435e800 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iscsid.c,v 1.13 2014/04/21 09:48:31 claudio Exp $ */ +/* $OpenBSD: iscsid.c,v 1.14 2014/04/21 18:00:23 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -273,9 +274,27 @@ iscsid_ctrl_dispatch(void *ch, struct pdu *pdu) control_compose(ch, CTRL_INITIATOR_CONFIG, &initiator->config, sizeof(initiator->config)); - TAILQ_FOREACH(s, &initiator->sessions, entry) - control_compose(ch, CTRL_SESSION_CONFIG, - &s->config, sizeof(s->config)); + TAILQ_FOREACH(s, &initiator->sessions, entry) { + struct ctrldata cdv[3]; + bzero(cdv, sizeof(cdv)); + + cdv[0].buf = &s->config; + cdv[0].len = sizeof(s->config); + + if (s->config.TargetName) { + cdv[1].buf = s->config.TargetName; + cdv[1].len = + strlen(s->config.TargetName) + 1; + } + if (s->config.InitiatorName) { + cdv[2].buf = s->config.InitiatorName; + cdv[2].len = + strlen(s->config.InitiatorName) + 1; + } + + control_build(ch, CTRL_SESSION_CONFIG, + nitems(cdv), cdv); + } control_compose(ch, CTRL_SUCCESS, NULL, 0); break; -- 2.20.1