Some packet data are ascii type. Use {encode,decode} to make
python3's struct.pack happy.
Signed-off-by: IWAMOTO Toshihiro <[email protected]>
---
ryu/lib/packet/dhcp.py | 5 +++--
ryu/topology/switches.py | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ryu/lib/packet/dhcp.py b/ryu/lib/packet/dhcp.py
index eed7a11..e82a645 100644
--- a/ryu/lib/packet/dhcp.py
+++ b/ryu/lib/packet/dhcp.py
@@ -192,7 +192,8 @@ class dhcp(packet_base.PacketBase):
addrconv.ipv4.bin_to_text(ciaddr),
addrconv.ipv4.bin_to_text(yiaddr),
addrconv.ipv4.bin_to_text(siaddr),
- addrconv.ipv4.bin_to_text(giaddr), sname, boot_file),
+ addrconv.ipv4.bin_to_text(giaddr),
+ sname.decode('ascii'), boot_file),
None, buf[length:])
@classmethod
@@ -213,7 +214,7 @@ class dhcp(packet_base.PacketBase):
addrconv.ipv4.text_to_bin(self.siaddr),
addrconv.ipv4.text_to_bin(self.giaddr),
addrconv.mac.text_to_bin(self.chaddr),
- self.sname, self.boot_file, seri_opt)
+ self.sname.encode('ascii'), self.boot_file,
seri_opt)
class options(stringify.StringifyMixin):
diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index cbb2659..ba956d1 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -374,8 +374,8 @@ class LLDPPacket(object):
tlv_chassis_id = lldp.ChassisID(
subtype=lldp.ChassisID.SUB_LOCALLY_ASSIGNED,
- chassis_id=LLDPPacket.CHASSIS_ID_FMT %
- dpid_to_str(dpid))
+ chassis_id=(LLDPPacket.CHASSIS_ID_FMT %
+ dpid_to_str(dpid)).encode('ascii'))
tlv_port_id = lldp.PortID(subtype=lldp.PortID.SUB_PORT_COMPONENT,
port_id=struct.pack(
--
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