Skip to content

Commit

Permalink
flow: Fix flow_wc_map() for ICMPv6/IGMP type and code.
Browse files Browse the repository at this point in the history
flow_wc_map() should include 'tp_src' and 'tp_dst' for ICMPv6 and IGMP
packets, since they're used for type and code.

This caused installed flows in the userspace datapath to always have
ICMPv6 code and type wildcarded (there are no other users of this
function).

Signed-off-by: Daniele Di Proietto <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
ddiproietto committed May 2, 2016
1 parent 7d7753e commit 8ecb306
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,13 +1405,13 @@ flow_wc_map(const struct flow *flow, struct flowmap *map)
FLOWMAP_SET(map, nw_frag);
FLOWMAP_SET(map, nw_tos);
FLOWMAP_SET(map, nw_ttl);
FLOWMAP_SET(map, tp_src);
FLOWMAP_SET(map, tp_dst);

if (OVS_UNLIKELY(flow->nw_proto == IPPROTO_IGMP)) {
FLOWMAP_SET(map, igmp_group_ip4);
} else {
FLOWMAP_SET(map, tcp_flags);
FLOWMAP_SET(map, tp_src);
FLOWMAP_SET(map, tp_dst);
}
} else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
FLOWMAP_SET(map, ipv6_src);
Expand All @@ -1421,15 +1421,15 @@ flow_wc_map(const struct flow *flow, struct flowmap *map)
FLOWMAP_SET(map, nw_frag);
FLOWMAP_SET(map, nw_tos);
FLOWMAP_SET(map, nw_ttl);
FLOWMAP_SET(map, tp_src);
FLOWMAP_SET(map, tp_dst);

if (OVS_UNLIKELY(flow->nw_proto == IPPROTO_ICMPV6)) {
FLOWMAP_SET(map, nd_target);
FLOWMAP_SET(map, arp_sha);
FLOWMAP_SET(map, arp_tha);
} else {
FLOWMAP_SET(map, tcp_flags);
FLOWMAP_SET(map, tp_src);
FLOWMAP_SET(map, tp_dst);
}
} else if (eth_type_mpls(flow->dl_type)) {
FLOWMAP_SET(map, mpls_lse);
Expand Down
30 changes: 30 additions & 0 deletions tests/ofproto-dpif.at
Original file line number Diff line number Diff line change
Expand Up @@ -7269,6 +7269,36 @@ icmp6,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src
OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([ofproto-dpif - ICMPv6 type match])
OVS_VSWITCHD_START
add_of_ports br0 1 2 3

AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])

AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])

AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])
AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])

AT_CHECK([ovs-appctl revalidator/purge], [0])

AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
recirc_id=0,icmp6,in_port=1,vlan_tci=0x0000,nw_frag=no,icmp_type=0x80/0xff, actions:2
recirc_id=0,icmp6,in_port=1,vlan_tci=0x0000,nw_frag=no,icmp_type=0x81/0xff, actions:3
])

AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
n_packets=2, n_bytes=124, icmp6,icmp_type=128 actions=output:2
n_packets=2, n_bytes=124, icmp6,icmp_type=129 actions=output:3
NXST_FLOW reply:
])

OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
OVS_VSWITCHD_START
add_of_ports br0 1
Expand Down

0 comments on commit 8ecb306

Please sign in to comment.