Some folks here at the bakeoff have started using IPv6.  While actually
*supporting* IPv6 is probably a fair ways off for us, I'd like to at least
be able to handle them correctly in placs like URIs and Via headers.

The particular URI I ran into (in a Contact header) was:

<sip:ppessi@[3ffe::200:86ff:fe46:9616]:5066;maddr=[3ffe::200:86ff:fe46:9616]>

When we parsed it, we mangled it into

<sip:ppessi@[3ffe;maddr=%5B3ffe::200:86ff:fe46:9616%5D>

The URI-quoting in the parameter is easy enough to deal with.  (RFC 2732
moves the [] characters from 'unwise' to 'reserved', so they can go in
parameters when we're printing.)

The harder part is the mangling in the 'host' part of the URI.  What's
happening is that we're seeing the first : in the address, thinking it ends
the host and starts the port.  We then interpret ":200:86ff:fe46:9616]:5066"
as a port, and atoi returns 0 on it.

The way the syntax works, of course, the [] encloses the IPv6 address, and
it's terminated by the closing bracket.

I can't quite figure out the best way to add this to the Parse_URI
state machine in uri.c.  Somehow, I need to tell it that if you see a [
right after entering the 'host' state, then 'host' is terminated by ], not
by :.  (Though for robustness it should probably still be terminated by the
other things that end a host.)

Any thoughts?

-jonathan
 

_______________________________________________
Sip-implementors mailing list
[EMAIL PROTECTED]
http://lists.cs.columbia.edu/mailman/listinfo/sip-implementors

Reply via email to