summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-ipfix.c
diff options
context:
space:
mode:
authorWenyu Zhang <wenyuz@vmware.com>2015-12-01 18:43:49 -0800
committerBen Pfaff <blp@ovn.org>2015-12-03 08:31:19 -0800
commit47946ac584a28838b6f38646f8ad2762a73dbb65 (patch)
tree6de795a3d51a54fcaf854b617ea115661499baa9 /ofproto/ofproto-dpif-ipfix.c
parent873d85653d84289eb3a7fd253d95ebcbdad920f0 (diff)
downloadopenvswitch-47946ac584a28838b6f38646f8ad2762a73dbb65.tar.gz
ipfix: Skip BFD packets.
The patch is to skip BFD packets in ipfix. Bidirectional Forwarding Detection (BFD) packets are for monitoring the tunnel link status and consumed by ovs itself, no need to sample them. Refer to IETF RFC 5881, BFD control packets are the UDP packets with destination port 3784 and BFD echo packets are the UDP packets with dst destination port 3785. Ipfix will skip both BFD control packets and BFD echo packets. Signed-off-by: Wenyu Zhang <wenyuz@vmware.com> [blp@ovn.org added check for IP] Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto/ofproto-dpif-ipfix.c')
-rw-r--r--ofproto/ofproto-dpif-ipfix.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 9ad8fa2ac..a610c5362 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2012, 2013, 2014, 2015 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,10 @@ static struct ovs_mutex mutex = OVS_MUTEX_INITIALIZER;
/* Cf. IETF RFC 5101 Section 10.3.4. */
#define IPFIX_DEFAULT_COLLECTOR_PORT 4739
+/* Cf. IETF RFC 5881 Setion 8. */
+#define BFD_CONTROL_DEST_PORT 3784
+#define BFD_ECHO_DEST_PORT 3785
+
/* The standard layer2SegmentId (ID 351) element is included in vDS to send
* the VxLAN tunnel's VNI. It is 64-bit long, the most significant byte is
* used to indicate the type of tunnel (0x01 = VxLAN, 0x02 = GRE) and the three
@@ -1696,6 +1700,23 @@ dpif_ipfix_bridge_sample(struct dpif_ipfix *di, const struct dp_packet *packet,
ovs_mutex_unlock(&mutex);
return;
}
+
+ /* Skip BFD packets:
+ * Bidirectional Forwarding Detection(BFD) packets are for monitoring
+ * the tunnel link status and consumed by ovs itself. No need to
+ * smaple them.
+ * CF IETF RFC 5881, BFD control packet is the UDP packet with
+ * destination port 3784, and BFD echo packet is the UDP packet with
+ * destination port 3785.
+ */
+ if (is_ip_any(flow) &&
+ flow->nw_proto == IPPROTO_UDP &&
+ (flow->tp_dst == htons(BFD_CONTROL_DEST_PORT) ||
+ flow->tp_dst == htons(BFD_ECHO_DEST_PORT))) {
+ ovs_mutex_unlock(&mutex);
+ return;
+ }
+
/* Use the sampling probability as an approximation of the number
* of matched packets. */
packet_delta_count = UINT32_MAX / di->bridge_exporter.probability;
@@ -1711,6 +1732,7 @@ dpif_ipfix_bridge_sample(struct dpif_ipfix *di, const struct dp_packet *packet,
tunnel_port = dpif_ipfix_find_port(di, output_odp_port);
}
}
+
dpif_ipfix_sample(&di->bridge_exporter.exporter, packet, flow,
packet_delta_count,
di->bridge_exporter.options->obs_domain_id,