Skip to content

sip: Via parser loses IPv6 reference type information, causing invalid serialization without brackets #34

Description

@sinclairday

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions