<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jun 25, 2017 at 12:14 PM, Rob Landley <span dir="ltr"><<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
1) switching it to use xconnect() which it predates, and which is hard<br>
because the various users in tree all want slighty different things out<br>
of the getaddrinfo() plumbing and I've made a couple attempts to<br>
unify/genericize it but keep getting pulled alway by $DAYJOB crisis du<br>
jour halfway through and forgetting what design problem details I was<br>
halfway through solving and have to start over again...<br></blockquote><div><br></div><div><div>BTW, I took a quick look at this because we have users that want -4/-6 (and</div><div>IPv6 support in general). `nc -s` makes it so that you can't use xconnect</div><div>because you don't know what to bind to until after you've resolved the target</div><div>address. Something like xbind_and_connect might work, but there's also things</div><div>that we might want to do in between socket and bind (e.g. setting SO_REUSEADDR).</div><div><br></div><div>The thing that everyone really wants is a way to iterate over getaddrinfo results;</div><div>maybe that's what should be exposed? I have a rough proof of concept patch</div><div>attached that implements this and uses it in netcat.</div><div><br></div><div>(There's also another edge case with -s: what happens if the host you pass in</div><div>resolves to multiple addresses? OpenBSD's netcat seems to just bind the first</div><div>compatible address it resolves to, so we can maybe just ignore this.)</div></div><div><br></div><div>-Josh</div></div></div></div>