open-iscsi / target-isns

Target-isns is an iSNS client for the Linux LIO iSCSI target
GNU General Public License v2.0
16 stars 19 forks source link

Failed to connect on IPv6 network #51

Closed yu-murai closed 4 years ago

yu-murai commented 4 years ago

I tried to connect using IPv6 network for registering the target to iSNS server. But it was failed and following error message. ST-lin-initiator-Black:/home/yumurai/target-isns/target-isns-master/build # ./src/target-isns --isns-server fd00:3:7::15 --debug --configfs-iscsi-path fake-iscsi-path/ 0.000000 I: target-isns version 0.6.5 started 0.000030 I: iSNS server is fd00:3:7::15:3205 3.000199 E: unable to connect (No route to host) 10!

I try to other ways, but I have no idea how to connect to iSNS server that set IPv6 address. Anyone who has succeeded to connect at the same situation?

Test Configuration

cvubrugier commented 4 years ago

@yu-murai wrote:

Anyone who has succeeded to connect at the same situation?

I never tried target-isns with IPv6 before. I gave it a try and got a different error than yours: connection timed out. I am going to investigate.

What is the iSNS server you are trying to connect to? Open-iSNS?

yu-murai commented 4 years ago

@cvubrugier Thank you for your reply.

I never tried target-isns with IPv6 before. I gave it a try and got a different error than yours: >connection timed out.

Thank you for your feedback. I guess "connection timed out" error is something wrong about network configuration. Can you ping6 to iSNS server?

What is the iSNS server you are trying to connect to? Open-iSNS?

I used Windows Server 2016 as iSNS server. Never tried open-isns. If you have any more questions or comments, please let me know. I am going to try that.

yu-murai commented 4 years ago

@cvubrugier

Sorry. I forgot the reply.

What is the iSNS server you are trying to connect to? Open-iSNS?

Should I try the open-isns as iSNS server?

cvubrugier commented 4 years ago

Hi @yu-murai,

I have fixed an issue in target-isns that causes connect() to fail with IPv6 addresses. See commit ab77cea in branch fix-ipv6. You may want to test it. However, I think there are other issues around getnameinfo().

I used Windows Server 2016 as iSNS server. Never tried open-isns. [...] Should I try the open-isns as iSNS server?

Windows Server 2016 is fine. I don't have access to a Windows machine so I welcome all users that can test with it ;-)

I tried to test with Open-iSNS but failed to establish an IPv6 connection. Maybe there is an issue in Open-iSNS (not sure at all), in my network, or in target-isns. As a consequence, I used a fake iSNS server written in Python that listens on the iSNS port (3205) and that accepts connections from the IPv6 domain only.

cvubrugier commented 4 years ago

Hi @yu-murai,

I pushed more fixes to branch fix-ipv6. I hope that these patches will fix your issue.

gonzoleeman commented 4 years ago

Hi. After you posted your issue, I dropped into a black hole of testing the current open-isns to make sure it works with IPv6. I found one small but serious issue in the IPv6 address parsing code (it forgot to skip over the '[' in the IPv6 address), but other than that, it seems to work.

Note that if you are using link-level IPv6 addresses (as many are), you have to specify the ethernet adapter name in the address, e.g. '[fe80::1bc4:cd5f:e97:22bc%eth0]:3205'.

The fixes have been pushed to master, and all the internal self-tests run (though none-test IPv6), so please let me know if you try to use open-isns and it doesn't work.

I'll be testing with target-isns myself soon, now that I know open-isns is working.

yu-murai commented 4 years ago

Hi @cvubrugier , @gonzoleeman

Sorry for the late reply. Thank you for providing the fixed code. I tried that and confirm it works I expected. And I also realized -isns-server parameter does not include '[' and ']' around IPv6 address same as @gonzoleeman mentioned. However it does not matter for using target-isns. If you are going to fix this small issue, please let us know that schedule.

cvubrugier

When [https://github.com/open-iscsi/target-isns/tree/fix-ipv6] will be merged to master branch. Could you please make a new tag? (Maybe V0.6.7)

Thank you for everything your support!

cvubrugier commented 4 years ago

Hi @gonzoleeman,

Please let me know if you try to use open-isns and it doesn't work.

I tried Open-iSNS with your latest fixes and it works great with IPv6. Thanks!

cvubrugier commented 4 years ago

Hi @yu-murai,

Thank you for providing the fixed code. I tried that and confirm it works as expected.

Thank you for your tests.

And I also realized --isns-server parameter does not include '[' and ']' around IPv6 addresses. [...] If you are going to fix this small issue, please let us know that schedule.

With Open-iSNS, you have to enclose an IPv6 address with square brackets because : is also used to delimit the address and port. Things are different in target-isns: you should not enclose an IPv6 address with square brackets. There is no need for that because the IP address and port number are provided via two separate options.

I agree that it is a bit disturbing but I prefer not to change that in target-isns because I may introduce bugs while doing so. So I have chosen to stop concatenating IP:port in the logs (b6c90f6) and to put a sample IPv6 address in the configuration file.

But I am opened to discussion. If anyone thinks that square brackets should be supported (or required), please speak up :)

Could you please make a new tag?

Sure. I plan to make a new release next week.

cvubrugier commented 4 years ago

Fixed in master and in tag v0.6.7.

yu-murai commented 4 years ago

@cvubrugier

Thank you for your quick release and make a new tag!