mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-04 20:06:09 +02:00
ofproto: raise an exception for unsupported operation
explicitly desupport repeated serializations of an OFPMatch composed with old API, rather than silently producing corrupted packets. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
This commit is contained in:
parent
8c6c2e458a
commit
c737364230
@ -3454,6 +3454,11 @@ class OFPMatch(StringifyMixin):
|
||||
return length + pad_len
|
||||
|
||||
def serialize_old(self, buf, offset):
|
||||
if hasattr(self, '_serialized'):
|
||||
raise Exception('serializing an OFPMatch composed with '
|
||||
'old API multiple times is not supported')
|
||||
self._serialized = True
|
||||
|
||||
if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IN_PORT):
|
||||
self.append_field(ofproto_v1_2.OXM_OF_IN_PORT,
|
||||
self._flow.in_port)
|
||||
|
||||
@ -876,6 +876,11 @@ class OFPMatch(StringifyMixin):
|
||||
return length + pad_len
|
||||
|
||||
def serialize_old(self, buf, offset):
|
||||
if hasattr(self, '_serialized'):
|
||||
raise Exception('serializing an OFPMatch composed with '
|
||||
'old API multiple times is not supported')
|
||||
self._serialized = True
|
||||
|
||||
if self._wc.ft_test(ofproto_v1_3.OFPXMT_OFB_IN_PORT):
|
||||
self.append_field(ofproto_v1_3.OXM_OF_IN_PORT,
|
||||
self._flow.in_port)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user