From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 244235A027F for ; Tue, 16 May 2023 02:36:17 +0200 (CEST) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4QKy314Z4vz4x46; Tue, 16 May 2023 10:36:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1684197373; bh=M5WA+X9SWbIULg5kTDtQV7xMesSUSs3d6P4qeKyA3L8=; h=From:To:Cc:Subject:Date:From; b=FeyuXkAQI0i+oXNNPZQfsSDfCH25yMpQFglBH00M/a5zK5BpCpXqTPCUbqARxR4KZ HkQ8nLAvBeqMQzFQrpgT+5MRGw/h/NyQN3wCyU3803K/uT0bzg2zJvOkFP3thfXgNS rwwb3+jx8wRDLTtg+W2+L85u5NUFccmQelM+F7Fg= From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH] tap: Don't update ip6.addr_seen to :: Date: Tue, 16 May 2023 10:36:11 +1000 Message-Id: <20230516003611.1699202-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: M36AN7RSBE23VVINOER7CI4QFVJFRW46 X-Message-ID-Hash: M36AN7RSBE23VVINOER7CI4QFVJFRW46 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: When we receive packets from the tap side, we update the addr_seen fields to reflect the last known address of the guest or ns. For ip4.addr_seen we, sensibly, only update if the address we've just seen isn't 0 (0.0.0.0). This case can occur during early DHCP transactions. We have no equivalent case for IPv6. We're less likely to hit this, because DHCPv6 uses link-local addresses, however we can see an source address of :: with certain multicast operations. This can bite us if we try to make an incoming connection very early after starting pasta with --config-net: we may have only seen some of those multicast packets, updated addr_seen to :: and not had any "real" packets to update it to a global address. I've seen this with some of the avocado test conversions. In any case, it can never make sense to update addr_seen to ::, so explicitly exclude that case. Signed-off-by: David Gibson --- tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tap.c b/tap.c index faa4e26..c0b7f33 100644 --- a/tap.c +++ b/tap.c @@ -739,7 +739,7 @@ resume: if (IN6_IS_ADDR_UNSPECIFIED(&c->ip6.addr_seen)) { c->ip6.addr_seen = *saddr; } - } else { + } else if (!IN6_IS_ADDR_UNSPECIFIED(saddr)){ c->ip6.addr_seen = *saddr; } -- 2.40.1