From patchwork Wed Dec 2 02:43:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyu Zhang X-Patchwork-Id: 551138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 046E21402A6 for ; Wed, 2 Dec 2015 13:44:14 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 4EF72105A7; Tue, 1 Dec 2015 18:44:13 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id ED7BE1057D for ; Tue, 1 Dec 2015 18:44:12 -0800 (PST) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 283B11E0056 for ; Tue, 1 Dec 2015 19:44:12 -0700 (MST) X-ASG-Debug-ID: 1449024251-09eadd4a2f182480001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id eFrOPCzEVErhDVG1 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 01 Dec 2015 19:44:11 -0700 (MST) X-Barracuda-Envelope-From: wenyuz@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO smtp-outbound-2.vmware.com) (208.91.2.13) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 2 Dec 2015 02:44:11 -0000 Received-SPF: error (mx1-pf1.cudamail.com: error in processing during lookup of vmware.com: DNS problem) X-Barracuda-Apparent-Source-IP: 208.91.2.13 X-Barracuda-RBL-IP: 208.91.2.13 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id DECE728448; Tue, 1 Dec 2015 18:44:07 -0800 (PST) Received: from EX13-CAS-006.vmware.com (ex13-cas-006.vmware.com [10.113.191.56]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id DACFD1821E; Tue, 1 Dec 2015 18:44:07 -0800 (PST) Received: from cloud-ubuntu-dev.nicira.eng.vmware.com (10.113.170.11) by EX13-MBX-022.vmware.com (10.113.191.42) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Tue, 1 Dec 2015 18:44:07 -0800 X-CudaMail-Envelope-Sender: wenyuz@vmware.com From: Wenyu Zhang To: , , , , X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-1130117602 X-CudaMail-DTE: 120115 X-CudaMail-Originating-IP: 208.91.2.13 Date: Tue, 1 Dec 2015 18:43:49 -0800 X-ASG-Orig-Subj: [##CM-E1-1130117602##][PATCH v2] ipfix: Skip BFD packets. Message-ID: <1449024229-7271-1-git-send-email-wenyuz@vmware.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.113.170.11] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-022.vmware.com (10.113.191.42) X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1449024251 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-ASG-Whitelist: EmailCat (corporate) Subject: [ovs-dev] [PATCH v2] ipfix: Skip BFD packets. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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 --- ofproto/ofproto-dpif-ipfix.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index 9ad8fa2..7bf8097 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -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,22 @@ 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 (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 +1731,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,