From nobody Thu Dec 18 15:24:27 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8037F1B47C7 for ; Thu, 20 Jun 2024 12:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718888193; cv=none; b=gcdqkh4RVN4zwv+zI3chD44+AD9YYcGSX3+lsouqOITjUnAZC0UgtLFBpASsRMgi/8r5rHxLQ26dicUL/BGW7OiZKXlAhaXkNHMI76kUD4c04JO8+7MBUBYRjjBUGfbD2q27/MP+kw/D5F9nMxju/FSNZvkhtHEf6DZa52rOc1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718888193; c=relaxed/simple; bh=ehCFD70yeZmgvGeU+oACRU5BVPCK64DlPCzSd2L448g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ngX7o8nN4aqNhwf2x8k6HqQhxW6/FgD/jaCIpYfOsiC85e2XHyIZsgS274RfgTgcC7FTBD6A8mB0ipfLEXI9eevC8jGvgxLNKuDu5l+73ik9yPL4gNVnniEOz9LHIidtfDAoSGL2+o66LPv3DGmW6HihKD1hpHwvHSRzB8SQmnw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Er2ZReLw; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Er2ZReLw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718888190; 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=5KQWKZuB8nVeihbMwq4LfjJggXovEXIPvEKjuzYu6Ag=; b=Er2ZReLwGGGWZgLUAE2NhjzvfnX1MRBDjaE0dBDGwOIvdjjQ6pX8frTGp9ndvllThCNEI9 M5sutndPSkZkMPl4153kCFOkXh+1uWsA6UrzIZcpGhqSKzKvIRO5tRRNjqKmxMdMZdvIGJ 5145TM+ZtrAN6OE0jjtp2tFUZLzHeUc= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-zmsjOGBsOGmNNJnzfPRfAg-1; Thu, 20 Jun 2024 08:56:24 -0400 X-MC-Unique: zmsjOGBsOGmNNJnzfPRfAg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B8F521955EAC; Thu, 20 Jun 2024 12:56:22 +0000 (UTC) Received: from RHTRH0061144.redhat.com (unknown [10.22.9.58]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BE37D1955E80; Thu, 20 Jun 2024 12:56:19 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: dev@openvswitch.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Stefano Brivio , =?UTF-8?q?Adri=C3=A1n=20Moreno?= , Simon Horman Subject: [PATCH v2 net-next 5/7] selftests: openvswitch: Support implicit ipv6 arguments. Date: Thu, 20 Jun 2024 08:55:59 -0400 Message-ID: <20240620125601.15755-6-aconole@redhat.com> In-Reply-To: <20240620125601.15755-1-aconole@redhat.com> References: <20240620125601.15755-1-aconole@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" The current iteration of IPv6 support requires explicit fields to be set in addition to not properly support the actual IPv6 addresses properly. With this change, make it so that the ipv6() bare option is usable to create wildcarded flows to match broad swaths of ipv6 traffic. Reviewed-by: Simon Horman Tested-by: Simon Horman Signed-off-by: Aaron Conole --- v2: Drop the change in the v6 key class that removed the str() conversion .../selftests/net/openvswitch/ovs-dpctl.py | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/t= esting/selftests/net/openvswitch/ovs-dpctl.py index 2f16df2fb16b..0ea7286a491e 100644 --- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py +++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py @@ -200,6 +200,18 @@ def convert_ipv4(data): =20 return int(ipaddress.IPv4Address(ip)), int(ipaddress.IPv4Address(mask)) =20 +def convert_ipv6(data): + ip, _, mask =3D data.partition('/') + + if not ip: + ip =3D mask =3D 0 + elif not mask: + mask =3D 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' + elif mask.isdigit(): + mask =3D ipaddress.IPv6Network("::/" + mask).hostmask + + return ipaddress.IPv6Address(ip).packed, ipaddress.IPv6Address(mask).p= acked + def convert_int(size): def convert_int_sized(data): value, _, mask =3D data.partition('/') @@ -941,21 +953,21 @@ class ovskey(nla): "src", "src", lambda x: str(ipaddress.IPv6Address(x)), - lambda x: int.from_bytes(x, "big"), - lambda x: ipaddress.IPv6Address(x), + lambda x: ipaddress.IPv6Address(x).packed if x else 0, + convert_ipv6, ), ( "dst", "dst", lambda x: str(ipaddress.IPv6Address(x)), - lambda x: int.from_bytes(x, "big"), - lambda x: ipaddress.IPv6Address(x), + lambda x: ipaddress.IPv6Address(x).packed if x else 0, + convert_ipv6, ), - ("label", "label", "%d", int), - ("proto", "proto", "%d", int), - ("tclass", "tclass", "%d", int), - ("hlimit", "hlimit", "%d", int), - ("frag", "frag", "%d", int), + ("label", "label", "%d", lambda x: int(x) if x else 0), + ("proto", "proto", "%d", lambda x: int(x) if x else 0), + ("tclass", "tclass", "%d", lambda x: int(x) if x else 0), + ("hlimit", "hlimit", "%d", lambda x: int(x) if x else 0), + ("frag", "frag", "%d", lambda x: int(x) if x else 0), ) =20 def __init__( @@ -1153,7 +1165,7 @@ class ovskey(nla): "target", "target", lambda x: str(ipaddress.IPv6Address(x)), - lambda x: int.from_bytes(x, "big"), + convert_ipv6, ), ("sll", "sll", macstr, lambda x: int.from_bytes(x, "big")), ("tll", "tll", macstr, lambda x: int.from_bytes(x, "big")), @@ -1238,13 +1250,13 @@ class ovskey(nla): "src", "src", lambda x: str(ipaddress.IPv6Address(x)), - lambda x: int.from_bytes(x, "big", convertmac), + convert_ipv6, ), ( "dst", "dst", lambda x: str(ipaddress.IPv6Address(x)), - lambda x: int.from_bytes(x, "big"), + convert_ipv6, ), ("tp_src", "tp_src", "%d", int), ("tp_dst", "tp_dst", "%d", int), --=20 2.45.1