On 12/24/2015 09:07 AM, Zhu Lingshan wrote:
Hi experts,
I am working on a patch for Targetcli, I have some fix plans, hope can
get your suggestions, thanks!
The patch want to fix a bug of Targetcli, that is if we leave iSCSI
name empty when create
a iSCSI target like this:
/> iscsi/ create
Invalid iqn wwn:
iqn.2003-01.org.linux-iscsi.leap_targetcli.x8664:sn.dd5521da2386
/>
we will see that error above, the reason is, "leap_targetcli" in the
target name,
this part of the automatic generated has a "_", which will be rejected
by the
function "is_valid_wwn(wwn_type, wwn, wwn_list=None)"
Replacing them with a dash when auto-generating might be an option.
This function will judge whether this wwn is valid, it will reject any
wwn names
has a " " or "_", I think that make sense, but when I read RFC3720, I
find that may
be not enough.
You are right, we do not enforce full RFC3270 IQN compliance.
In RFC3720, section 3.2.6.2 it's said:
The following characters are used for formatting iSCSI names:
- dash (’-’=U+002d)
- dot (’.’=U+002e)
- colon (’:’=U+003a)
So I assume that, "-", "." and ":" are acceptable in a iqn wwn name,
other special characters
like "!","@" and "$" should be rejected. But I did not see that code in
function "is_valid_wwn(wwn_type, wwn, wwn_list=None)"
Again, you are right.
I wonder whether I am understanding this right. Hope can get some
suggestions from you,
If I understand that right, I will write a patch to fix it, that
means, add some code lines to
reject characters like "!" and "&". Thanks!
Another thing is, I find Targetcli will add host name in the automatic
generated iSCSI wwn name,
Like :
/> iscsi/ create
Invalid iqn wwn:
iqn.2003-01.org.linux-iscsi.leap_targetcli.x8664:sn.dd5521da2386
/>
This part "leap_targetcli" is my host name, which has a "_", I also
want to fix this one, shall we change
"_" to "-" when handle such a host name or we can remove host name in
a automatic generated iSCSI wwn name?
I think doing some automated conversion to dash is a way to do it, yes.
Funny however that you embark on this and have a "_" in your hostname,
which is _not_ a legal character in https://www.ietf.org/rfc/rfc952.txt
hostnames! :-) The reasoning behind not checking the hostname to
autogenerate the IQN is that hostnames normally should only contain a-z,
0-9 and "-" chars, which all are legal in RFC3270. The reasoning behind
letting user-generated IQNs be more flexible is that at the time legacy
systems were using non-RFC3270 chars already and needed this for
compatibility. Basically, if your initiator supports it, you are free as
the sysadmin to follow the RFC or not.
But I am not arguing here that we should not enforce RFC3270, that would
of course be cleaner.
As for the hostname, well, assuming they would be valid RFC952 obviously
has its limits, so yes, we might want to do something about it.
Best Regards,
--
Jerome Martin
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html