mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 13:56:09 +02:00
of10: remove trailing NULs in OFPPhyPort.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
4af07ca975
commit
aa6f056a26
@ -86,6 +86,10 @@ class OFPPhyPort(ofproto_parser.namedtuple('OFPPhyPort', (
|
||||
_TYPE = {
|
||||
'ascii': [
|
||||
'hw_addr',
|
||||
|
||||
# XXX OF spec is unclear about the encoding of name.
|
||||
# OVS seems to use UTF-8.
|
||||
# 'name',
|
||||
]
|
||||
}
|
||||
|
||||
@ -93,9 +97,11 @@ class OFPPhyPort(ofproto_parser.namedtuple('OFPPhyPort', (
|
||||
def parser(cls, buf, offset):
|
||||
port = struct.unpack_from(ofproto_v1_0.OFP_PHY_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')
|
||||
return cls(*port)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user