diff options
author | Ben Pfaff <blp@ovn.org> | 2016-11-23 23:15:19 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-11-30 08:46:53 -0800 |
commit | 4930ea5620375c28bbdd1c85f8f48b9431c73abe (patch) | |
tree | d4f07e580ef2ab05d6030f8e7e4ed32d8c6f2aa5 /ofproto/ofproto-dpif-ipfix.c | |
parent | 65d8810c5521a18399b726f5e62ab35b8b063614 (diff) | |
download | openvswitch-4930ea5620375c28bbdd1c85f8f48b9431c73abe.tar.gz |
ofp-actions: Add "ingress" and "egress" options to "sample" action.
Before Open vSwitch 2.5.90, IPFIX reports from Open vSwitch didn't include
whether the packet was ingressing or egressing the switch. Starting in
OVS 2.5.90, this information was available but only accurate if the action
included a port number that indicated a tunnel. Conflating these two does
not always make sense (not every packet involves a tunnel!), so this patch
makes it possible for the sample action to simply say whether it's for
ingress or egress.
This is difficult to test, since the "tests" directory of OVS does not have
a proper IPFIX listener. This passes those tests, plus a couple that just
verify that the actions are properly parsed and formatted. Benli did test
it end-to-end in a VMware use case.
Requested-by: Benli Ye <daniely@vmware.com>
Tested-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Simon Horman <simon.horman@netronome.com>
Diffstat (limited to 'ofproto/ofproto-dpif-ipfix.c')
-rw-r--r-- | ofproto/ofproto-dpif-ipfix.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index 6b00b77d8..86a6646ac 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -1562,6 +1562,7 @@ ipfix_cache_entry_init(struct ipfix_flow_cache_entry *entry, const struct dp_packet *packet, const struct flow *flow, uint64_t packet_delta_count, uint32_t obs_domain_id, uint32_t obs_point_id, odp_port_t output_odp_port, + enum nx_action_sample_direction direction, const struct dpif_ipfix_port *tunnel_port, const struct flow_tnl *tunnel_key) { @@ -1648,7 +1649,9 @@ ipfix_cache_entry_init(struct ipfix_flow_cache_entry *entry, data_common = dp_packet_put_zeros(&msg, sizeof *data_common); data_common->observation_point_id = htonl(obs_point_id); data_common->flow_direction = - (output_odp_port == ODPP_NONE) ? INGRESS_FLOW : EGRESS_FLOW; + (direction == NX_ACTION_SAMPLE_INGRESS ? INGRESS_FLOW + : direction == NX_ACTION_SAMPLE_EGRESS ? EGRESS_FLOW + : output_odp_port == ODPP_NONE ? INGRESS_FLOW : EGRESS_FLOW); data_common->source_mac_address = flow->dl_src; data_common->destination_mac_address = flow->dl_dst; data_common->ethernet_type = flow->dl_type; @@ -1884,6 +1887,7 @@ dpif_ipfix_sample(struct dpif_ipfix_exporter *exporter, const struct dp_packet *packet, const struct flow *flow, uint64_t packet_delta_count, uint32_t obs_domain_id, uint32_t obs_point_id, odp_port_t output_odp_port, + enum nx_action_sample_direction direction, const struct dpif_ipfix_port *tunnel_port, const struct flow_tnl *tunnel_key) { @@ -1895,8 +1899,8 @@ dpif_ipfix_sample(struct dpif_ipfix_exporter *exporter, sampled_packet_type = ipfix_cache_entry_init(entry, packet, flow, packet_delta_count, obs_domain_id, obs_point_id, - output_odp_port, tunnel_port, - tunnel_key); + output_odp_port, direction, + tunnel_port, tunnel_key); ipfix_cache_update(exporter, entry, sampled_packet_type); } @@ -1959,7 +1963,8 @@ dpif_ipfix_bridge_sample(struct dpif_ipfix *di, const struct dp_packet *packet, packet_delta_count, di->bridge_exporter.options->obs_domain_id, di->bridge_exporter.options->obs_point_id, - output_odp_port, tunnel_port, tunnel_key); + output_odp_port, NX_ACTION_SAMPLE_DEFAULT, + tunnel_port, tunnel_key); ovs_mutex_unlock(&mutex); } @@ -2002,7 +2007,8 @@ dpif_ipfix_flow_sample(struct dpif_ipfix *di, const struct dp_packet *packet, packet_delta_count, cookie->flow_sample.obs_domain_id, cookie->flow_sample.obs_point_id, - output_odp_port, tunnel_port, tunnel_key); + output_odp_port, cookie->flow_sample.direction, + tunnel_port, tunnel_key); } ovs_mutex_unlock(&mutex); } |