mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-12 00:03:24 +02:00
python3: Use {encode, decode}('ascii') for text packet data
Some packet data are ascii type. Use {encode,decode} to make
python3's struct.pack happy.
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
ed5b3edd27
commit
57f9f8f27d
@ -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):
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user