I've been running a SIP registrar built on top of gosip. Recently, a bit by accident and because IPv6 is becoming more central in its world, I stumbled over some problems with gosip's IPv6 support.
From what I see, ParseMsg correctly accepts bracketed IPv6 in Via sent-by, but appears to store only the raw host text in via.Host struct, discarding the fact that the host was parsed as an IPv6 reference.
On serialization, Via is then emitted as host:port without re-bracketing, producing invalid SIP such as Via: SIP/2.0/UDP 2001:db8::1:5060;branch=....
It looks like to me that the underlying issue is loss of host-type information in the internal Via representation.
-
Via.Host is currently modeled as an untyped string
-
this loses whether the parsed sent-by host was FQDN, IPv4, or bracketed IPv6
-
because IPv6 requires different wire rendering, this representation is not sufficient for correct round-tripping
-
Via should preserve host kind explicitly in its AST/data model
I've been running a SIP registrar built on top of gosip. Recently, a bit by accident and because IPv6 is becoming more central in its world, I stumbled over some problems with gosip's IPv6 support.
From what I see,
ParseMsgcorrectly accepts bracketed IPv6 inVia sent-by, but appears to store only the raw host text invia.Hoststruct, discarding the fact that the host was parsed as an IPv6 reference.On serialization,
Viais then emitted as host:port without re-bracketing, producing invalid SIP such asVia: SIP/2.0/UDP 2001:db8::1:5060;branch=....It looks like to me that the underlying issue is loss of host-type information in the internal
Viarepresentation.Via.Hostis currently modeled as an untyped stringthis loses whether the parsed sent-by host was FQDN, IPv4, or bracketed IPv6
because IPv6 requires different wire rendering, this representation is not sufficient for correct round-tripping
Viashould preserve host kind explicitly in its AST/data model