From patchwork Fri Apr 1 23:35: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: 1612445 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=Ml7faG4j; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4KVc3q3ZhLz9sFq for ; Sat, 2 Apr 2022 10:35:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7FA2D419EE; Fri, 1 Apr 2022 23:35:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7_1HI2IiDcwl; Fri, 1 Apr 2022 23:35:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1B56941920; Fri, 1 Apr 2022 23:35:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D8E26C001D; Fri, 1 Apr 2022 23:35:30 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 66896C0012 for ; Fri, 1 Apr 2022 23:35:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 544CF41960 for ; Fri, 1 Apr 2022 23:35:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XBzW80otMmzH for ; Fri, 1 Apr 2022 23:35:28 +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 smtp4.osuosl.org (Postfix) with ESMTPS id 59F9141920 for ; Fri, 1 Apr 2022 23:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648856127; 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=W2CpUFTLxFFpSg1g8Dr+JXzjXH5SFw3xzKUUlXk2luY=; b=Ml7faG4jVC1Eu/ImHdCer6CTurqY901fYU2TekzuW6ZTO2tJgF20NyHKziTlvbdByZqlJt MS26wRFmN/lV4RMDPmAjYLI8GsLn+zni7uFc8kA9sbAnAnnMXZXCro6J/afuDIRQXn7EH+ 8DlesfG3BJLPsAYZEjg4v/NHJ0X4v7Q= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-C54TLwo_NkOPnQdumt7RLg-1; Fri, 01 Apr 2022 19:35:26 -0400 X-MC-Unique: C54TLwo_NkOPnQdumt7RLg-1 Received: by mail-wm1-f69.google.com with SMTP id m185-20020a1c26c2000000b0038c9e1197f6so1770947wmm.4 for ; Fri, 01 Apr 2022 16:35:26 -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=W2CpUFTLxFFpSg1g8Dr+JXzjXH5SFw3xzKUUlXk2luY=; b=tQaX/rdhk3d3WyLUUCQf3vuopgYS1lBOXpwrtLdhRL+vvlaFk9u6NtuBcMnEVeSKLG LH8IdKA6EZmiqEPnsr7hMW/Ll5I/N3zeIxef9p1Um4OiFcwcr335eIvPZ1MLamHTVr67 uySQq0V0CdqCeLAeFYPkO7efQvevpCwNFsgbQYmgRSt52N2W6BzJdUvcPs71PtcsbWL9 Wi9O28EOLyS3UnYrf5w/MWpWodE0OLWhiriI3er3mwpgW3QIEmv/YrE1ma4cHyhdhMdc JHiwynIuBke0/Dezvr1y73YiY2wp4gvE7bSqAmcmjHy19YpZ1168oEl62XopnGnTvCLb U6CQ== X-Gm-Message-State: AOAM532ICA0m/fxQC2Zw1csvVBpylhu0r5UIHRD/+k4Xn+al0OBe7grz rXmXVEHLiUrJPzq4XNOAVrC2TtBLK6R/p9NMkcBN0/o+I26bH0M69xrl4n2z7D5ivizZ2ftU7w1 BzSsil7UsBIvDpNHBSnaSY5SezIvJbE1hrH/GlfxnbB9ApyU5PLHrEnGNODf1V5cE X-Received: by 2002:a05:600c:2c49:b0:38c:6b2d:39fc with SMTP id r9-20020a05600c2c4900b0038c6b2d39fcmr10659721wmg.33.1648856124997; Fri, 01 Apr 2022 16:35:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb/aPciymR+ebOKxtivR+Ym9PuZoW5bOEiJ4a/2yM/82jD8gCS17lv9zPQjtkDoto4n0yXTg== X-Received: by 2002:a05:600c:2c49:b0:38c:6b2d:39fc with SMTP id r9-20020a05600c2c4900b0038c6b2d39fcmr10659709wmg.33.1648856124788; Fri, 01 Apr 2022 16:35:24 -0700 (PDT) Received: from localhost (net-93-66-41-83.cust.vodafonedsl.it. [93.66.41.83]) by smtp.gmail.com with ESMTPSA id p23-20020a1c5457000000b0038c98c12ea9sm2983954wmi.1.2022.04.01.16.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 16:35:24 -0700 (PDT) From: Paolo Valerio To: dev@openvswitch.org Date: Sat, 02 Apr 2022 01:35:23 +0200 Message-ID: <164885612346.1396061.15065322158940269369.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] 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 --- lib/flow.c | 3 --- tests/ofproto-dpif.at | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) AT_SETUP([ofproto-dpif - fragment handling - actions]) OVS_VSWITCHD_START add_of_ports br0 1 2 3 4 5 6 90 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 439761216..9a97797b7 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -4757,6 +4757,30 @@ 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 "f2ff00000002f2ff0000000186dd6007c0aa05b02c40fc000000000000000000000000000001fc0000000000000000000000000000021100000161f9332fa33b1f900608390e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000"]) + +AT_CHECK([ovs-appctl netdev-dummy/receive p1 "f2ff00000002f2ff0000000186dd6007c0aa00682c40fc000000000000000000000000000001fc000000000000000000000000000002110005a861f9332f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"]) + +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 +