Avoid loop in OFPAction.parser()
OFPAction.parser() should call the parser of one of the classes registered in _ACTION_TYPES() rather than calling itself until a buffer underflow occurs. Also, it is not necessary to increment offset as the parser method of the registered classes re-parse the type and length and thus do not expect it to be incremented. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
4bd7c5026c
commit
bd73873882
@ -144,8 +144,9 @@ class OFPAction(OFPActionHeader):
|
|||||||
def parser(cls, buf, offset):
|
def parser(cls, buf, offset):
|
||||||
type_, len_ = struct.unpack_from(
|
type_, len_ = struct.unpack_from(
|
||||||
ofproto_v1_0.OFP_ACTION_HEADER_PACK_STR, buf, offset)
|
ofproto_v1_0.OFP_ACTION_HEADER_PACK_STR, buf, offset)
|
||||||
offset += ofproto_v1_0.OFP_ACTION_HEADER_SIZE
|
cls_ = cls._ACTION_TYPES.get(type_)
|
||||||
return cls.parser(buf, offset)
|
assert cls_ is not None
|
||||||
|
return cls_.parser(buf, offset)
|
||||||
|
|
||||||
|
|
||||||
@OFPAction.register_action_type(ofproto_v1_0.OFPAT_OUTPUT,
|
@OFPAction.register_action_type(ofproto_v1_0.OFPAT_OUTPUT,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user