This patch partially reverts 75e8c58916524243e6796e73c371981e14fff6ee
and 536a42d8c1c0be48e78d5f29b6fd55a38012d953.  dhcp.boot_file is ascii.

Signed-off-by: Shinpei Muraoka <[email protected]>
---
 ryu/lib/packet/dhcp.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ryu/lib/packet/dhcp.py b/ryu/lib/packet/dhcp.py
index 327c892..4917a53 100644
--- a/ryu/lib/packet/dhcp.py
+++ b/ryu/lib/packet/dhcp.py
@@ -141,14 +141,15 @@ class dhcp(packet_base.PacketBase):
     _class_prefixes = ['options']
     _TYPE = {
         'ascii': [
-            'ciaddr', 'yiaddr', 'siaddr', 'giaddr', 'chaddr', 'sname'
+            'ciaddr', 'yiaddr', 'siaddr', 'giaddr', 'chaddr',
+            'sname', 'boot_file'
         ]
     }
 
     def __init__(self, op, chaddr, options=None, 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='', boot_file=b''):
+                 giaddr='0.0.0.0', sname='', boot_file=''):
         super(dhcp, self).__init__()
         self.op = op
         self.htype = htype
@@ -189,7 +190,7 @@ class dhcp(packet_base.PacketBase):
                     addrconv.ipv4.bin_to_text(yiaddr),
                     addrconv.ipv4.bin_to_text(siaddr),
                     addrconv.ipv4.bin_to_text(giaddr),
-                    sname.decode('ascii'), boot_file),
+                    sname.decode('ascii'), boot_file.decode('ascii')),
                 None, buf[length:])
 
     def serialize(self, _payload=None, _prev=None):
@@ -209,7 +210,7 @@ class dhcp(packet_base.PacketBase):
                            addrconv.ipv4.text_to_bin(self.giaddr),
                            chaddr,
                            self.sname.encode('ascii'),
-                           self.boot_file) + opt_buf
+                           self.boot_file.encode('ascii')) + opt_buf
 
 
 class options(stringify.StringifyMixin):
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to