* 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 <[email protected]> --- ryu/ofproto/ofproto_v1_2_parser.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index 1f437d5..00eb0cf 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -1558,17 +1558,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): @@ -1602,10 +1602,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) @@ -1825,7 +1825,7 @@ class OFPMatch(object): def set_ipv6_dst_masked(self, dst, mask): self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_DST) - self.wc.ipv6_dst_mask = mask + self.set_ipv6_flabel_masked(flabel, UINT32_MAX) self.flow.ipv6_dst = [x & y for (x, y) in itertools.izip(dst, mask)] def set_ipv6_flabel(self, flabel): -- 1.7.10.2.484.gcd07cc5 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
