FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 11-24-2009, 07:29 AM
Hans de Goede
 
Default Fix parsing of optional portnr in iscsi target IP (#525054)

This patch fixes 2 issues with the parsing of the optional portnr in
iscsi target IP's:
1) We don't want to include the : in the portno, so port = target[idx:]
should be port = target[idx+1:]
2) An IPV6 IP always includes the : character, so specifying the port
was mandatory with IPV6, this patch looks for "]:" inside the
string to determine if a port is present for IPV6 strings.
---
iw/autopart_type.py | 11 +++++++++--
textw/partition_text.py | 11 +++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/iw/autopart_type.py b/iw/autopart_type.py
index e8692eb..6ac1b2a 100644
--- a/iw/autopart_type.py
+++ b/iw/autopart_type.py
@@ -156,10 +156,17 @@ class PartitionTypeWindow(InstallWindow):

err = None
try:
- idx = target.rfind(":")
+ count = len(target.split(":"))
+ idx = target.rfind("]:")
+ # Check for IPV6 [IPV6-ip]ort
if idx != -1:
+ ip = target[1:idx]
+ port = target[idx+2:]
+ # Check for IPV4 aaa.bbb.ccc.dddort
+ elif count == 2:
+ idx = target.rfind(":")
ip = target[:idx]
- port = target[idx:]
+ port = target[idx+1:]
else:
ip = target
port = "3260"
diff --git a/textw/partition_text.py b/textw/partition_text.py
index 1fba143..5f2d1db 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -1721,10 +1721,17 @@ class PartitionTypeWindow:

target = entries[0].strip()
try:
- idx = target.rfind(":")
+ count = len(target.split(":"))
+ idx = target.rfind("]:")
+ # Check for IPV6 [IPV6-ip]ort
if idx != -1:
+ ip = target[1:idx]
+ port = target[idx+2:]
+ # Check for IPV4 aaa.bbb.ccc.dddort
+ elif count == 2:
+ idx = target.rfind(":")
ip = target[:idx]
- port = target[idx:]
+ port = target[idx+1:]
else:
ip = target
port = "3260"
--
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 11-24-2009, 07:55 AM
Ales Kozumplik
 
Default Fix parsing of optional portnr in iscsi target IP (#525054)

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]ort
if idx != -1:
+ ip = target[1:idx]
+ port = target[idx+2:]
+ # Check for IPV4 aaa.bbb.ccc.dddort
+ 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]" 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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 11-24-2009, 08:07 AM
Hans de Goede
 
Default Fix parsing of optional portnr in iscsi target IP (#525054)

Hi,

Thanks for the review.

On 11/24/2009 09:55 AM, Ales Kozumplik wrote:

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]ort
if idx != -1:
+ ip = target[1:idx]
+ port = target[idx+2:]
+ # Check for IPV4 aaa.bbb.ccc.dddort
+ 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]" 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?



This is deliberate, I don't think the parts of anaconda getting passed in
the address will like it if there are brackets around it.


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



That would have worked too, yes, but I'm not going to change this as
I would like to keep the code indentical between 5.5 and 6 / master.

Regards,

Hans

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

Thread Tools




All times are GMT. The time now is 03:07 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org