summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2012-07-17 14:59:23 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-07-17 16:21:12 +0900
commitf8b75c92a81e5c557a635bad6a7b6d03c8af485d (patch)
tree36b818d07ccb7616f0d224e45115ccafffb5bdd4
parentc46fdc6bf1327100567b91d5f4986aaa35950660 (diff)
of1.2: OFPMatch serialiser: fix ARP_SPA, ARP_TPA and IPV6_FLABEL masking
* In the case of ARP_SPA, ARP_TPA and IPV6_FLABEL a masked match should be used unless the mask is all ones. Previously a non-masked matched was used in the case were the mask was zero, leading to the value being unmasked, whereas in should be completely masked out. * An un-masked IPV6_FLABEL should internally use a mask of UINT32_MAX Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_2_parser.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py
index d584f7df..06a71e40 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -1587,17 +1587,17 @@ class OFPMatch(object):
self.append_field(ofproto_v1_2.OXM_OF_ARP_OP, self.flow.arp_op)
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_SPA):
- if self.wc.arp_spa_mask:
- header = ofproto_v1_2.OXM_OF_ARP_SPA_W
- else:
+ if self.wc.arp_spa_mask == UINT32_MAX:
header = ofproto_v1_2.OXM_OF_ARP_SPA
+ else:
+ header = ofproto_v1_2.OXM_OF_ARP_SPA_W
self.append_field(header, self.flow.arp_spa, self.wc.arp_spa_mask)
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_TPA):
- if self.wc.arp_tpa_mask:
- header = ofproto_v1_2.OXM_OF_ARP_TPA_W
- else:
+ if self.wc.arp_tpa_mask == UINT32_MAX:
header = ofproto_v1_2.OXM_OF_ARP_TPA
+ else:
+ header = ofproto_v1_2.OXM_OF_ARP_TPA_W
self.append_field(header, self.flow.arp_tpa, self.wc.arp_tpa_mask)
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_SHA):
@@ -1631,10 +1631,10 @@ class OFPMatch(object):
self.wc.ipv6_dst_mask)
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL):
- if self.wc.ipv6_flabel_mask:
- header = ofproto_v1_2.OXM_OF_IPV6_FLABEL_W
- else:
+ if self.wc.ipv6_flabel_mask == UINT32_MAX:
header = ofproto_v1_2.OXM_OF_IPV6_FLABEL
+ else:
+ header = ofproto_v1_2.OXM_OF_IPV6_FLABEL_W
self.append_field(header, self.flow.ipv6_flabel,
self.wc.ipv6_flabel_mask)
@@ -1858,8 +1858,7 @@ class OFPMatch(object):
self.flow.ipv6_dst = [x & y for (x, y) in itertools.izip(dst, mask)]
def set_ipv6_flabel(self, flabel):
- self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL)
- self.flow.ipv6_flabel = flabel
+ self.set_ipv6_flabel_masked(flabel, UINT32_MAX)
def set_ipv6_flabel_masked(self, flabel, mask):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL)