Currently if a mask is supplied for an unmaskable match then NOT_REACHED()
is called. The effect of this for a user calling ovs-vsctl with a match
that includes a mask which is not permitted is to politely inform them of
the error of their ways by calling abort and segfaulting.
This patch takes an alternate approach to return no protocols which has the
has the effect when that ovs-vsctl is called with a match that includes a
mask which is not permitted an error message of the following form is
displayed.
ovs-ofctl: none of the usable flow formats (none) is among the allowed flow formats (OpenFlow10,NXM)
This patch also updates the ovs-ofctl test to test matches with masks
where possible.
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
case MFF_ICMPV4_CODE:
case MFF_ICMPV6_TYPE:
case MFF_ICMPV6_CODE:
case MFF_ICMPV4_CODE:
case MFF_ICMPV6_TYPE:
case MFF_ICMPV6_CODE:
case MFF_TUN_ID:
match_set_tun_id_masked(match, value->be64, mask->be64);
case MFF_TUN_ID:
match_set_tun_id_masked(match, value->be64, mask->be64);
# This doesn't cover some potential vlan_tci test cases.
for test_case in \
'tun_id=0 NXM,OXM' \
# This doesn't cover some potential vlan_tci test cases.
for test_case in \
'tun_id=0 NXM,OXM' \
+ 'tun_id=0/0x1 NXM,OXM' \
'tun_src=1.2.3.4 NXM,OXM' \
'tun_src=1.2.3.4 NXM,OXM' \
+ 'tun_src=1.2.3.4/0.0.0.1 NXM,OXM' \
'tun_dst=1.2.3.4 NXM,OXM' \
'tun_dst=1.2.3.4 NXM,OXM' \
+ 'tun_dst=1.2.3.4/0.0.0.1 NXM,OXM' \
'metadata=0 NXM,OXM,OpenFlow11' \
'metadata=0 NXM,OXM,OpenFlow11' \
+ 'metadata=1/1 NXM,OXM,OpenFlow11' \
'in_port=1 any' \
'skb_priority=0 none' \
'in_port=1 any' \
'skb_priority=0 none' \
+ 'skb_priority=1/1 none' \
+ 'pkt_mark=1/1 NXM,OXM' \
'dl_src=00:11:22:33:44:55 any' \
'dl_src=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OpenFlow11' \
'dl_dst=00:11:22:33:44:55 any' \
'dl_dst=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OpenFlow11' \
'dl_type=0x1234 any' \
'dl_src=00:11:22:33:44:55 any' \
'dl_src=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OpenFlow11' \
'dl_dst=00:11:22:33:44:55 any' \
'dl_dst=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OpenFlow11' \
'dl_type=0x1234 any' \
+ 'dl_type=0x1234/0x1 none' \
'dl_type=0x0800 any' \
'dl_type=0x0806 any' \
'dl_type=0x86dd any' \
'vlan_tci=0 any' \
'vlan_tci=0x1009 any' \
'dl_type=0x0800 any' \
'dl_type=0x0806 any' \
'dl_type=0x86dd any' \
'vlan_tci=0 any' \
'vlan_tci=0x1009 any' \
+ 'vlan_tci=0x1009/0x1 NXM,OXM' \
+ 'vlan_vid=11/0x1 NXM,OXM' \
+ 'dl_vlan_pcp=6/0x1 none' \
+ 'vlan_pcp=5/0x1 none' \
'mpls,mpls_label=5 NXM,OXM,OpenFlow11' \
'mpls,mpls_label=5 NXM,OXM,OpenFlow11' \
+ 'mpls,mpls_label=5/0x1 none' \
'mpls,mpls_tc=1 NXM,OXM,OpenFlow11' \
'mpls,mpls_tc=1 NXM,OXM,OpenFlow11' \
+ 'mpls,mpls_tc=1/0x1 none' \
'mpls,mpls_bos=0 NXM,OXM' \
'mpls,mpls_bos=0 NXM,OXM' \
+ 'mpls,mpls_bos=1/0x1 none' \
'ip,ip_src=1.2.3.4 any' \
'ip,ip_src=192.168.0.0/24 any' \
'ip,ip_src=192.0.168.0/255.0.255.0 NXM,OXM,OpenFlow11' \
'ip,ip_src=1.2.3.4 any' \
'ip,ip_src=192.168.0.0/24 any' \
'ip,ip_src=192.0.168.0/255.0.255.0 NXM,OXM,OpenFlow11' \
'ip,ip_dst=192.168.0.0/24 any' \
'ip,ip_dst=192.0.168.0/255.0.255.0 NXM,OXM,OpenFlow11' \
'ipv6,ipv6_src=::1 NXM,OXM' \
'ip,ip_dst=192.168.0.0/24 any' \
'ip,ip_dst=192.0.168.0/255.0.255.0 NXM,OXM,OpenFlow11' \
'ipv6,ipv6_src=::1 NXM,OXM' \
+ 'ipv6,ipv6_src=::1/::1 NXM,OXM' \
'ipv6,ipv6_dst=::1 NXM,OXM' \
'ipv6,ipv6_dst=::1 NXM,OXM' \
+ 'ipv6,ipv6_dst=::1/::1 NXM,OXM' \
'ipv6,ipv6_label=5 NXM,OXM' \
'ipv6,ipv6_label=5 NXM,OXM' \
+ 'ipv6,ipv6_label=5/1 NXM,OXM' \
+ 'ip,nw_proto=1/1 none' \
'ipv6,nw_proto=1 NXM,OXM' \
'ipv6,nw_proto=1 NXM,OXM' \
+ 'ipv6,nw_proto=1/1 none' \
+ 'ip,nw_tos=0xf0/0xf0 none' \
'ipv6,nw_tos=0xf0 NXM,OXM' \
'ipv6,nw_tos=0xf0 NXM,OXM' \
+ 'ipv6,nw_tos=0xf0/0xf0 none' \
'ip,nw_tos_shifted=0x3c any' \
'ip,nw_tos_shifted=0x3c any' \
+ 'ip,nw_tos_shifted=0x3c/0xf0 none' \
'ipv6,nw_tos_shifted=0x3c NXM,OXM' \
'ipv6,nw_tos_shifted=0x3c NXM,OXM' \
+ 'ipv6,nw_tos_shifted=0x3c/0xf0 none' \
'ipv6,nw_ecn=1 NXM,OXM' \
'ipv6,nw_ecn=1 NXM,OXM' \
+ 'ipv6,nw_ecn=1/1 none' \
'ipv6,nw_ttl=5 NXM,OXM' \
'ipv6,nw_ttl=5 NXM,OXM' \
+ 'ipv6,nw_ttl=5/1 none' \
'ip,ip_frag=no NXM,OXM' \
'ipv6,ip_frag=no NXM,OXM' \
'arp,arp_op=0 any' \
'ip,ip_frag=no NXM,OXM' \
'ipv6,ip_frag=no NXM,OXM' \
'arp,arp_op=0 any' \
+ 'arp,arp_op=0/1 none' \
'arp,arp_spa=1.2.3.4 any' \
'arp,arp_spa=1.2.3.4 any' \
+ 'arp,arp_spa=1.2.3.4/0.0.0.1 NXM,OXM,OpenFlow11' \
'arp,arp_tpa=1.2.3.4 any' \
'arp,arp_tpa=1.2.3.4 any' \
+ 'arp,arp_tpa=1.2.3.4/0.0.0.1 NXM,OXM,OpenFlow11' \
'arp,arp_sha=00:11:22:33:44:55 NXM,OXM' \
'arp,arp_sha=00:11:22:33:44:55 NXM,OXM' \
+ 'arp,arp_sha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM' \
'arp,arp_tha=00:11:22:33:44:55 NXM,OXM' \
'arp,arp_tha=00:11:22:33:44:55 NXM,OXM' \
+ 'arp,arp_tha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM' \
'tcp,tcp_src=80 any' \
'tcp,tcp_src=0x1000/0x1000 NXM,OXM' \
'tcp6,tcp_src=80 NXM,OXM' \
'tcp,tcp_src=80 any' \
'tcp,tcp_src=0x1000/0x1000 NXM,OXM' \
'tcp6,tcp_src=80 NXM,OXM' \
'udp6,udp_dst=80 NXM,OXM' \
'udp6,udp_dst=0x1000/0x1000 NXM,OXM' \
'icmp,icmp_type=1 any' \
'udp6,udp_dst=80 NXM,OXM' \
'udp6,udp_dst=0x1000/0x1000 NXM,OXM' \
'icmp,icmp_type=1 any' \
+ 'icmp,icmp_type=1/1 none' \
+ 'icmp,icmp_code=2/1 none' \
'icmp6,icmpv6_type=1 NXM,OXM' \
'icmp6,icmpv6_type=1 NXM,OXM' \
- 'icmp6,icmpv6_code=2 NXM,OXM'
+ 'icmp6,icmpv6_code=2 NXM,OXM' \
+ 'icmp6,icmpv6_code=2/1 none'