Subject: Re: bin/34578 (iscsi_target rejects Windows iscsi initiator.)
To: Alistair Crooks <agc@pkgsrc.org>
From: nakamoto <hiroshi-n@iname.com>
List: netbsd-bugs
Date: 11/27/2006 08:31:07
> On Sun, Nov 26, 2006 at 02:55:02PM +0000, nakamoto wrote:
>   
>> The following reply was made to PR bin/34578; it has been noted by GNATS.
>>
>> From: nakamoto <hiroshi-n@iname.com>
>> To: gnats-bugs@NetBSD.org
>> Cc: agc@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
>> Subject: Re: bin/34578 (iscsi_target rejects Windows iscsi initiator.)
>> Date: Sun, 26 Nov 2006 22:38:24 +0900
>>
>>  I checked the source file from 4.0_BETA and I noticed allow_netmask()
>>  (netmask.c) had a bug.
>>  (I did it a while ago, but I did not know how to report the fix.)
>>  It works with any netmasks other than "0.0.0.0/0" ( "any", "all" ).
>>  When it meets "0.0.0.0/0", it executes some strange code to avoid
>>  shifting 32 bits,
>>  
>>  After I modified the function as the following, the bug disappeared.
>>  If you do not see the problem, it might already have been fixed.
>>  
>>  Hiroshi Nakamoto
>>     
>
> Thanks for the bug report. I did a quick diff, and found that your changes
> modify the number of bits to 32 when /0 is seen, and also moved the check
> for a zero length netmask much later in the function (although this has
> no functional effect, since the number of bits is not modified in between).
>
> The netmask.c file also has some code in there to help debugging - by compiling
> with -DALLOW_NETMASK_DEBUG, and also using the path to the include directory:
>
> [17:17:37] agc@inspiron1300 ...dist/iscsi/src 137 > cc -g netmask.c -DALLOW_NETMASK_DEBUG=1 -I../include -o n
> [17:18:05] agc@inspiron1300 ...dist/iscsi/src 138 > ./n 0/0 10.4.3.7
> addr 10.4.3.7 0, mask 0.0.0.0 0, slash 1
> mask 0/0 matches addr 10.4.3.7
>
> [17:18:15] agc@inspiron1300 ...dist/iscsi/src 139 > ./n any 10.4.3.7
> addr 10.4.3.7 0, mask 0.0.0.0 0, slash 1
> mask any matches addr 10.4.3.7
>
> [17:20:09] agc@inspiron1300 ...dist/iscsi/src 140 > ./n any 10.0.0.0
> addr 10.0.0.0 0, mask 0.0.0.0 0, slash 1
> mask any matches addr 10.0.0.0
>
> [17:20:20] agc@inspiron1300 ...dist/iscsi/src 141 >
>
> (The above was produced by using unmodified code from that in the NetBSD
> CVS repository)
>
> So, although the function hasn't been changed, I can't reproduce the
> problem, either in debugging, or in practice with the MS initiator.
>
> Are you using IPv6 to connect up?
>   
Though IPv6 is enabled, I did use IPv4 to connecto from Windows XP iSCSI 
initiator.

I have never succeeded in connectiion when iSCSI target configuration is 
set to "any","all".
I always got "mask 0.0.0.0/0 does not match" messages.
I will reisntall NetBSD 4 and test again.

Hiroshi Nakmaoto