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 609855A026A for ; Tue, 13 Dec 2022 23:48:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670971737; 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=E5j9epaAIZvgfNKZrAe3WD8L+int0fW9HE2O5LG4YmA=; b=cttU9wvxZ7zDvI93rAuxcZvvzs5luFaxdnFI0eX7qNw3/E/QZPBS3AH0V3U9EdNQaOEDIX ymYfqYsQDIL2P+4UbPCTcBVq8VjwypW5vDcA5XPyuja7Z+UH2XRPoSm6rSFr/okTzN8csg PWIwCogda8sEshVX6rwj2s2W8FqyrU4= 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-125-Re5W5HeLOBuzZbXe7qrFhw-1; Tue, 13 Dec 2022 17:48:56 -0500 X-MC-Unique: Re5W5HeLOBuzZbXe7qrFhw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ADF71804184; Tue, 13 Dec 2022 22:48:55 +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 740592166B26; Tue, 13 Dec 2022 22:48:55 +0000 (UTC) Date: Tue, 13 Dec 2022 23:48:52 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 5/8] udp: Pre-populate msg_names with local address Message-ID: <20221213234852.31c05833@elisabeth> In-Reply-To: <20221205081425.2614425-6-david@gibson.dropbear.id.au> References: <20221205081425.2614425-1-david@gibson.dropbear.id.au> <20221205081425.2614425-6-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: GWH3Z2KV6IGPJ5QX7XETAWFGVN23G254 X-Message-ID-Hash: GWH3Z2KV6IGPJ5QX7XETAWFGVN23G254 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.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: On Mon, 5 Dec 2022 19:14:22 +1100 David Gibson wrote: > udp_splice_namebuf is now used only for spliced sending, and so it only > ever populated with the localhost address, either IPv4 or IPv6. So, > replace the awkward initialization in udp_sock_handler_splice() with > statically initialized versions for IPv4 and IPv6. We then just need to > update the port number in udp_sock_handler_splice(). > > Signed-off-by: David Gibson > --- > udp.c | 40 ++++++++++++++++++---------------------- > util.h | 7 +++++++ > 2 files changed, 25 insertions(+), 22 deletions(-) > > diff --git a/udp.c b/udp.c > index 24fa984..7c601cc 100644 > --- a/udp.c > +++ b/udp.c > @@ -232,11 +232,18 @@ static struct mmsghdr udp4_l2_mh_tap [UDP_MAX_FRAMES]; > static struct mmsghdr udp6_l2_mh_tap [UDP_MAX_FRAMES]; > > /* recvmmsg()/sendmmsg() data for "spliced" connections */ > -static struct sockaddr_storage udp_splice_namebuf; > - > static struct iovec udp4_iov_splice [UDP_MAX_FRAMES]; > static struct iovec udp6_iov_splice [UDP_MAX_FRAMES]; > > +static struct sockaddr_in udp_localname4 = { > + .sin_family = AF_INET, > + .sin_addr = IN4ADDR_LOOPBACK_INIT, > +}; > +static struct sockaddr_in6 udp_localname6 = { > + .sin6_family = AF_INET6, > + .sin6_addr = IN6ADDR_LOOPBACK_INIT, > +}; Nit, not a strong preference and not worth re-spinning just for this: I think udp4_localname and udp6_localname would be more consistent with everything else here, hence easier to type without double checking. -- Stefano