I would take a look at the underlying components of glibc's
getnameinfo(), which must parse IPv6 addresses according to POSIX
specifications, IIRC.
Comments:
1) bracket escaping seems reasonably common. browsers and other apps
sometimes use that convention too.
2) an interface name rather than index should be used
Jeff
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html