of1.3: fix error in port_mod and get_config_reply logic

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
张东亚 2013-02-20 15:03:22 +00:00 committed by FUJITA Tomonori
parent 61158c6cf8
commit a3cc10b8ec
2 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ OFPT_METER_MOD = 29 # Controller/switch message
OFP_MAX_PORT_NAME_LEN = 16
OFP_ETH_ALEN = 6
OFP_ETH_ALEN_STR = str(OFP_ETH_ALEN)
_OFP_PORT_PACK_STR = 'I4x' + OFP_ETH_ALEN_STR + 'B' + '2x' + \
_OFP_PORT_PACK_STR = 'I4x' + OFP_ETH_ALEN_STR + 's' + '2x' + \
str(OFP_MAX_PORT_NAME_LEN) + 's' + 'IIIIIIII'
OFP_PORT_PACK_STR = '!' + _OFP_PORT_PACK_STR
OFP_PORT_SIZE = 64
@ -428,7 +428,7 @@ OFP_BUCKET_SIZE = 16
assert calcsize(OFP_BUCKET_PACK_STR) == OFP_BUCKET_SIZE
# struct ofp_port_mod
OFP_PORT_MOD_PACK_STR = '!I4x' + OFP_ETH_ALEN_STR + 'B2xIII4x'
OFP_PORT_MOD_PACK_STR = '!I4x' + OFP_ETH_ALEN_STR + 's2xIII4x'
OFP_PORT_MOD_SIZE = 40
assert (calcsize(OFP_PORT_MOD_PACK_STR) + OFP_HEADER_SIZE ==
OFP_PORT_MOD_SIZE)

View File

@ -246,7 +246,7 @@ class OFPGetConfigReply(MsgBase):
msg = super(OFPGetConfigReply, cls).parser(datapath, version, msg_type,
msg_len, xid, buf)
msg.flags, msg.miss_send_len = struct.unpack_from(
ofproto_v1_3.OFP_SWITCH_CONFIG_PACK_STR, buf,
ofproto_v1_3.OFP_SWITCH_CONFIG_PACK_STR, msg.buf,
ofproto_v1_3.OFP_HEADER_SIZE)
return msg