Actually, no, I don't think that will work after all - in an address like [fe80::1]:1234
the + sp = strchr(str, ':'); + if (sp != NULL) { + if (strchr(sp + 1, ':') != NULL) { code is going to happen, and set the port to 0 (instead of the intended 1234) - it needs to ignore :'s inside [] the way the old code was doing - one way to do that might be if (sp2 = strchr(str, ']')) sp2++; else sp2 = str; sp = strchr(sp2, ':'); if (sp != NULL) { /* etc as it is in your patch */ That's very very very crude, but I think will do the right thing for valid addresses. kre