mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 22:06:10 +02:00
of13: remove trailing NULs in OFPPort.name
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
78147bba1b
commit
90581d0ae0
@ -1749,15 +1749,21 @@ class OFPPort(ofproto_parser.namedtuple('OFPPort', (
|
||||
_TYPE = {
|
||||
'ascii': [
|
||||
'hw_addr',
|
||||
|
||||
# XXX OF spec is unclear about the encoding of name.
|
||||
# OVS seems to use UTF-8.
|
||||
# 'name',
|
||||
]
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def parser(cls, buf, offset):
|
||||
port = struct.unpack_from(ofproto_v1_3.OFP_PORT_PACK_STR, buf, offset)
|
||||
i = cls._fields.index('hw_addr')
|
||||
port = list(port)
|
||||
i = cls._fields.index('hw_addr')
|
||||
port[i] = addrconv.mac.bin_to_text(port[i])
|
||||
i = cls._fields.index('name')
|
||||
port[i] = port[i].rstrip('\0')
|
||||
ofpport = cls(*port)
|
||||
ofpport._length = ofproto_v1_3.OFP_PORT_SIZE
|
||||
return ofpport
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user