From: claudio Date: Mon, 21 Apr 2014 18:59:05 +0000 (+0000) Subject: Bind to localAddr if specified and add some XXX comments about stuff X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4b539f8427e2866ca35184330a95781caea507e2;p=openbsd Bind to localAddr if specified and add some XXX comments about stuff that is not prefect yet. --- diff --git a/usr.sbin/iscsid/connection.c b/usr.sbin/iscsid/connection.c index 464b6ea0df0..35304f97364 100644 --- a/usr.sbin/iscsid/connection.c +++ b/usr.sbin/iscsid/connection.c @@ -1,4 +1,4 @@ -/* $OpenBSD: connection.c,v 1.17 2014/04/21 12:26:50 claudio Exp $ */ +/* $OpenBSD: connection.c,v 1.18 2014/04/21 18:59:05 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -285,6 +285,7 @@ conn_parse_kvp(struct connection *c, struct kvp *kvp) for (k = kvp; k->key; k++) { + /* XXX handle NotUnderstood|Irrelevant|Reject */ SET_NUM(k, s, MaxBurstLength, 512, 16777215); SET_NUM(k, s, FirstBurstLength, 512, 16777215); SET_NUM(k, s, DefaultTime2Wait, 0, 3600); @@ -425,7 +426,15 @@ c_do_connect(struct connection *c, enum c_event ev) session_fsm(c->session, SESS_EV_CONN_FAIL, c); return CONN_FREE; } - + if (c->config.LocalAddr.ss_len != 0) { + if (bind(c->fd, (struct sockaddr *)&c->config.LocalAddr, + c->config.LocalAddr.ss_len) == -1) { + log_warn("bind(%s)", + log_sockaddr(&c->config.LocalAddr)); + session_fsm(c->session, SESS_EV_CONN_FAIL, c); + return CONN_FREE; + } + } if (connect(c->fd, (struct sockaddr *)&c->config.TargetAddr, c->config.TargetAddr.ss_len) == -1) { if (errno == EINPROGRESS) { diff --git a/usr.sbin/iscsid/vscsi.c b/usr.sbin/iscsid/vscsi.c index 5606358fd9d..7878aa801d2 100644 --- a/usr.sbin/iscsid/vscsi.c +++ b/usr.sbin/iscsid/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.12 2014/04/21 12:24:58 claudio Exp $ */ +/* $OpenBSD: vscsi.c,v 1.13 2014/04/21 18:59:05 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -310,6 +310,8 @@ vscsi_dataout(struct connection *c, struct scsi_task *t, u_int32_t ttt, size = len - off > c->active.MaxRecvDataSegmentLength ? c->active.MaxRecvDataSegmentLength : len - off; + /* XXX also respect the MaxBurstLength */ + if (!(p = pdu_new())) fatal("vscsi_r2t"); if (!(dout = pdu_gethdr(p)))