iscsit_text.c revision a6d42e7d71324c5193c3b94d57d96ba2925d52e1
/*
* 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
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
#include <sys/stmf_ioctl.h>
#include <iscsit_isns.h>
#include <iscsit.h>
/*
* The kernel inet_ntop() function formats ipv4 address fields with
* leading zeros which the win2k initiator interprets as octal.
*/
{
unsigned char *p = (unsigned char *) in;
}
static void
{
if (reject_pdu == NULL) {
/* Just give up.. the initiator will timeout */
return;
}
/* Payload contains the header from the bad PDU */
}
static void
{
int ipsize, i;
char *name = "TargetAddress";
char a[IPADDRSTRLEN];
char v[PORTALSTRLEN];
struct sockaddr_storage *ss;
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
int type;
/*
* Look through the portal groups associated with this target.
*/
/*
* The default portal group will match any current interface.
* A target cannot listen on other portal groups if it
* listens on the default portal group.
*/
/*
* get the list of plumbed interfaces
*/
if (ipsize == 0) {
return;
}
sizeof (struct in_addr)) {
iscsit_v4_ntop(in, a, sizeof (a));
(void) snprintf(v, sizeof (v),
"%s,1", a);
sizeof (struct in6_addr)) {
sizeof (a));
(void) snprintf(v, sizeof (v),
"[%s],1", a);
} else {
break;
}
/*
* Add the TargetAddress=<addr> nvpair
*/
}
/*
* Cannot listen on other portal groups.
*/
return;
}
/*
* Found a defined portal group - add each portal address.
*/
switch (type) {
case AF_INET:
iscsit_v4_ntop(in, a, sizeof (a));
(void) snprintf(v, sizeof (v), "%s:%d,%d", a,
break;
case AF_INET6:
(void) snprintf(v, sizeof (v), "[%s]:%d,%d", a,
break;
default:
break;
}
}
}
}
void
{
char *textbuf;
int flags;
int textbuflen;
int rc;
/* Cannot handle multi-PDU messages now */
return;
}
/* Last of a multi-PDU message */
return;
}
/*
* At this point we have a single PDU text command
*/
kv_name = "SendTargets=";
kv_pair = "SendTargets=All";
/* Not a Sendtargets command */
return;
}
int validlen;
/*
* Most common case of SendTargets=All during discovery.
*/
/*
* Create an nvlist for response.
*/
return;
}
char *name = "TargetName";
target);
}
/*
* Convert the reponse nv list into text buffer.
*/
textbuf = 0;
textbuflen = 0;
validlen = 0;
&textbuflen, &validlen);
if (rc != 0) {
if (textbuf && textbuflen)
return;
}
/*
* Allocate a PDU and copy in text response buffer
*/
/*
* Fill in the response header
*/
} else {
/*
* Other cases to handle
* Discovery session:
* SendTargets=<target_name>
* Normal session
* SendTargets=<target_name> - should match session
* SendTargets=<NULL> - assume target name of session
* All others
* Error
*/
return;
}
/* Send the response on its way */
}