Re: [PATCH rhel5] Fix parsing of optional portnr in iscsi target IP (#525054)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans,

On 11/24/2009 09:29 AM, Hans de Goede wrote:

              err = None
              try:
-                idx = target.rfind(":")
+                count = len(target.split(":"))
+                idx = target.rfind("]:")
+                # Check for IPV6 [IPV6-ip]:port
                  if idx != -1:
+                    ip = target[1:idx]
+                    port = target[idx+2:]
+                # Check for IPV4 aaa.bbb.ccc.ddd:port
+                elif count == 2:
+                    idx = target.rfind(":")
                      ip = target[:idx]
-                    port = target[idx:]
+                    port = target[idx+1:]
                  else:
                      ip = target
                      port = "3260"

Just a couple of questions:
1) suppose target is "[a::x]" or something similar, that is an IPv6 with no port number --- then I think the code will assign
ip = [a::x]
port = 3260
but if the target is "[a::x]:p" then the code will assign
ip = a::x
port = p
ie: there's no brackets around the address. Just a slight inconsistency, but maybe it doesn't matter?

2) maybe you want to use count = target.count(":") and then compare count against one?

Otherwise ACK.

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux