Signed-off-by: FUJITA Tomonori <[email protected]>
---
ryu/lib/packet/packet.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py
index d6aeed7..bfeed0d 100644
--- a/ryu/lib/packet/packet.py
+++ b/ryu/lib/packet/packet.py
@@ -14,6 +14,7 @@
# limitations under the License.
import inspect
+import struct
from . import packet_base
from . import ethernet
@@ -47,11 +48,13 @@ class Packet(object):
def _parser(self, cls):
while cls:
- proto, cls = cls.parser(self.data[self.parsed_bytes:])
- if proto:
- self.parsed_bytes += proto.length
- self.protocols.append(proto)
-
+ try:
+ proto, cls = cls.parser(self.data[self.parsed_bytes:])
+ if proto:
+ self.parsed_bytes += proto.length
+ self.protocols.append(proto)
+ except struct.error:
+ cls = None
if len(self.data) > self.parsed_bytes:
self.protocols.append(self.data[self.parsed_bytes:])
--
1.7.12.4 (Apple Git-37)
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel