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.133.124]) by passt.top (Postfix) with ESMTP id 327605A026D for ; Tue, 23 Apr 2024 10:09:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713859783; 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=yNezeVefAtnXCMZLWVj01IHXTJ5x/8p93GyBLrG6lN4=; b=XAUjnD59cWU9zAtFczpiqYnRjqQ1DLNOUxqUi3/XdEh+xcvwu/ZJ9azSmaJjMmEMQmD1n8 mIX07Zk9DNxtCaj9DiYmekTO2n3acqmI5rcgsDIT7O3KykPRe24uyDbEMXpg2XhY/DXYHt LHAypsjGiSS2eiYetvsbpmb4aAUQV9U= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-60-ias7XGsdMCKy7oFpxbBIuw-1; Tue, 23 Apr 2024 04:09:41 -0400 X-MC-Unique: ias7XGsdMCKy7oFpxbBIuw-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-57215c940d2so1224660a12.1 for ; Tue, 23 Apr 2024 01:09:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713859779; x=1714464579; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yNezeVefAtnXCMZLWVj01IHXTJ5x/8p93GyBLrG6lN4=; b=RyJXr/IePUAT59iXPbUqxogbwDwa+SC060uYsm80tr1N2X1QFnylUiRSkxrCnhPFaP OA3qEv0PVQZ4QgEgFIvfHIO1lQrJyzF59CBh21SOzp3sG2bd/Rn47Temg+HIx4JTIETm J6OlRt5WnyCgARWpzFAxwiwa8Dx31OkUqCHK4gqyinVNFHiEwtXJbfi2F898m6AYS/6C ycQUnNO2Elg+mm0fAnGQdYNcvV7L79lb/vx57p0qXLGvFzCEc7aOo7aJQLfFb7KG5iWq 7Y+GbVT/p8De43tLE/NJg77DpVTRsy6ibEbiZOSGDEPS7UwXpp2Duk0pLLcng1dDlLfv Bs0A== X-Gm-Message-State: AOJu0YxNxDP3jkwv2KI7gPD3NR+vqX0kmvYHHeducQd38yTg0l0k00E/ grEjiljptWReqEF5OtKLcFs45Ba0M/KfoTezbYFYI2ZDkc8dqBCOdbCzXJSv0otDwIBG0R/k0sa DLOXwtuovmb+T0DCyK5MLLvkD9WbISalfkfzm8DwjkbltdkYg58Nz5Z/VXXk7 X-Received: by 2002:a50:8743:0:b0:56d:fc50:ec50 with SMTP id 3-20020a508743000000b0056dfc50ec50mr1918760edv.13.1713859779114; Tue, 23 Apr 2024 01:09:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQF7i2ltrEECRc98iCsisGg6koZ71yPtOxAYu/fOV2B8/VahYmostLjNKqvUQf4IPdATdpiQ== X-Received: by 2002:a50:8743:0:b0:56d:fc50:ec50 with SMTP id 3-20020a508743000000b0056dfc50ec50mr1918723edv.13.1713859778395; Tue, 23 Apr 2024 01:09:38 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id bc24-20020a056402205800b0057059784823sm6341340edb.29.2024.04.23.01.09.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Apr 2024 01:09:37 -0700 (PDT) Date: Tue, 23 Apr 2024 10:09:04 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] netlink: Drop point-to-point peer information when we copy addresses Message-ID: <20240423100904.6d79b07f@elisabeth> In-Reply-To: References: <20240411221800.548178-1-sbrivio@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.36; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 4PXH4MH2Q6PCLGPZW6HD66GNDRSW4AWS X-Message-ID-Hash: 4PXH4MH2Q6PCLGPZW6HD66GNDRSW4AWS 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 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 Tue, 23 Apr 2024 11:02:43 +1000 David Gibson wrote: > On Fri, Apr 12, 2024 at 12:18:00AM +0200, Stefano Brivio wrote: > > If the template host interface is of type tun, and it's configured > > with a point-to-point peer address (that's what happens for example > > with openvpn and '--topology net30'), pasta will copy the peer > > information onto the namespace interface. > > > > But the namespace interface is not actually a point-to-point tunnel, > > and we won't resolve the peer address via ARP either, so we have > > to drop this information to get the expected behaviour (traffic > > regularly sent over our tap interface). > > > > Link: https://github.com/containers/podman/issues/22320 > > Signed-off-by: Stefano Brivio > > --- > > netlink.c | 23 ++++++++++++++++++++++- > > 1 file changed, 22 insertions(+), 1 deletion(-) > > > > diff --git a/netlink.c b/netlink.c > > index 89c0641..73aaa4b 100644 > > --- a/netlink.c > > +++ b/netlink.c > > @@ -792,8 +792,8 @@ int nl_addr_dup(int s_src, unsigned int ifi_src, > > > > seq = nl_send(s_src, &req, RTM_GETADDR, NLM_F_DUMP, sizeof(req)); > > nl_foreach_oftype(nh, status, s_src, buf, seq, RTM_NEWADDR) { > > + struct rtattr *rta, *rta_local = NULL; > > struct ifaddrmsg *ifa; > > - struct rtattr *rta; > > size_t na; > > > > ifa = (struct ifaddrmsg *)NLMSG_DATA(nh); > > @@ -804,12 +804,33 @@ int nl_addr_dup(int s_src, unsigned int ifi_src, > > > > ifa->ifa_index = ifi_dst; > > > > + for (rta = IFA_RTA(ifa), na = IFA_PAYLOAD(nh); RTA_OK(rta, na); > > + rta = RTA_NEXT(rta, na)) { > > + if (rta->rta_type == IFA_LOCAL) { > > + rta_local = rta; > > + break; > > + } > > + } > > + > > for (rta = IFA_RTA(ifa), na = IFA_PAYLOAD(nh); RTA_OK(rta, na); > > rta = RTA_NEXT(rta, na)) { > > /* Strip label and expiry (cacheinfo) information */ > > if (rta->rta_type == IFA_LABEL || > > rta->rta_type == IFA_CACHEINFO) > > rta->rta_type = IFA_UNSPEC; > > + > > + /* Different values for IFA_ADDRESS and IFA_LOCAL mean > > + * that IFA_LOCAL is the locally configured address, and > > + * IFA_ADDRESS is the peer address for a point-to-point > > + * interface. But our namespace interface isn't really a > > + * point-to-point tunnel, and we can't resolve that peer > > + * address via ARP: simply drop it, and keep the local > > + * address. > > Could we just unconditionally remove IFA_ADDRESS properties (by > setting them to IFA_UNSPEC)? That we we could avoid having two passes > through the attributes. Ah, thanks, that sounds better, but I haven't tried it yet. By the way, this patch doesn't fix the issue: https://github.com/containers/podman/issues/22320#issuecomment-2051279807 so I think we need something on top of this, but I'm not sure yet what. Other than tweaking routes, another idea might be to adjust the netmask here. -- Stefano