From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 78EBC5A0271 for ; Tue, 24 Nov 2026 13:14:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795522498; 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=Zg2HuGwHV3prwQSmP7g4vCbL0Wyf76mIupgHDYN8CYw=; b=Iexc/pLYSqIZBRza7to9lyY6XX3oWbTvsSBgUjZudaPZi1Reax9veMfHzI8zadSJzP6FMX AokVlesvjuRPXJ/xwQsz5jvyi7CDO9cOUnktrZjO3S+TZKysAf69/0/PpzCusXhGzcjIOq GCwuEgSvz2FU8WCGSgtBBUVrGRtbVEc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-xgo-ASiJNyCGWJYYtnELug-1; Tue, 24 Nov 2026 12:14:56 +0000 X-MC-Unique: xgo-ASiJNyCGWJYYtnELug-1 X-Mimecast-MFC-AGG-ID: xgo-ASiJNyCGWJYYtnELug_1795522495 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48e0389d6f9so2751021f8f.1 for ; Tue, 24 Nov 2026 04:14:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795522495; x=1796127295; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Zg2HuG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ijEnFHtYQxviUY/zeAxcZhQIZtcMZNsqnz3Svt5KgjSFAqO4BIXzOaXUdjrhd8SnjsvY= X-Received: by 2002:a05:600c:a0d:b0:4a1:825a:56fd with SMTP id 5b1f17b1804b1-4bb88826c1fmr285513265e9.32.1795522494768; Tue, 24 Nov 2026 04:14:54 -0800 (PST) X-Received: by 2002:a05:600c:a0d:b0:4a1:825a:56fd with SMTP id 5b1f17b1804b1-4bb88826c1fmr285512625e9.32.1795522494253; Tue, 24 Nov 2026 04:14:54 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884911e3sm515930345e9.6.2026.11.24.04.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2026 04:14:53 -0800 (PST) From: Stefano Brivio To: Jon Maloy Subject: Re: [PATCH v2] netlink: Set default route as on-link Message-ID: <20261124131452.36195d46@elisabeth> In-Reply-To: <20261124041350.3347277-1-jmaloy@redhat.com> References: <20261124041350.3347277-1-jmaloy@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Tue, 24 Nov 2026 13:14:53 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: uI9oZs5eCuA77DKs8_N-dJ4InPB2nVEb0-sPXGU-Uig_1795522495 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: AURV66VAGOUCI5MHP2PZE2MIWZGCO43O X-Message-ID-Hash: AURV66VAGOUCI5MHP2PZE2MIWZGCO43O 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: david@gibson.dropbear.id.au, passt-dev@passt.top 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: On Mon, 23 Nov 2026 23:13:50 -0500 Jon Maloy wrote: > Commit da54641f140e ("conf, pasta: With --config-net, copy all routes > by default") made it possible to use a default gateway that's not on > the same subnet as any address assigned to the namespace interface, > as copying all routes from the template interface also copies the > device route for the gateway. > > If pasta sets the default route itself instead, that is, with -g or > --no-copy-routes, or in local mode, there's no such device route, and > the kernel refuses a gateway that's not covered by any assigned > prefix: > > $ pasta -Ix -- sh -c 'ip link set dev x up; \ > ip addr add 10.0.0.2/24 dev x; \ > ip route add default via 10.0.0.1 dev x; \ > pasta -4 --config-net -a 192.0.2.1 -g 10.0.0.1 -- ip route' > Couldn't set IPv4 route(s) in guest: Network is unreachable > > $ pasta -6 -Ix -- sh -c 'ip link set dev x up; \ > ip addr add 2001:db8:1::2/64 dev x nodad; \ > ip -6 route add default via 2001:db8:1::1 dev x; \ > pasta -6 --config-net -a 2001:db8:2::1 -g 2001:db8:1::1 -- \ > ip -6 route' > Couldn't set IPv6 route(s) in guest: No route to host > > The same happens in local mode for IPv4, where the default gateway is > 169.254.2.2, with -a and any address outside 169.254.0.0/16. In local > mode for IPv6, the default gateway is the link-local address fe80::1, > which is always covered by the fe80::/64 device route. > > We reply to ARP requests and neighbour solicitations for any address > other than the guest's own, so the gateway is in fact always reachable > on the link. Flag the default route with RTNH_F_ONLINK, so that the > kernel doesn't require the gateway to be within an assigned prefix. > This doesn't hide anything from the user, and makes these > configurations usable. With this change: > > default via 10.0.0.1 dev x onlink > 192.0.2.0/24 dev x proto kernel scope link src 192.0.2.1 > > and: > > default via 2001:db8:1::1 dev x metric 1024 onlink pref medium > > Note that RTNH_F_ONLINK is supported for IPv6 routes since Linux 4.16. > > Signed-off-by: Jon Maloy Applied, thanks for the explanation about the current behaviour, it finally makes sense to me now. -- Stefano