open-iscsi / open-isns

iSNS server and client for Linux
GNU Lesser General Public License v2.1
26 stars 22 forks source link

Failed to register iscsi target to open-isns-server #19

Closed wncboy closed 4 years ago

wncboy commented 6 years ago

I tested isns daemon, the daemon report an error message, and I found that it always can be reproduced if multiple Portal group address are included in the DevAttrReg.

I use target-isns to register the target to open-isns-server. Reproduce steps:

  1. Create a LUN.
  2. Create a Group.
  3. Assign the LUN to the Group.
  4. start the open-isns-server
  5. start the target-isns
  6. query the server with isnsadm --query.

Here are the logs. === isnsadm --query === root:@test~# isnsadm --query iscsi-name Warning: isns not in /etc/services, falling back to default 3205. (Object list empty)

=== target-isns === roo:@test~# /usr/local/bin/target-isns --isns-server 127.0.0.1 --debug 0.000000 I: target-isns version 0.6.4 started 0.000024 I: iSNS server is 127.0.0.1:3205 0.000194 D: iSNS connection opened (fd = 7) 0.000366 D: registering target (all) 0.000377 D: source attribute set to iqn.1994-11.com.test:test:4edb3b63:group1 0.000386 D: gen header DevAttrReg: len = 504, flags = 0x8c00, tx = 1, seq = 0 0.000396 D: sending last PDU seq 0, length 504 0.001236 D: got header DevAttrRegRsp: len = 4, flags = 0x4c00, tx = 1, seq = 0 0.001250 E: error in response (status = 3)

^C 30.982680 D: deregistering target (all) (last) 30.982697 D: gen header DevDereg: len = 92, flags = 0x8c00, tx = 2, seq = 0 31.982963 I: target-isns stopped

=== open-isns-server === root@test:~# /usr/sbin/isnsd --foreground --debug all Creating file DB backend (/var/lib/isns) DB: loading all objects from /var/lib/isns Enable ESI monitoring for entity 16 Warning: Unexpected object state 0 in object 0 loaded from /var/lib/isns Warning: Unexpected object state 0 in object 0 (iSCSI Storage Node) Warning: isns not in /etc/services, falling back to default 3205. Warning: SLP support disabled in this build Entity 16 will expire in 555 sec Updating ESI state for entity 16 ESI: dropping entity 16 Next ESI message in 3600 seconds poll(0x7ffe0cb73ff0, 2, 554999) poll(0x7ffe0cb73ff0, 3, 300000) Incoming PDU xid=0001 seq=0 len=504 func=DevAttrReg client first last Next message xid=0001 Received message --DevAttrReg-- Source: 0020 string : iSCSI name = "iqn.1994-11.com.test:test:4edb3b63:group1" Message attributes: 0001 string : Entity identifier = "localhost" Operating attributes: 0001 string : Entity identifier = "localhost" 0002 uint32 : Entity protocol = iSCSI (2) 0006 uint32 : Registration Period = 300 0010 ipaddr : Portal IP address = 10.1.113.25 0011 uint32 : Portal TCP/UDP port = 3260/tcp 0010 ipaddr : Portal IP address = 192.168.100.151 0011 uint32 : Portal TCP/UDP port = 3260/tcp 0010 ipaddr : Portal IP address = 192.168.100.152 0011 uint32 : Portal TCP/UDP port = 3260/tcp 0020 string : iSCSI name = "iqn.1994-11.com.test:test:4edb3b63:group1" 0021 uint32 : iSCSI node type = Target 0030 string : Portal group name = "iqn.1994-11.com.test:test:4edb3b63:group1" 0031 ipaddr : Portal group address = 10.1.113.25 0032 uint32 : Portal group port = 3260/tcp 0031 ipaddr : Portal group address = 192.168.100.151 0032 uint32 : Portal group port = 3260/tcp 0031 ipaddr : Portal group address = 192.168.100.152 0032 uint32 : Portal group port = 3260/tcp 0033 uint32 : Portal group tag = 1 :: policy insecure function DevAttrReg (0001) permitted :: policy insecure source iqn.1994-11.com.test:test:4edb3b63:group1 permitted :: policy insecure operation DevAttrReg on object 00000010 (Network Entity) permitted :: policy insecure operation DevAttrReg on object 00000010 (Network Entity) permitted :: policy insecure operation DevAttrReg on Portal object permitted :: policy insecure operation DevAttrReg on Portal object permitted :: policy insecure operation DevAttrReg on Portal object permitted :: policy insecure registration of node type 0x1 permitted :: policy insecure operation DevAttrReg on object 00000000 (iSCSI Storage Node) permitted invalid attr in message DB: Storing object 16 -> /var/lib/isns/00000010 DB: Storing object 0 -> /var/lib/isns/00000000 DB: Storing object 0 -> /var/lib/isns/00000000 DB: Storing object 0 -> /var/lib/isns/00000000 DB: Storing object 0 -> /var/lib/isns/00000000 Warning: DB: Refusing to store object with index 0 isns_esi_callback(0x55befe2b0580, 0x4) isns_esi_callback(0x55befe2b23b0, 0x4) isns_esi_callback(0x55befe2b2620, 0x4) isns_esi_callback(0x55befe2b2770, 0x4) isns_esi_callback(0x55befe2b07e0, 0x4) SCN multicast <iSCSI Storage Node 0, updated> response status 0x0003 (Invalid registration) Entity 16 will expire in 600 sec Next ESI message in 3600 seconds poll(0x7ffe0cb73ff0, 3, 299999) poll(0x7ffe0cb73ff0, 3, 299999) poll(0x7ffe0cb73ff0, 4, 283741) Incoming PDU xid=0001 seq=0 len=64 func=DevAttrQry client first last Next message xid=0001 Received message --DevAttrQry-- Source: 0020 string : iSCSI name = "iqn.1993-08.org.debian:01:c511364a3ff8" Message attributes: 0020 nil : iSCSI name = Operating attributes: :: policy insecure function DevAttrQry (0002) permitted :: policy insecure source iqn.1993-08.org.debian:01:c511364a3ff8 permitted :: policy insecure operation DevAttrQry on object type iSCSI Storage Node permitted isns_esi_callback(0x55befe2b2440, 0x4) SCN multicast <iSCSI Storage Node 0, updated> --DevAttrQryResp-- Source: 0020 string : iSCSI name = "iqn.1993-08.org.debian:01:c511364a3ff8" Message attributes: 0020 nil : iSCSI name = Operating attributes: response status 0x0000 (Success) Entity 16 will expire in 584 sec poll(0x7ffe0cb73ff0, 4, 283741) poll(0x7ffe0cb73ff0, 4, 283741) connection closed by peer, killing socket poll(0x7ffe0cb73ff0, 3, 283741) Incoming PDU xid=0002 seq=0 len=92 func=DevDereg client first last Next message xid=0002 Received message --DevDereg-- Source: 0020 string : iSCSI name = "iqn.1994-11.com.test:test:4edb3b63:group1" Message attributes: Operating attributes: 0001 string : Entity identifier = "localhost" :: policy insecure function DevDereg (0004) permitted :: policy insecure source iqn.1994-11.com.test:test:4edb3b63:group1 permitted :: policy insecure operation DevDereg on object 00000010 (Network Entity) permitted Unable to remove object from scope DB: removed object 0 (iSCSI Storage Node) Unable to remove object from scope DB: removed object 0 (Portal) Unable to remove object from scope DB: removed object 0 (Portal) Unable to remove object from scope DB: removed object 0 (Portal) DB: removed object 16 (Network Entity) DB: Storing object 16 -> /var/lib/isns/00000010 isns_esi_callback(0x55befe2b0580, 0x10) --DevDeregResp-- Source: 0020 string : iSCSI name = "iqn.1993-08.org.debian:01:c511364a3ff8" Message attributes: Operating attributes: response status 0x0000 (Success) Entity 16 will expire in 600 sec Next ESI message in 3600 seconds DB: destroying object 0 (iSCSI Storage Node) DB: Purging object 0 (/var/lib/isns/00000000) DB: destroying object 16 (Network Entity) DB: Purging object 16 (/var/lib/isns/00000010) DB: destroying object 0 (Portal) DB: Purging object 0 (/var/lib/isns/00000000) Warning: DB: Cannot remove /var/lib/isns/00000000: No such file or directory DB: destroying object 0 (Portal) DB: Purging object 0 (/var/lib/isns/00000000) Warning: DB: Cannot remove /var/lib/isns/00000000: No such file or directory DB: destroying object 0 (Portal) DB: Purging object 0 (/var/lib/isns/00000000) Warning: DB: Cannot remove /var/lib/isns/00000000: No such file or directory poll(0x7ffe0cb73ff0, 3, 299999) poll(0x7ffe0cb73ff0, 3, 299999) isns_net_stream_error: Connection reset by peer socket disconnect, killing socket poll(0x7ffe0cb73ff0, 2, 298999) ^CWarning: SLP support disabled in this build

I review the source code of open-isns, it should be failed by the attribute checking, the following are some of the code fragments in the attrs.c: line 684: int isns_attr_list_validate(const isns_attr_list_t list, const isns_policy_t policy, unsigned int function) { ...... if (attr->ia_value.iv_type == tag_type->it_type) { _if (!tag_type->it_multiple && test_bit(seen, bit)) { isns_debug_protocol("%s %d name: %s %d %d %d\n", FUNCTION, LINE, attr->ia_value.iv_type->it_name, tag_type->itmultiple, seen, bit); goto invalid; } if (!isns_attr_validate(attr, policy)) { isns_debug_protocol("%s %d\n", FUNCTION, LINE); goto invalid; }

I setup an iSNS server in windows 2008 server, and target-isns can register target to windows iSNS server, so the above issue should be an open-isns-server issue. Who can help me to fix this issue?

gonzoleeman commented 6 years ago

I will try to have a look at this.

gonzoleeman commented 6 years ago

What OS/Version are you on, and what versions of target-isns, open-isns, targetcli, and open-iscsi are you using?

wncboy commented 6 years ago

It also can be reproduced on the ubuntu 16.04, and I use targetcli to create the new target, it can be easily reproduced if multiple Portal group address are included in the DevAttrReg

gonzoleeman commented 6 years ago

Can you show how you've set up your target(s), so I can try to reproduce this myself? E.g. output of "targetcli ls /" should do it.

gonzoleeman commented 4 years ago

I'm going to close this, since it's been over a year since there was any activity. Please re-open if needed, or file a new issue.