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