before applying this patch:
  - parser() of OFPActionDecMplsTtl calls itself recursively.
  - parser() of OFPActionDecNwTtl, OFPActionCopyTtlOut, OFPActionCopyTtlIn and 
OFPActionPopVlan fail by shortage of arguments.

after applying this patch:
  - all parser() of OFPActions work nicely.


Signed-off-by: itoyuichi <[email protected]>
---
 ryu/ofproto/ofproto_v1_3_parser.py |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
b/ryu/ofproto/ofproto_v1_3_parser.py
index 6a6035d..b12865e 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -2702,6 +2702,12 @@ class OFPActionDecMplsTtl(OFPAction):
     def __init__(self, type_=None, len_=None):
         super(OFPActionDecMplsTtl, self).__init__()

+    @classmethod
+    def parser(cls, buf, offset):
+        (type_, len_) = struct.unpack_from(
+            ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
+        return cls()
+

 @OFPAction.register_action_type(ofproto_v1_3.OFPAT_SET_NW_TTL,
                                 ofproto_v1_3.OFP_ACTION_NW_TTL_SIZE)
@@ -2745,7 +2751,8 @@ class OFPActionDecNwTtl(OFPAction):

     @classmethod
     def parser(cls, buf, offset):
-        msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
+        (type_, len_) = struct.unpack_from(
+            ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
         return cls()


@@ -2763,7 +2770,8 @@ class OFPActionCopyTtlOut(OFPAction):

     @classmethod
     def parser(cls, buf, offset):
-        msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
+        (type_, len_) = struct.unpack_from(
+            ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
         return cls()


@@ -2781,7 +2789,8 @@ class OFPActionCopyTtlIn(OFPAction):

     @classmethod
     def parser(cls, buf, offset):
-        msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
+        (type_, len_) = struct.unpack_from(
+            ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
         return cls()


@@ -2856,7 +2865,8 @@ class OFPActionPopVlan(OFPAction):

     @classmethod
     def parser(cls, buf, offset):
-        msg_pack_into(ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
+        (type_, len_) = struct.unpack_from(
+            ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
         return cls()


-- 
1.7.10.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to