[pydhcplib-bugs] DhcpPacket.str is not read-only and doesn't properly handle parameter_request_list |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/pydhcplib-bugs Archives
]
Hi Mathieu,
I found a minor bug in DhcpPacket.str() and created a patch to fix it,
please see below. (In case the patch gets wrapped or something, please
try the embedded X-Git-Url.)
Cheers
Fabian
From: Fabian Knittel <fabian.knittel@xxxxxxxxx>
Date: Sat, 27 Mar 2010 14:02:29 +0000 (+0100)
Subject: pydhcplib/dhcp_packet.py: fix str() output for
parameter_request_list
X-Git-Url:
http://opensource.fsmi.uni-karlsruhe.de/cgi-bin/gitweb.cgi?p=pydhcplib.git;a=commitdiff_plain;h=71d6cb65ba1f093d2bf85be5e151e4a1304dd373;hp=e27f2c3c44c7d750e0291dd050358521d9845bd1
pydhcplib/dhcp_packet.py: fix str() output for parameter_request_list
The DhcpPacket.str() failed to be a read-only operation for
parameter_request_list. In addition, the transformation wasn't correctly
performed. This patch fixes the transformation and makes the operation
read-only.
---
diff --git a/pydhcplib/dhcp_packet.py b/pydhcplib/dhcp_packet.py
index a690f55..5809860 100644
--- a/pydhcplib/dhcp_packet.py
+++ b/pydhcplib/dhcp_packet.py
@@ -82,8 +82,7 @@ class DhcpPacket(DhcpBasicPacket):
result += ipv4(data[i:i+4]).str() + " - "
elif DhcpOptionsTypes[optnum] == "char+" :
if optnum == 55 : # parameter_request_list
- for each in range(len(data)) : data[each] =
DhcpOptionsList[each]
- result = ','.join(data)
+ result = ','.join([DhcpOptionsList[each] for each
in data])
else : result += str(data)
printable_data += opt + " : " + result + "\n"