summaryrefslogtreecommitdiffstats
path: root/usr.sbin/iscsid
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2014-04-20 16:49:56 +0000
committerclaudio <claudio@openbsd.org>2014-04-20 16:49:56 +0000
commit889e0b3b7ab0574105a0c39b25a2f33821963efb (patch)
tree832b17ad238c038717dfd063245ee3bd60995b4d /usr.sbin/iscsid
parentmove in6_cksum_phdr from in6.h to ip6_output.c to mirror in_cksum_phdr (diff)
downloadwireguard-openbsd-889e0b3b7ab0574105a0c39b25a2f33821963efb.tar.xz
wireguard-openbsd-889e0b3b7ab0574105a0c39b25a2f33821963efb.zip
Fix conn_gen_kvp and its caller to fill the kvp array properly (including
the NULL terminator at the end). Now iscsid does proper LoginOperational negotiation (which will bump the MaxRecvDataSegmentLength to 64k)
Diffstat (limited to 'usr.sbin/iscsid')
-rw-r--r--usr.sbin/iscsid/connection.c12
-rw-r--r--usr.sbin/iscsid/initiator.c3
2 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/iscsid/connection.c b/usr.sbin/iscsid/connection.c
index dc63a3ee187..d9c0ad6ae1d 100644
--- a/usr.sbin/iscsid/connection.c
+++ b/usr.sbin/iscsid/connection.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: connection.c,v 1.13 2011/05/04 21:00:04 claudio Exp $ */
+/* $OpenBSD: connection.c,v 1.14 2014/04/20 16:49:56 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -313,31 +313,31 @@ conn_gen_kvp(struct connection *c, struct kvp *kvp, size_t *nkvp)
size_t i = 0;
if (s->mine.MaxConnections != iscsi_sess_defaults.MaxConnections) {
- i++;
if (kvp && i < *nkvp) {
kvp[i].key = strdup("MaxConnections");
if (kvp[i].key == NULL)
return (-1);
- if (asprintf(&kvp[i].value, "%u",
- (unsigned int)s->mine.MaxConnections) == -1) {
+ if (asprintf(&kvp[i].value, "%hu",
+ s->mine.MaxConnections) == -1) {
kvp[i].value = NULL;
return (-1);
}
}
+ i++;
}
if (c->mine.MaxRecvDataSegmentLength !=
iscsi_conn_defaults.MaxRecvDataSegmentLength) {
- i++;
if (kvp && i < *nkvp) {
kvp[i].key = strdup("MaxRecvDataSegmentLength");
if (kvp[i].key == NULL)
return (-1);
if (asprintf(&kvp[i].value, "%u",
- (unsigned int)c->mine.MaxRecvDataSegmentLength) == -1) {
+ c->mine.MaxRecvDataSegmentLength) == -1) {
kvp[i].value = NULL;
return (-1);
}
}
+ i++;
}
*nkvp = i;
diff --git a/usr.sbin/iscsid/initiator.c b/usr.sbin/iscsid/initiator.c
index 99e914ab43a..a8b794d73d0 100644
--- a/usr.sbin/iscsid/initiator.c
+++ b/usr.sbin/iscsid/initiator.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: initiator.c,v 1.11 2014/04/19 18:31:33 claudio Exp $ */
+/* $OpenBSD: initiator.c,v 1.12 2014/04/20 16:49:56 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -276,6 +276,7 @@ initiator_login_kvp(struct connection *c, u_int8_t stage)
case ISCSI_LOGIN_STG_OPNEG:
if (conn_gen_kvp(c, NULL, &nkvp) == -1)
return NULL;
+ nkvp += 1; /* add slot for terminator */
if (!(kvp = calloc(nkvp, sizeof(*kvp))))
return NULL;
if (conn_gen_kvp(c, kvp, &nkvp) == -1) {