From patchwork Fri Jul 28 11:59:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 127671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp471128vqg; Fri, 28 Jul 2023 07:23:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlG432r5PH5LWCDCMT4kDmTCP2TbEzPl/prRuO6oQnYreAQMm9xppK6QE0Fytuij/7CViIxw X-Received: by 2002:a05:6512:1147:b0:4fe:1dc8:7ec with SMTP id m7-20020a056512114700b004fe1dc807ecmr1648547lfg.37.1690554196465; Fri, 28 Jul 2023 07:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690554196; cv=none; d=google.com; s=arc-20160816; b=wmiKzv6YOAIK1T5AsK5IRp4iSfPSapnuXaMeXY9tbhN9getDJIn+ByX8WoW9k2tiZO NhfghIIwVG/zmECPLMMgE+y3VHh1P1ggFihi/z+kWuH5GMcjUzIajtEvYOUk6YYiw73Z f122EGNA+hCd4vIMK5CUSvKsa8h2G+xzJH2RdQGwCY1i6FwqpI5fb2KI5UaGmPtd7pV6 jHOSEccjCbDKxzWVs0F7w+V5gtvKEi10rhWkmj1ZbG2EVI4QVnPBOP5Bxd+0kaMJajjV 8R8z4X1cZnB+7BR87FVNb/FafjMcjAwf/afPhJtxH3eIFPapiMWm+rOpzlDAsKDvs/We 83RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0BHreDBBtOfD6Otem1ixa3wNDy4p83cGEAjphqlcKI0=; fh=La6qilCb+hhN8ZobPG5+gd37udDxEfhBrObJVo0O05w=; b=fMGPzcbQabAEHDkHRnnq+13rFPrZ1Fnmc91MNOtjs/h0R59ENoxBAG7dPc4agd79bY zrVwQVG30B8ncWfIAGTDP82IudcAD74x32HsjhBpTVWLfQEfF9Pxzlai5Lmtcq4aduiK dMrk3gjrHSiYdYgEQoTsH0KViIcYbc7Z//7kWid1Vr6P3/qfCBDwcDMIr7oraB4knsxS nXuvoRyMzv2L3tg1xOT/Ducje9wtLsKq8aKOc+D3uougemcrwin/F8Ut3uIHrvXj2Akn lz7Kk91TjPPZRhgcZgU81JYopByDO1GYZyrc29GH6839f/zMZc67tOzYPhw0xYXnJlIg kwUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a1q8470K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay21-20020a170906d29500b00991b7749bd5si2855523ejb.779.2023.07.28.07.22.46; Fri, 28 Jul 2023 07:23:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a1q8470K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236430AbjG1MBu (ORCPT + 99 others); Fri, 28 Jul 2023 08:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236423AbjG1MBU (ORCPT ); Fri, 28 Jul 2023 08:01:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A35D3C35 for ; Fri, 28 Jul 2023 04:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690545589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0BHreDBBtOfD6Otem1ixa3wNDy4p83cGEAjphqlcKI0=; b=a1q8470KzhcVGnTh3IY1oQQbzJlj+30L7Ba7aRlAFes2lRbU/cnIpOT6mhTbHuIYUGDxS1 +2D+mt8JwcASRrdTwKfLB6esMZ+CC+RY9WYIBfPXy37aiPCH+VvpwiD906Ekk3JNk5pc3B IcrBdsXYw2MnAdhKG6Use37xEGdJlQI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-BPOEd2YqN5a_k3MVFewArA-1; Fri, 28 Jul 2023 07:59:43 -0400 X-MC-Unique: BPOEd2YqN5a_k3MVFewArA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22C8286F121; Fri, 28 Jul 2023 11:59:43 +0000 (UTC) Received: from RHTPC1VM0NT.redhat.com (unknown [10.22.8.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8E24201EC58; Fri, 28 Jul 2023 11:59:42 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: dev@openvswitch.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Pravin B Shelar , Ilya Maximets Subject: [PATCH v2 net-next 3/5] selftests: openvswitch: add a test for ipv4 forwarding Date: Fri, 28 Jul 2023 07:59:38 -0400 Message-Id: <20230728115940.578658-4-aconole@redhat.com> In-Reply-To: <20230728115940.578658-1-aconole@redhat.com> References: <20230728115940.578658-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772674556981277246 X-GMAIL-MSGID: 1772674556981277246 This is a simple ipv4 bidirectional connectivity test. Signed-off-by: Aaron Conole Reviewed-by: Adrian Moreno --- .../selftests/net/openvswitch/openvswitch.sh | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index 5cdacb3c8c92..5d60a9466dab 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -12,6 +12,7 @@ TRACING=0 tests=" arp_ping eth-arp: Basic arp ping between two NS + connect_v4 ip4-xon: Basic ipv4 ping between two NS netlink_checks ovsnl: validate netlink attrs and settings upcall_interfaces ovs: test the upcall interfaces" @@ -192,6 +193,45 @@ test_arp_ping () { return 0 } +# connect_v4 test +# - client has 1500 byte MTU +# - server has 1500 byte MTU +# - use ICMP to ping in each direction +test_connect_v4 () { + + sbx_add "test_connect_v4" || return $? + + ovs_add_dp "test_connect_v4" cv4 || return 1 + + info "create namespaces" + for ns in client server; do + ovs_add_netns_and_veths "test_connect_v4" "cv4" "$ns" \ + "${ns:0:1}0" "${ns:0:1}1" || return 1 + done + + + ip netns exec client ip addr add 172.31.110.10/24 dev c1 + ip netns exec client ip link set c1 up + ip netns exec server ip addr add 172.31.110.20/24 dev s1 + ip netns exec server ip link set s1 up + + # Add forwarding for ARP and ip packets - completely wildcarded + ovs_add_flow "test_connect_v4" cv4 \ + 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 + ovs_add_flow "test_connect_v4" cv4 \ + 'in_port(2),eth(),eth_type(0x0806),arp()' '1' || return 1 + ovs_add_flow "test_connect_v4" cv4 \ + 'in_port(1),eth(),eth_type(0x0800),ipv4(src=172.31.110.10)' '2' || return 1 + ovs_add_flow "test_connect_v4" cv4 \ + 'in_port(2),eth(),eth_type(0x0800),ipv4(src=172.31.110.20)' '1' || return 1 + + # do a ping + ovs_sbx "test_connect_v4" ip netns exec client ping 172.31.110.20 -c 3 || return 1 + + info "done..." + return 0 +} + # netlink_validation # - Create a dp # - check no warning with "old version" simulation