Commit Graph

578 Commits

Author SHA1 Message Date
Peter Lieven
ec46d6fa43 DEBUG add function to set debug fd
DPRINTF was blindly sending all debug output to fd 2 (stderr).
The new function iscsi_set_debug_fd() will set the debug fd.
In general debugging is completely disabled by default.
2012-11-06 16:07:43 +01:00
Peter Lieven
3e57a612db SOCKET add more skill to interface binding
If a process opens more than once connection the interfaces are assigned
round-robin from the available ones. However, different processes will
uses a random interface of as starting point. This patch will also
make the redirect case handled correctly.
2012-11-06 15:47:30 +01:00
Peter Lieven
f00cd04810 INIT call srand() once at iscsi_create_context()
currently the rng is not seeded at all which makes the isid not really random
at all.
2012-11-06 15:01:34 +01:00
Peter Lieven
6cad82532a SOCKET add option to bind to connection to interface(s) 2012-11-06 14:53:55 +01:00
Peter Lieven
0d8819e68f INIT allow iscsi_context = NULL in iscsi_set_error()
qemu-kvm calls iscsi_parse_url_full() with iscsi = NULL.
In case there is an invalid URL specified qemu-kvm segfaults when
it tries to set iscsi->error_string.

I tried to patch this in qemu-kvm, but the initiator_name is dirived
from the target name so this seemed to be the easier approach.
2012-11-06 08:53:38 +01:00
Peter Lieven
1ba60282bf LD_ISCSI invalidate get_lba_status cache on write 2012-11-05 21:23:30 +01:00
Peter Lieven
57ec16023e LOGIN change dynamic string allocations to statics 2012-11-05 15:33:12 +01:00
Peter Lieven
e6553c2ef8 MEMORY account reallocs 2012-11-05 15:20:15 +01:00
Peter Lieven
65cd38e8ff PDU further optimize iscsi_add_data()
This patch further improves add data and esepcially preassigns
the right amount of memory where the amount is preknown
2012-11-05 15:13:50 +01:00
Peter Lieven
b5183d5e30 LD_ISCSI add pwrite and dlsym it at init 2012-11-03 18:15:05 +01:00
Peter Lieven
e1bb8e1ed1 LD_ISCSI add pwite 2012-11-03 18:12:39 +01:00
Peter Lieven
0639c7e9ab LD_ISCSI add write
the write command is limited in the sense that file offset and
count bytes must be multiple of the targets blocksize. for most
copy/dd etc. operations this is sufficient to work.
2012-11-03 18:08:12 +01:00
Peter Lieven
2e413a3c9f LD_ISCSI add pread 2012-11-03 17:48:31 +01:00
Peter Lieven
d2894e4634 LD_ISCSI add lseek 2012-11-03 17:36:29 +01:00
Peter Lieven
0bf8b38808 LD_ISCSI fix segfault on reconnect
iscsi_reconnect calls dup2 which is intercepted in ld_iscsi. Fix this by
calling the real dup2 in this case.
2012-11-03 11:09:20 +01:00
Peter Lieven
fbfa6bca61 ISCSI-READCAPACITY16 fix missing free of scsi_task 2012-11-03 10:58:35 +01:00
Peter Lieven
36527c5122 Merge remote-tracking branch 'aredlich/master'
Conflicts:
	lib/init.c
	lib/socket.c
2012-11-03 10:39:23 +01:00
Peter Lieven
c4dc380262 PDU reduce number of mallocs/memcpys in iscsi_add_data()
This patch adds logarithmic malloc behaviour to iscsi_add_data().
Currently for each new call there is a new buffer allocated
and all old data is copied to the new buffer. Change this by
allocating at least PAGE_SIZE bytes and increase the allocation
by powers of 2 each time it does no longer fit.
2012-11-03 02:49:56 +01:00
Peter Lieven
d9fbe37f4b HEADERS fix early commit of new header data 2012-11-03 02:28:23 +01:00
Peter Lieven
3268ae4c88 INIT fix iscsi_destroy_url 2012-11-03 02:26:30 +01:00
Peter Lieven
a6caad107c INIT zero out sensitive data before its freed
The iscsi_url and iscsi_context might contain clear text
login credentials for an iscsi target. As Linux zeroes
on allocate this data might remain in memory for a long
time.
2012-11-03 02:12:46 +01:00
Peter Lieven
871c56ce7a MEMORY add compatibility for qemu-kvm
qemu-kvm iscsi block driver calls iscsi_parse_full_url without
a valid iscsi_context. The driver also creates its own scsi_task
objects.
2012-11-03 02:05:16 +01:00
Peter Lieven
7f98233169 Merge remote-tracking branch 'upstream/master' 2012-11-03 01:07:40 +01:00
Peter Lieven
d327ab09c6 MEMORY add wrappers around all mallocs and frees and trace them
This patch adds a wrapper around all memory allocations and frees.
The idea is to get warned immediately if the application leaks memory.
Additionally the wrapper functions make it easy to add different
memory allocators or memory pools in the future.
2012-11-03 01:05:57 +01:00
Arne Redlich
f618d08350 T1030_unsolicited_data_overflow: fix uninitialized variable warning
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:28:40 +01:00
Arne Redlich
13b1f49fe5 T1031_unsolicited_data_out: fix uninitialised variable warning
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:23:47 +01:00
Arne Redlich
d2e68d7a25 T0122_read6_invalid: suppress signed/unsigned comparison warnings
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:16:45 +01:00
Arne Redlich
0bf9b6389c Annotate iscsi_set_error with printf format attribute
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:11:30 +01:00
Arne Redlich
081ae59cdf T0105_read10_invalid: suppress signed/unsigned comparison warnings
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 17:05:47 +01:00
Arne Redlich
5cd48f87ff T0403_inquiry_supported_vpd: fix signed/unsigned comparison warning
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 17:00:46 +01:00
Arne Redlich
b5372272b1 T0422_reserve6_logout: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:54:29 +01:00
Arne Redlich
578bdae3af T0421_reserve6_lun_reset: fix compiler warnings
Remove unused label and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:53:26 +01:00
Arne Redlich
af33ca36ff T1031_unsolicited_data_out: mark unused parameters as such
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:50:38 +01:00
Arne Redlich
17e8b54759 T1030_unsolicited_data_overflow: remove unused variable
old_first_burst_len is set but never used - remove it. Also replace an
  if (!ptr)
    free(ptr)
with
  free(ptr)

as the check is redundant.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:48:48 +01:00
Peter Lieven
389f6a8ba5 SCSI half mallocs in scsi_malloc 2012-10-31 16:46:33 +01:00
Arne Redlich
e0555555bb T0430_report_all_supported_ops: fix compiler warnings
* remove unused label
* mark unused parameter
* fix signedness warnings

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:46:01 +01:00
Arne Redlich
ea560255a6 T0424_reserve6_target_reset: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:40:29 +01:00
Arne Redlich
ab411e4401 T0423_reserve6_sessionloss: fix compiler warnings
Remove unused labels and mark unused parameters as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:34:11 +01:00
Arne Redlich
d402a337e3 T0420_reserve6_simple: fix compiler warnings
Mark unused parameter as such and remove unused labels.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:32:12 +01:00
Arne Redlich
88341c0a73 T0410_readtoc_basic: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:25:47 +01:00
Arne Redlich
13c253f0dc T0404_inquiry_all_reported_vpd: fix compiler warnings
* mark unused parameter as such
* wrap parens around a bitop
* remove unused labels
* fix error messages

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:20:55 +01:00
Arne Redlich
c195348e4d T0403_inquiry_supported_vpd: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:12:21 +01:00
Arne Redlich
ea20edb513 T0402_inquiry_evpd: fix compiler warnings
Remove unused label and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:06:25 +01:00
Arne Redlich
6819637ddc T0401_inquiry_alloclen: fix compiler warnings
Remove unused variables and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:59:42 +01:00
Arne Redlich
e991146902 T0241_prefetch10_flags: remove unused variable
Pointed out by gcc: num_blocks is set but unused

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:58:31 +01:00
Arne Redlich
1be5fe1bda T0251_prefetch16_flags: remove unused variable
gcc points out that num_blocks is set but never used

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:55:52 +01:00
Arne Redlich
d983cdfc2c T0161_readcapacity16_alloclen: remove unused variable
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:54:33 +01:00
Arne Redlich
34b25f94c1 0122_read6_invalid.c: add missing include
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:53:08 +01:00
Arne Redlich
45ce1537f2 T0400_inquiry_basic: fix compiler warnings
gcc complains about an unused parameter (mark it as such) and unused labels
(remove 'em).

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:52:11 +01:00
Arne Redlich
311a63c61d T0401_inquiry_alloclen: remove unused label
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:50:59 +01:00