[Libguestfs] [PATCH nbdkit] server: Remove useless thread local sockaddr.

Eric Blake eblake at redhat.com
Wed Sep 18 13:18:19 UTC 2019


On 9/18/19 4:08 AM, Richard W.M. Jones wrote:
> When accepting a connection on a TCP or Unix domain socket we recorded
> the peer address in both the thread_data struct and thread-local
> storage.  But for no reason because it was never used anywhere.  Since
> we were only allocating a ‘struct sockaddr’ (rather than a ‘struct
> sockaddr_storage’) it's likely that some peer addresses would have
> been truncated.
> 
> Remove all this code, it had no effect.

Indeed.  Looks good.

> 
> Plugins that want to get the peer address can use nbdkit_peer_name()
> which was added in commit 03a2cc3d766e and doesn't suffer from the
> above truncation problem.
> 
> (I considered an alternative where we use the saved address to answer
> nbdkit_peer_name but since that call will in general be used very
> rarely it doesn't make sense to do the extra work for all callers.)
> ---
>  server/internal.h    |  4 ----
>  server/sockets.c     | 12 ++----------
>  server/threadlocal.c | 19 -------------------
>  3 files changed, 2 insertions(+), 33 deletions(-)
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190918/f532d993/attachment.sig>


More information about the Libguestfs mailing list