From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 6E50C5A0082 for ; Sat, 21 Jan 2023 10:47:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674294444; 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: in-reply-to:in-reply-to:references:references; bh=dT7NDGXFlnKzLy+dDPqJVdJ6PhLv+YubARM1tVloCBo=; b=cgsDepaUbhqY1v02ZKFOfDN3ODTYID/yDSlyzEydX9hroI9AfGEVPVzwUZmyCEJrGVgE23 AOUvYPIJi8RYwuiEUVXpUdNDZ3GYyiqAqjiXJ7lbEHIxLodTwPYcKDGQoqZ7MHMpOv5MgX SOmj06xv6zRk+YPHVLcbGFSgQbX9hXU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-k6OGW2OuNGCcHPAker2Vdw-1; Sat, 21 Jan 2023 04:47:20 -0500 X-MC-Unique: k6OGW2OuNGCcHPAker2Vdw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BDB93802D1A; Sat, 21 Jan 2023 09:47:19 +0000 (UTC) Received: from maya.cloud.tilaa.com (ovpn-208-4.brq.redhat.com [10.40.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7592E492B02; Sat, 21 Jan 2023 09:47:19 +0000 (UTC) Date: Sat, 21 Jan 2023 10:47:03 +0100 From: Stefano Brivio To: Noah Gold Subject: Re: Improved handling of changing DNS resolvers Message-ID: <20230121104703.3ebcc753@elisabeth> In-Reply-To: References: Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: H73NQG2ZCFMG2LX3YX3MPSB7ERMYVIS7 X-Message-ID-Hash: H73NQG2ZCFMG2LX3YX3MPSB7ERMYVIS7 X-MailFrom: sbrivio@redhat.com 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: passt-dev@passt.top, David Gibson X-Mailman-Version: 3.3.3 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: Hi Noah, Sorry for the delay, I didn't check pending mailing list posts for a couple of days. Comments below: On Tue, 17 Jan 2023 11:50:50 -0800 Noah Gold wrote: > Hi folks, > > libslirp and Passt have different approaches to sharing DNS resolvers with > the guest system, each with their own benefits & drawbacks. On the libslirp > project, we're discussing [1] how to support DNS failover. Passt already has > support for this, but there is a drawback to its solution which prevents us > from taking a similar approach: the resolvers are read exactly once, so if the > host changes networks at runtime, the guest will not receive the updated > resolvers and thus its connectivity will break. Right -- the main motivation behind this (other than simplicity) is that we can close /etc/resolv.conf before sandboxing. However, we could keep a handle on it, just like we do for PID and pcap files, while still unmounting the filesystem. And we could also use inotify to detect changes I guess -- we do the same to monitor namespaces in pasta mode (see pasta_netns_quit_init()). > libslirp's current approach is to DNAT a single address exposed to the guest > to one of the resolvers configured on the host. The problem here is that if that > one resolver goes down, the guest can't resolve DNS names. We're > considering changing so that instead of a single address, we expose a set of > MAXNS addresses, and DNAT those 1:1 to the DNS resolvers registered with > the host. Because the DNAT table lives on the host side, we can refresh the > guest's resolvers whenever the host's resolvers change, but without the need to > expire a DHCP lease (even with short leases, the guest will still lose > connectivity > for a time). > > Does this sound like an approach Passt would be open to adopting as well? Yes, definitely, patches would be very welcome. Note that David (Cc'ed) is currently working on a generalised/flexible address mapping mechanism, some kind of (simple) NAT table as far as I understood it. This might even address your DNS idea already, I'm not sure, I'd wait for him to comment. -- Stefano