[ovs-dev] [PATCH v1] Ipfix: Skip BFD control packet

Wenyu Zhang wenyuz at vmware.com
Wed Nov 25 10:32:46 UTC 2015


This patch is to skip BFD control packets in ipfix.
BFD control packet should be tunnel packet with 0 tunnel id,
and the inner packet is UDP packet with destination port 3784.

Signed-off-by: Wenyu Zhang <wenyuz at vmware.com>
---
 ofproto/ofproto-dpif-ipfix.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 9ad8fa2..fc9676d 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -43,6 +43,9 @@ 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
+
 /* 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
@@ -1711,6 +1714,15 @@ dpif_ipfix_bridge_sample(struct dpif_ipfix *di, const struct dp_packet *packet,
             tunnel_port = dpif_ipfix_find_port(di, output_odp_port);
         }
     }
+
+    /* Skip BFD control packets */
+    if (tunnel_key && tunnel_key->tun_id == 0 &&
+        flow->nw_proto == IPPROTO_UDP &&
+        flow->tp_dst == BFD_CONTROL_DEST_PORT) {
+        ovs_mutex_unlock(&mutex);
+        return; 
+    }
+
     dpif_ipfix_sample(&di->bridge_exporter.exporter, packet, flow,
                       packet_delta_count,
                       di->bridge_exporter.options->obs_domain_id,
-- 
1.7.9.5




More information about the dev mailing list