diff --git a/ryu/lib/packet/dhcp.py b/ryu/lib/packet/dhcp.py index bfc1f78c..eed7a113 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 92116ee8..1c24ef1a 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(