Hosts under test:
- FreeBSD 13/14 with ctld
- KVM/qemu virtual machines connected by iscsi to FreeBSD hosts
The libiscsi uses 2 bytes for LUN addressing:
https://github.com/sahlberg/libiscsi/blob/1017435ca9681236b6c993202a75b7b44d45d1ea/lib/pdu.c#L704
On other hand, FreeBSD CAM is compliant with SCSI Architecture model 5 (item 4.7)
https://github.com/freebsd/freebsd-src/blob/main/sys/cam/ctl/ctl.c#L3763
These 2 formats of LUN addressing are not compatible in general. It works under conditions:
- If LUN number is less than 256, libiscsi works fine with FreeBSD iscsi host.
- If LUN number is equal or more than 256, FreeBSD can't retrieve LUN number sent by libiscsi.
This patch is minimal changes to handle libiscsi LUNs higher than 256.
We will appreciate if patch will be accepted. If not, please advise how to implement correctly.
Thank you!