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 96C825A02CF for ; Thu, 16 May 2024 09:50:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715845826; 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=XfYII6ivgn8SZvE1XHDTbnc/AZS+ef3OltdwQNgxE58=; b=aCqzCLSUABE+G0iYP5H0K6VjC4gUTQrVPD306K8CzyQjNSyqlmyy8Nxf6eZYawu3jZeCjL /mWZQwMk0F2acbSoS6vkPh54YfWYFz0ew4s/l0Tf2iYqhY5akAXotb5uNfDXTzkJfmltUR yVgM60ggRO50kHZFXH8UlR3C4nTDDOM= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-diYAZ7Q5MNCzJl1TeQl0Xw-1; Thu, 16 May 2024 03:50:25 -0400 X-MC-Unique: diYAZ7Q5MNCzJl1TeQl0Xw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57345ef9172so991221a12.1 for ; Thu, 16 May 2024 00:50:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715845823; x=1716450623; 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=XfYII6ivgn8SZvE1XHDTbnc/AZS+ef3OltdwQNgxE58=; b=FnczwPnJYMf+bTqc3mr3mnJe1i43HDliCiIFHec2y5INMeUHK/n54KHMc7UnC8qS/Y j8CN/PHedP2efhdX66Xvrsv5vifCgO6m2gPgbwyPYba/wKcpFdPXvvaSPn7kAkZmT3Io 1zoKps7zZ3ABlSeDHmBqQiaQ66lBUQ0VMEuUGwJumSU3BbbHGejFmmSbHtSxmY1es3AY okMAA6dxbOLw6gfMVKsff4ZZ4FbOR2Ug14JwNuhWR7P88eXSWCj8q4ma27XA8pktjsNx IG4FUz+SQqI0v5jOaKp7L59ynr3F0rLyWj8iZnqz7GvnkAD3RoloFTD1B3RaT2f2KjHK BOBQ== X-Gm-Message-State: AOJu0Yzvrh9rbgyvGQ8PG52OEeU/3N/ih9WGEkjJu8oJrXeu2zH26ctp k1US7neIgcDR+RNNJdI2vKEqn4Fnt1xo8caTATBpDduQk0p9dbCMI1nB0TFMZozna5coEq7W/xv DmzQMMFNSCLAMWQnG5ecApQBv+1bql5wV+MAfImOfMs1HxOMe1kPlghwS3IEK X-Received: by 2002:a50:c012:0:b0:56d:f3f3:f61f with SMTP id 4fb4d7f45d1cf-5734d597da8mr16245195a12.9.1715845822491; Thu, 16 May 2024 00:50:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYZPRenyevZK17uMBS8bsoEnXxBn8+yBg0qSY2mIVDMqnalIbWHjpnzbCfar8a6aI+751nUA== X-Received: by 2002:a50:c012:0:b0:56d:f3f3:f61f with SMTP id 4fb4d7f45d1cf-5734d597da8mr16245164a12.9.1715845821703; Thu, 16 May 2024 00:50:21 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733c2b8f7fsm10098816a12.66.2024.05.16.00.50.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2024 00:50:20 -0700 (PDT) Date: Thu, 16 May 2024 09:49:47 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] util, tcp: Add helper to display socket addresses Message-ID: <20240516094947.07eaba40@elisabeth> In-Reply-To: References: <20240516052556.856811-1-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: PYVKMNUIQDXJU4K2ZZ4F2WCHNVQX3MID X-Message-ID-Hash: PYVKMNUIQDXJU4K2ZZ4F2WCHNVQX3MID 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, 16 May 2024 16:54:24 +1000 David Gibson wrote: > On Thu, May 16, 2024 at 03:25:56PM +1000, David Gibson wrote: > > When reporting errors, we sometimes want to show a relevant socket address. > > Doing so by extracting the various relevant fields can be pretty awkward, > > so introduce a sockaddr_ntop() helper to make it simpler. For now we just > > have one user in tcp.c, but I have further upcoming patches which can make > > use of it. > > Realised I had an off-by-one error in my calculation of the max buffer > size for this. Fixed version coming. While at it, I was also wondering: would it be reasonably feasible, without killing readability, to get inet_ntop() to write directly to the buffer? I haven't tried to do it though. -- Stefano