From patchwork Wed Nov 25 10:32:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyu Zhang X-Patchwork-Id: 548475 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 54CC61402D9 for ; Wed, 25 Nov 2015 21:35:38 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id CBB5A109D6; Wed, 25 Nov 2015 02:35:37 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 4AA9A108FD for ; Wed, 25 Nov 2015 02:35:36 -0800 (PST) Received: from bar4.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id CD7D11613BD for ; Wed, 25 Nov 2015 03:35:35 -0700 (MST) X-ASG-Debug-ID: 1448447735-03dc21603ef5880001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar4.cudamail.com with ESMTP id DgaKt2H5i3EaqVEb (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 25 Nov 2015 03:35:35 -0700 (MST) X-Barracuda-Envelope-From: wenyuz@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO smtp-outbound-1.vmware.com) (208.91.2.12) by mx3-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 25 Nov 2015 10:35:35 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at _spf.vmware.com designates 208.91.2.12 as permitted sender) X-Barracuda-Apparent-Source-IP: 208.91.2.12 X-Barracuda-RBL-IP: 208.91.2.12 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id DD4642935E; Wed, 25 Nov 2015 02:35:32 -0800 (PST) Received: from EX13-CAS-004.vmware.com (ex13-cas-004.vmware.com [10.113.191.54]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 33CC418525; Wed, 25 Nov 2015 02:35:33 -0800 (PST) Received: from cloud-ubuntu-dev.nicira.eng.vmware.com (10.113.160.246) by EX13-MBX-022.vmware.com (10.113.191.42) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Wed, 25 Nov 2015 02:35:32 -0800 X-CudaMail-Envelope-Sender: wenyuz@vmware.com From: Wenyu Zhang To: , , , , X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-1124003961 X-CudaMail-DTE: 112515 X-CudaMail-Originating-IP: 208.91.2.12 Date: Wed, 25 Nov 2015 02:32:46 -0800 X-ASG-Orig-Subj: [##CM-V1-1124003961##][PATCH v1] Ipfix: Skip BFD control packet Message-ID: <1448447566-14435-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.160.246] 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.14.2] X-Barracuda-Start-Time: 1448447735 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 v1] Ipfix: Skip BFD control packet 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" 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 --- 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,