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 BECAF5A0272 for ; Thu, 22 Feb 2024 18:47:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708624024; 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=0/r4rlj0pPy45XBGuMPPs1bORWCzBmRCwYFKr/zCMUw=; b=NHCkopfnZcKyNuF6XZkRypzvRWkOuaBC2quQbOb0gYGqZz8kxNjDI83V3KjBaGUuKGenrX eksyBvUrGG+K0pwucSUZbh8GTn2KA7bQ+NJMYNBAGaVnaW/RofOCalci7r7Gg2Fe26tB50 RQSmMi9db4aEM3kEvvBWrx1vR6x4wHY= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-95lKdkQ3P4uIVbWUGa-dcw-1; Thu, 22 Feb 2024 12:47:03 -0500 X-MC-Unique: 95lKdkQ3P4uIVbWUGa-dcw-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a3f52ebbb6cso56066b.0 for ; Thu, 22 Feb 2024 09:47:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624021; x=1709228821; 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=0/r4rlj0pPy45XBGuMPPs1bORWCzBmRCwYFKr/zCMUw=; b=gLFm2X3KiZwWgsICtyMIm5tHeYjGCa3I8e8qPwPUc6aIHI42DZrX8Mqo5ZYMoQ4cL3 h9yr/vL2kz6quhsu6EFlB2eJzkAFTzAfif6XOQC1yJ9RHIrqlaEHoUaZQyYrYgeGp1JC Ne6p5LE1t/NpC61QmQJVrblbKS8s4migHPgoK/fx/iFAHoB2M4Uze4PdORrTG+3NDJ7y i7AK1Pkn5BKgkQYqSgWZka6YdccgXIFj2EFL/TmD2VEdVEbIe8jzVooU/+InZM3t+04r bSAJLsxf8Mo6bNtrWZe2kCaCcXTjU6ZsDaRM5gBi97rw9C5HAb3hWaujSSsaArPgd7uv wQEg== X-Gm-Message-State: AOJu0YxKOKTt/ifxPDsSgAPSX0NmcNGazUFUvxPfcnyz45Hb3PXlWDxN s4vO9qKb6ECwXVW9l771WdXjH8DgkFPptSrehKScd963JkWgvteu5lvnHjJEFFEw4yeRjAL3Qtc A9GD+QIWjOpPItYo8Ehb552Avk4YQrjyomIwyR0jO8A6GCfxNIKKvlissYhO5 X-Received: by 2002:a17:907:bb90:b0:a3f:b0e6:937a with SMTP id xo16-20020a170907bb9000b00a3fb0e6937amr333615ejc.49.1708624021681; Thu, 22 Feb 2024 09:47:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ5fd0+If+G1j89NCTpA1AElt+odORgo15B94xTg4I5e4VADva5FKg6j2gbUUDacunVA+xow== X-Received: by 2002:a17:907:bb90:b0:a3f:b0e6:937a with SMTP id xo16-20020a170907bb9000b00a3fb0e6937amr333601ejc.49.1708624021365; Thu, 22 Feb 2024 09:47:01 -0800 (PST) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id cw4-20020a170907160400b00a3e45a18a5asm5309665ejd.61.2024.02.22.09.47.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2024 09:47:00 -0800 (PST) Date: Thu, 22 Feb 2024 18:46:02 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 1/7] udp: Don't attempt to translate a 0.0.0.0 source address Message-ID: <20240222184602.554e3f5e@elisabeth> In-Reply-To: <20240221232115.1376333-2-david@gibson.dropbear.id.au> References: <20240221232115.1376333-1-david@gibson.dropbear.id.au> <20240221232115.1376333-2-david@gibson.dropbear.id.au> 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: WZTCOEXNOUP7EI43LLFT2PDH7TVJ2QCU X-Message-ID-Hash: WZTCOEXNOUP7EI43LLFT2PDH7TVJ2QCU 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 Thu, 22 Feb 2024 10:21:09 +1100 David Gibson wrote: > If an incoming packet has a source address of 0.0.0.0 we translate that to > the gateway address. This doesn't really make sense, because we have no > way to do a reverse translation for reply packets. Well, we would translate that back to a loopback address, which is fine if we take 0.0.0.0 as "This host on this network". Actually, after my previous note based on RFC 6890, I went and had a look at RFC 1122, section 3.2.1.3, which also states that 0.0.0.0: MUST NOT be sent, except as a source address as part of an initialization procedure by which the host learns its own IP address. ...so I guess dropping it here is fine. By the way, I added this originally as part of commit 6488c3e8489d ("tcp, udp: Replace loopback source address by gateway address") on the basis that 0.0.0.0 could be used in lieu of a loopback address, but sure, we shouldn't even get it from the kernel to start with. > Certain UDP protocols do use an unspecified source address in some > circumstances (e.g. DHCP). These generally either require no reply, a > multicast reply, or provide a suitable reply address by other means. > > In none of those cases does translating it in passt/pasta make sense. The > best we can really do here is just leave it as is. > > Signed-off-by: David Gibson > --- > udp.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/udp.c b/udp.c > index a3961bfd..d2f8027c 100644 > --- a/udp.c > +++ b/udp.c > @@ -599,7 +599,6 @@ static size_t udp_update_hdr4(const struct ctx *c, int n, in_port_t dstport, > src_port == 53) { > b->iph.saddr = c->ip4.dns_match.s_addr; > } else if (IN4_IS_ADDR_LOOPBACK(&b->s_in.sin_addr) || > - IN4_IS_ADDR_UNSPECIFIED(&b->s_in.sin_addr)|| > IN4_ARE_ADDR_EQUAL(&b->s_in.sin_addr, &c->ip4.addr_seen)) { > b->iph.saddr = c->ip4.gw.s_addr; > udp_tap_map[V4][src_port].ts = now->tv_sec; -- Stefano