Issue with socket-wrapper socketpair()

Wouter Verhelst w at
Sat Apr 8 10:25:10 UTC 2023


Currently, the NBD[1] test suite starts nbd-server with a generated
configuration file, and then runs a special test client against that
server. This works great, except if you are already running nbd-server
on the machine where the test is run, in which case (obviously) the
tester client runs its tests against the wrong server and then things go

Someone pointed out cwrap to me a while ago, so I had a look at using
socket-wrapper to isolate nbd-server, and it works great! except for the
GnuTLS-using tests, and I *think* it's because of how the GnuTLS things
are implemented in the "test" client: rather than adding an abstraction
layer which directs a read or write to either a "plain" or a TLS-using
write, we instead call socketpair(), then fork(), and then on one end of
the socketpair we implement an encrypting/decrypting proxy. This keeps
the tester client straightforward (everything continues to use regular
reads and writes etc on a regular socket) and has no effect on the
software under test (it's not as efficient, but for a test suite, that's

However, it looks like this setup may not work correctly with
socket-wrapper. I see that my tester client, after a bit of back and
forth with the server which functions correctly, loses connectivity.
This is *not* immediately upon connection, only after a few messages
have been sent back and forth.

Does it seem likely to people here that this is a problem in
socket-wrapper, or should I be looking at something "odd" I'm doing

(if you want to try to reproduce: check out the git repository, ensure
that can be found through pkg-config, and run
"./configure; make check")



     w at uter.{be,}

I will have a Tin-Actinium-Potassium mixture, thanks.

More information about the samba-technical mailing list