[Toybox] [PATCH] netcat: make -l exit after handling a request

Josh Gao jmgao at google.com
Fri Jun 30 12:17:43 PDT 2017


Updated the original patch to just jump to cleanup, instead of rearranging
things.

Also, polished up the proof of concept xgetaddrinfo (this needs a better
name)
patch, and used it to implement -4, -6 (plus another patch to do -u).

On Thu, Jun 29, 2017 at 6:59 PM, enh <enh at google.com> wrote:

> ping? various networking folks are looking to add tests that use
> netcat, and i'd rather start them off on toybox netcat rather than BSD
> and then have to move them across to toybox later. (obviously there's
> other missing stuff in toybox, but these patches are the only things
> they actually need right now.)
>
> On Wed, Jun 28, 2017 at 3:47 PM, Josh Gao <jmgao at google.com> wrote:
> > 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
> >
> > _______________________________________________
> > Toybox mailing list
> > Toybox at lists.landley.net
> > http://lists.landley.net/listinfo.cgi/toybox-landley.net
> >
>
>
>
> --
> Elliott Hughes - http://who/enh - http://jessies.org/~enh/
> Android native code/tools questions? Mail me/drop by/add me as a reviewer.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170630/07a0e8f5/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-xgetaddrinfo-use-it-in-netcat.patch
Type: text/x-patch
Size: 12039 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170630/07a0e8f5/attachment-0012.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-4-6-to-netcat.patch
Type: text/x-patch
Size: 1634 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170630/07a0e8f5/attachment-0013.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Add-UDP-support-to-netcat.patch
Type: text/x-patch
Size: 4123 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170630/07a0e8f5/attachment-0014.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-netcat-make-l-exit-after-handling-a-request.patch
Type: text/x-patch
Size: 979 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170630/07a0e8f5/attachment-0015.bin>


More information about the Toybox mailing list