From patchwork Sun Apr 3 23:46:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valerio X-Patchwork-Id: 1612836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=g/PJieEe; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KWrCh4n4kz9sFq for ; Mon, 4 Apr 2022 09:46:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AFA3E408A5; Sun, 3 Apr 2022 23:46:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PDki-bnIUaH3; Sun, 3 Apr 2022 23:46:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id B9648404AA; Sun, 3 Apr 2022 23:46:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8A738C001D; Sun, 3 Apr 2022 23:46:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9B89BC0012 for ; Sun, 3 Apr 2022 23:46:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 74660405B0 for ; Sun, 3 Apr 2022 23:46:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aG0e3XoCl2YF for ; Sun, 3 Apr 2022 23:46:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 252DA404AA for ; Sun, 3 Apr 2022 23:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649029591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C8cVDGiZ+cSWxbIz+gqcOyAE9l2Z8U57LG7EfWN2Uu4=; b=g/PJieEe1/bPgE60p7GB7NEEgTwgsTAEZFYuEKs/i3+gtD6jtBcHbwJNV/7EPMPUQZyI3R jgLUlOJSL3XI37+B0CSv0POczlWYQkpm5a7/3RS4/90Ii9zv1F+r6SNlKre5sAb8/cYLDu 0yhKvx9Tx4QOpAwpti/pxqjL18s/JW4= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-RsSUIu9ENGiO17w-O37W0A-1; Sun, 03 Apr 2022 19:46:30 -0400 X-MC-Unique: RsSUIu9ENGiO17w-O37W0A-1 Received: by mail-ej1-f70.google.com with SMTP id sg13-20020a170907a40d00b006e7e8234ae2so480082ejc.2 for ; Sun, 03 Apr 2022 16:46:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=C8cVDGiZ+cSWxbIz+gqcOyAE9l2Z8U57LG7EfWN2Uu4=; b=Xs7U7lFh9n3+g/+aRgNKoU2poICYOZ/3D2z7UML2ip+ai2caWY8tnz/g4EuJGV33/Y XvMkZ9ILR4Sr4Bp5fUpZKth4t5QSs1ZSwMdzlqJvUzjz41i0oXjE0XAs9ixvfjRRHZc6 kjCgQyxoDUAIE6ZSGqMZlIpw4Tsc/vYduGRmyFHSh7cJm6ELKckbUTXsCj2GgKNsngfb VKaJeTVvRRYuiIpZ0vcajo9KdF9QRiGkU+ogDZrln4ayXLDiMD+N9Zoma0ZoR5Bjsy5o Q+fobpbQ5bMT5bIbYF2DK24fx4vawKhPfujsqwAxXnaZmNA0JHuV41lbqV/StyUnC75F zPMA== X-Gm-Message-State: AOAM531yqJBg78uDT0z2BKOIhbKUWDd2tjwl+i1ODkr+/Rng1kcHJjMV llWUeGPCQD8CDpj0S92edXcqoBRSzsE1HvnoTkJU4jXugpRg8Pz78wF2GaeYlI4vIxfCSnaC0Fn mEn8p8gnEplPN1gqS5mcQDFDu8/8P6cCLAofQRIKWlEq2+1Yz1/ju7tOyGNPTPXCo X-Received: by 2002:a17:907:7214:b0:6dd:e8fe:3e9 with SMTP id dr20-20020a170907721400b006dde8fe03e9mr8679988ejc.51.1649029589457; Sun, 03 Apr 2022 16:46:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyveTHh1PGkPszdrKHu7yJeyP/v4o/mjZX9sgOCvMFFI0INA2IbUDDpCMG8+5dj+nVFTrzRSg== X-Received: by 2002:a17:907:7214:b0:6dd:e8fe:3e9 with SMTP id dr20-20020a170907721400b006dde8fe03e9mr8679979ejc.51.1649029589190; Sun, 03 Apr 2022 16:46:29 -0700 (PDT) Received: from localhost (net-93-66-41-83.cust.vodafonedsl.it. [93.66.41.83]) by smtp.gmail.com with ESMTPSA id e12-20020a170906c00c00b006e66eff7584sm2252000ejz.102.2022.04.03.16.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 16:46:28 -0700 (PDT) From: Paolo Valerio To: dev@openvswitch.org Date: Mon, 04 Apr 2022 01:46:23 +0200 Message-ID: <164902958312.987936.17848831793594595750.stgit@fed.void> User-Agent: StGit/1.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pvalerio@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2] flow: Allow matches on nw_proto also for IPv6 later frags. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The next header contained in the last extension header of the IPv6 later frags still contain the information of the upper layer protocol number. Similarly to what OvS does for IPv4, allow L4 matches for later IPv6 frags as well by processing later frags and storing the nw_proto information. Signed-off-by: Paolo Valerio Acked-by: Eelco Chaudron --- v2: - netdev-dummy/receive command got split in multiple lines. --- lib/flow.c | 3 --- tests/ofproto-dpif.at | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/lib/flow.c b/lib/flow.c index dd523c889..0a7301ccf 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -534,13 +534,10 @@ parse_ipv6_ext_hdrs__(const void **datap, size_t *sizep, uint8_t *nw_proto, return false; } - /* We only process the first fragment. */ if ((*frag_hdr)->ip6f_offlg != htons(0)) { *nw_frag = FLOW_NW_FRAG_ANY; if (((*frag_hdr)->ip6f_offlg & IP6F_OFF_MASK) != htons(0)) { *nw_frag |= FLOW_NW_FRAG_LATER; - *nw_proto = IPPROTO_FRAGMENT; - return true; } } } diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 58f08dff9..6d87a2d37 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -4757,6 +4757,53 @@ recirc_id(0),in_port(90),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(proto=6,fr OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto-dpif - fragment handling - IPv6 with match on L4 proto]) +AT_SKIP_IF([test $HAVE_IPV6 = no]) +OVS_VSWITCHD_START +add_of_ports br0 1 2 + +AT_DATA([flows.txt], [dnl +priority=10,in_port=1,udp6,action=output:2 +priority=0,action=drop +]) +AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) + +AT_CHECK([ovs-appctl netdev-dummy/receive p1 'f2ff00000002f2ff0000000186dd6007c0aa05b02c40fc000000000000000000000000000001fc0000000000000000000000000000021100000161f9332fa33b1f900608390e dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000']) + +AT_CHECK([ovs-appctl netdev-dummy/receive p1 'f2ff00000002f2ff0000000186dd6007c0aa00682c40fc000000000000000000000000000001fc000000000000000000000000000002110005a861f9332f0000000000000000 dnl + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 dnl + 000000000000000000000000000000000000']) + +AT_CHECK([ovs-appctl dpctl/dump-flows filter="in_port=1"], [0], [dnl +flow-dump from the main thread: +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=17,frag=first), packets:0, bytes:0, used:never, actions:2 +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x86dd),ipv6(proto=17,frag=later), packets:0, bytes:0, used:never, actions:2 +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto-dpif - fragment handling - actions]) OVS_VSWITCHD_START add_of_ports br0 1 2 3 4 5 6 90