This patch prevent rest_firewall.py from adding unrelated fields
(e.g. priority, actions) into match fields.

Signed-off-by: IWASE Yusuke <[email protected]>
---
 ryu/app/rest_firewall.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/ryu/app/rest_firewall.py b/ryu/app/rest_firewall.py
index 4e52b1f..b60e62d 100644
--- a/ryu/app/rest_firewall.py
+++ b/ryu/app/rest_firewall.py
@@ -897,6 +897,19 @@ class Match(object):
                  REST_NW_PROTO_ICMP: inet.IPPROTO_ICMP,
                  REST_NW_PROTO_ICMPV6: inet.IPPROTO_ICMPV6}}
 
+    _MATCHES = [REST_IN_PORT,
+                REST_SRC_MAC,
+                REST_DST_MAC,
+                REST_DL_TYPE,
+                REST_DL_VLAN,
+                REST_SRC_IP,
+                REST_DST_IP,
+                REST_SRC_IPV6,
+                REST_DST_IPV6,
+                REST_NW_PROTO,
+                REST_TP_SRC,
+                REST_TP_DST]
+
     @staticmethod
     def to_openflow(rest):
 
@@ -1002,7 +1015,7 @@ class Match(object):
                     match.setdefault(key, Match._CONVERT[key][value])
                 else:
                     raise ValueError('Invalid rule parameter. : key=%s' % key)
-            else:
+            elif key in Match._MATCHES:
                 match.setdefault(key, value)
 
         return match
-- 
1.9.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to