<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><br></div></div></div>
<br><div class="gmail_quote">On Wed, Oct 28, 2015 at 10:55 AM, Poul-Henning Kamp <span dir="ltr"><<a href="mailto:phk@phk.freebsd.dk" target="_blank">phk@phk.freebsd.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">--------<br>
In message <CAJ6ZYQwjqhjpcXEV9ef2-cX4B3MdcgCSKL15EZOkpZR=zbYP=<a href="mailto:Q@mail.gmail.com">Q@mail.gmail.com</a>><br>
<span class="">, Guillaume Quintard writes:<br>
<br>
>I'm in favor of mandatory brackets for IPv6, but would this do ?<br>
>- first char is [: it's IPv6<br>
>- if you find a letter or colon: it's IPv6<br>
<br>
</span>Remember that it is not just numeric formats.<br>
<br>
In general this is about what we pass to the two fields of getaddrinfo(3),<br>
we don't convert to IP#s ourselves.<br>
<div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>Ah, my bad, then there's the question of how much error types we want to raise (vss_parse catches some of them, but far from all), because it could be as simple as:</div><div><br></div><div>- find first colon (fc)</div><div>- find last colon (lc)</div><div>fc == lc => ipv4 with port</div><div>fc != lc<br>    *(lc - 1) == ']' => IPv6 with port (and check the first char is indeed '[')<br>    else IPv6 without port<br><br class="">-- <br></div><div>Guillaume Quintard </div></div><br></div></div>