when oxm length is not what we expect, explicitly raise an exception
with descriptive message like the following.

    Exception: Unexpected OXM payload length 3 for ipv6_flabel (expected 4)

This often happens if you are using LINC and IPv6.
https://github.com/FlowForwarding/of_protocol/pull/57

Signed-off-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>
---
 ryu/ofproto/oxm_fields.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ryu/ofproto/oxm_fields.py b/ryu/ofproto/oxm_fields.py
index 1f83a70..e89d1eb 100644
--- a/ryu/ofproto/oxm_fields.py
+++ b/ryu/ofproto/oxm_fields.py
@@ -188,6 +188,10 @@ def to_user(num_to_field, n, v, m):
         t = UnknownType
         name = 'field_%d' % n
     if not v is None:
+        if hasattr(t, 'size') and t.size != len(v):
+            raise Exception(
+                'Unexpected OXM payload length %d for %s (expected %d)'
+                % (len(v), name, t.size))
         value = t.to_user(v)
     else:
         value = None
-- 
1.8.3.1


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to