This patch partially reverts 75e8c58916524243e6796e73c371981e14fff6ee and 536a42d8c1c0be48e78d5f29b6fd55a38012d953. dhcp.sname is ascii.
Signed-off-by: IWAMOTO Toshihiro <[email protected]> --- ryu/lib/packet/dhcp.py | 2 +- ryu/tests/unit/packet/test_dhcp.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ryu/lib/packet/dhcp.py b/ryu/lib/packet/dhcp.py index bfc1f78..eed7a11 100644 --- a/ryu/lib/packet/dhcp.py +++ b/ryu/lib/packet/dhcp.py @@ -149,7 +149,7 @@ class dhcp(packet_base.PacketBase): def __init__(self, op, chaddr, options, htype=_HARDWARE_TYPE_ETHERNET, hlen=0, hops=0, xid=None, secs=0, flags=0, ciaddr='0.0.0.0', yiaddr='0.0.0.0', siaddr='0.0.0.0', - giaddr='0.0.0.0', sname=b'', boot_file=b''): + giaddr='0.0.0.0', sname='', boot_file=b''): super(dhcp, self).__init__() self.op = op self.htype = htype diff --git a/ryu/tests/unit/packet/test_dhcp.py b/ryu/tests/unit/packet/test_dhcp.py index 92116ee..1c24ef1 100644 --- a/ryu/tests/unit/packet/test_dhcp.py +++ b/ryu/tests/unit/packet/test_dhcp.py @@ -41,7 +41,7 @@ class Test_dhcp_offer(unittest.TestCase): yiaddr = '192.168.20.20' siaddr = '192.168.30.30' giaddr = '192.168.40.40' - sname = b'abc' + sname = 'abc' boot_file = b'' option_list = [ @@ -124,7 +124,7 @@ class Test_dhcp_offer(unittest.TestCase): eq_(self.giaddr, res.giaddr) eq_(self.chaddr, res.chaddr) # sname is 64 byte length. rest of data is filled by '\x00'. - eq_(self.sname.ljust(64, b'\x00'), res.sname) + eq_(self.sname.ljust(64, '\x00'), res.sname) # boof_file is 128 byte length. rest of data is filled by '\x00'. eq_(self.boot_file.ljust(128, b'\x00'), res.boot_file) eq_(str(self.options), str(res.options)) @@ -153,7 +153,7 @@ class Test_dhcp_offer(unittest.TestCase): eq_(self.giaddr, addrconv.ipv4.bin_to_text(res[10])) eq_(self.chaddr, addrconv.mac.bin_to_text(res[11][:6])) # sname is 64 byte length. rest of data is filled by '\x00'. - eq_(self.sname.ljust(64, b'\x00'), res[12]) + eq_(self.sname.ljust(64, '\x00'), res[12].decode('ascii')) # boof_file is 128 byte length. rest of data is filled by '\x00'. eq_(self.boot_file.ljust(128, b'\x00'), res[13]) options = dhcp.options.parser( -- 2.1.4 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
