[Toybox] [PATCH] netcat: make -l exit after handling a request
Josh Gao
jmgao at google.com
Wed Jun 28 15:47:30 PDT 2017
On Sun, Jun 25, 2017 at 12:14 PM, Rob Landley <rob at landley.net> wrote:
>
> 1) switching it to use xconnect() which it predates, and which is hard
> because the various users in tree all want slighty different things out
> of the getaddrinfo() plumbing and I've made a couple attempts to
> unify/genericize it but keep getting pulled alway by $DAYJOB crisis du
> jour halfway through and forgetting what design problem details I was
> halfway through solving and have to start over again...
>
BTW, I took a quick look at this because we have users that want -4/-6 (and
IPv6 support in general). `nc -s` makes it so that you can't use xconnect
because you don't know what to bind to until after you've resolved the
target
address. Something like xbind_and_connect might work, but there's also
things
that we might want to do in between socket and bind (e.g. setting
SO_REUSEADDR).
The thing that everyone really wants is a way to iterate over getaddrinfo
results;
maybe that's what should be exposed? I have a rough proof of concept patch
attached that implements this and uses it in netcat.
(There's also another edge case with -s: what happens if the host you pass
in
resolves to multiple addresses? OpenBSD's netcat seems to just bind the
first
compatible address it resolves to, so we can maybe just ignore this.)
-Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170628/ce9e49bc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-xgetaddrinfo-use-it-in-netcat.patch
Type: text/x-patch
Size: 11927 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170628/ce9e49bc/attachment.bin>
More information about the Toybox
mailing list