From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202410 header.b=bHI9OiJY; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 1CCAD5A061A for ; Wed, 06 Nov 2024 02:44:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1730857455; bh=UQKJD64k+WKnZiX5XYu6L2Dc+3q255kYEFOEcWVS/tY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHI9OiJYdGrr/qiVKcrjbOOeuleYxDbnl6FklvHARHjrdgNCU/GwMTugIJkYaFoYk O8vKk1+stLa+Ln/3dfSsarzOlVlbGzKU9ZU9/kls+KVKUpJ/3ywZj1MQiT2orpHDEO Ltb9z3Rja8vqEDs0ecoZ+SFRqZA17joKWq87mgrtjSs/xptD61eR3+IAlxN722ZsRv YhzqCB5D/Ok7PKEM1cODi/57reYWezOjPzEMVX7rk8xWuXkISwGqgs7NInp1nFCBkL 9tPME/eC3I0sM3JJudD87a/ZCwpkHEpTnfYe7ST/nf3/Sg6C809Ucu8X+kSB1c6/cE eErWhIaXKKt4w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Xjp0H0Pk3z4w2H; Wed, 6 Nov 2024 12:44:15 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 2/2] test: Improve test for NDP assigned prefix Date: Wed, 6 Nov 2024 12:44:15 +1100 Message-ID: <20241106014415.1765896-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106014415.1765896-1-david@gibson.dropbear.id.au> References: <20241106014415.1765896-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: M2XTLBCAUOMJLF5TWKRWRMUFAYJMWWHG X-Message-ID-Hash: M2XTLBCAUOMJLF5TWKRWRMUFAYJMWWHG X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In the NDP tests we search explicitly for a guest address with prefix length 64. AFAICT this is an attempt to specifically find the SLAAC assigned address, rather than something assigned by other means. We can do that more explicitly by checking for .protocol == "kernel_ra". however. The SLAAC prefixes we assigned *will* always be 64-bit, that's hard-coded into our NDP implementation. RFC4862 doesn't really allow anything else since the interface identifiers for an Ethernet-like link are 64-bits. Let's actually verify that, rather than just assuming it, by extracting the prefix length assigned in the guest and checking it as well. Signed-off-by: David Gibson --- test/passt/ndp | 4 ++-- test/pasta/ndp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/passt/ndp b/test/passt/ndp index f54b8ce..56b385b 100644 --- a/test/passt/ndp +++ b/test/passt/ndp @@ -23,8 +23,8 @@ hout HOST_IFNAME6 ip -j -6 route show|jq -rM '[.[] | select(.dst == "default").d check [ -n "__IFNAME__" ] test SLAAC: prefix -gout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .prefixlen == 64).local] | .[0]' -gout PREFIX6 sipcalc __ADDR6__/64 | grep prefix | cut -d' ' -f4 +gout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .protocol == "kernel_ra") | .local + "/" + (.prefixlen | tostring)] | .[0]' +gout PREFIX6 sipcalc __ADDR6__ | grep prefix | cut -d' ' -f4 hout HOST_ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__HOST_IFNAME6__").addr_info[] | select(.scope == "global" and .deprecated != true).local] | .[0]' hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4 check [ "__PREFIX6__" = "__HOST_PREFIX6__" ] diff --git a/test/pasta/ndp b/test/pasta/ndp index c59627f..2442ab5 100644 --- a/test/pasta/ndp +++ b/test/pasta/ndp @@ -22,8 +22,8 @@ ns ip link set dev __IFNAME__ up ns while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done test SLAAC: prefix -nsout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .prefixlen == 64).local] | .[0]' -nsout PREFIX6 sipcalc __ADDR6__/64 | grep prefix | cut -d' ' -f4 +nsout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .protocol == "kernel_ra") | .local + "/" + (.prefixlen | tostring)] | .[0]' +nsout PREFIX6 sipcalc __ADDR6__ | grep prefix | cut -d' ' -f4 hout HOST_ADDR6 ip -j -6 addr show|jq -rM ['.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .deprecated != true).local] | .[0]' hout HOST_PREFIX6 sipcalc __HOST_ADDR6__/64 | grep prefix | cut -d' ' -f4 check [ "__PREFIX6__" = "__HOST_PREFIX6__" ] -- 2.47.0