From patchwork Mon Jul 9 15:02:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 941342 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PT8v4zwjz9rvt for ; Tue, 10 Jul 2018 01:02:54 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 058FBD10; Mon, 9 Jul 2018 15:02:52 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8B605D0E for ; Mon, 9 Jul 2018 15:02:50 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EB90D6B7 for ; Mon, 9 Jul 2018 15:02:49 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id p1-v6so11345141wrs.9 for ; Mon, 09 Jul 2018 08:02:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=bIoA1cOJH8fyhT3HKQ2PFSP2sxJJJ55xxPsLhtSBhxM=; b=CAuZ0UsxDAbMd2uuYN4TXUtiZnRD/c/3BUxuDyuW5bhPHn5ni+fDSe2J1JMXZF4W3k 4nveCBdoRxdBTJ30fYZxrOVWVbWihb/3ydF5/Uvvcd3Xc3K9+vNGOstiWr2fkHH5x4vR 3ArRA/Yk+7OSSDMkEZEYhTtEV/Tl6uccngcGkuAWVMJLlVEpWYbNZiuBOLNXwxHkICMM AjJ8kjPtt0aqGHVXrLiZB2Lfzla7x8uXmgnIssv/DkMHJJeg1NDrlvwMeJvvvFOnk4W7 14ZDZDUO/kDe//GvPf3ITC4V6HRpcSwN/RxfEfgQYerNEHw6y1qQno7e6+Au5uh55BcG nlXg== X-Gm-Message-State: APt69E0WNmWtoZygmjymHN3UJ6NzQjON94J/MGqBGm7Zv4bBmnAQt2KN JtNKhUfivrZCAtJZSnH9GnpwbCxtFVo= X-Google-Smtp-Source: AAOMgpdsMLTMq2KbPkoXhKcaBZcSOLOfLPNk4lkruhpd3iiqVHxG+5Jxd34qzfHOjIKoVwnEwz6SUQ== X-Received: by 2002:adf:b2f4:: with SMTP id g107-v6mr15841195wrd.53.1531148568293; Mon, 09 Jul 2018 08:02:48 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id u135-v6sm2519227wmf.2.2018.07.09.08.02.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jul 2018 08:02:47 -0700 (PDT) From: Lorenzo Bianconi To: dev@openvswitch.org Date: Mon, 9 Jul 2018 17:02:34 +0200 Message-Id: <9dff500f12e3d6c6068241f342a57e705af31e60.1531148310.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] OVN: add unit test for TCPv6 port unreachable support X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Add unit test for the TCP reset segment sent by OVN logical router when it receives an IPv6 TCP segment directed to the router's IP address since the logical router doesn't accept any TCP traffic Signed-off-by: Lorenzo Bianconi --- tests/ovn.at | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/ovn.at b/tests/ovn.at index 0185317e2..d1a8967dd 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -10454,6 +10454,26 @@ test_tcp_syn_packet() { as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet } +# test_tcp6_packet INPORT HV ETH_SRC ETH_DST IPV6_SRC IPV6_ROUTER TCP_SPORT TCP_DPORT TCP_CHKSUM EXP_TCP_RST_CHKSUM +# +# Causes a packet to be received on INPORT of the hypervisor HV. The packet is a TCP syn segment with +# ETH_SRC, ETH_DST, IPV6_SRC, IPV6_ROUTER, TCP_SPORT, TCP_DPORT and TCP_CHKSUM as specified. +# EXP_TCP_RST_CHKSUM is the tcp checksums of the tcp reset segment generated by OVN logical router +test_tcp6_packet() { + local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv6_src=$5 ipv6_router=$6 + local tcp_sport=$7 tcp_dport=$8 tcp_chksum=$9 + local exp_tcp_rst_chksum=${10} + shift 10 + + local ip6_hdr=60000000001406ff${ipv6_src}${ipv6_router} + local packet=${eth_dst}${eth_src}86dd${ip6_hdr}${tcp_sport}${tcp_dport}000000010000000050027210${tcp_chksum}0000 + + local reply=${eth_src}${eth_dst}86dd60000000001406fe${ipv6_router}${ipv6_src}${tcp_dport}${tcp_sport}000000000000000150040000${exp_tcp_rst_chksum}0000 + echo $reply >> vif$inport.expected + + as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet +} + # test_ip6_packet INPORT HV ETH_SRC ETH_DST IPV6_SRC IPV6_DST IPV6_PROTO IPV6_LEN DATA EXP_ICMP_CODE EXP_ICMP_CHKSUM # # Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv6 @@ -10516,6 +10536,7 @@ OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [vif1.expected]) test_tcp_syn_packet 2 2 000000000002 00000000ff02 $(ip_to_hex 192 168 2 1) $(ip_to_hex 192 168 2 254) 0000 8b40 3039 0000 7bae 4486 test_ip6_packet 2 2 000000000002 00000000ff02 20010db8000200000000000000000011 20010db8000200000000000000000001 84 0004 01020304 0103 627e +test_tcp6_packet 2 2 000000000002 00000000ff02 20010db8000200000000000000000011 20010db8000200000000000000000001 8b40 3039 0000 4486 OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [vif2.expected]) OVN_CLEANUP([hv1], [hv2])