commit fa32a75741dba59c89d92757937ef9039129dea1 from: Jacob Hitchins <44385069+jacobhitchins@users.noreply.github.com> via: Oliver Lowe date: Sun Aug 11 06:34:45 2024 UTC sdp: only apply TTL field to ipv4 connections As per section 5.7 of RFC 8866: "IP6" multicast does not use TTL scoping, and hence the TTL value MUST NOT be present for "IP6" multicast. Amends comment to clarify it only applies to IPv4 packets. commit - 96a874b067dad9a5704171d9c63a5594b6d42e3d commit + fa32a75741dba59c89d92757937ef9039129dea1 blob - a80d57737405406ce3d79c7ec9bb6dc5fc4787ca blob + 6031e234406a2f1fae937eec38a27f50b6436e6e --- sdp/sdp.go +++ sdp/sdp.go @@ -309,7 +309,7 @@ func parseMedia(s string) (Media, error) { // ConnInfo represents connection information. type ConnInfo struct { Address netip.Addr - // TTL is the time-to-live of multicast packets. + // TTL is the time-to-live of IPv4 multicast packets. TTL uint8 // Count is the number of subsequent IP addresses after // Address used in the session. @@ -322,7 +322,7 @@ func (c *ConnInfo) String() string { ipv = "IP4" } s := fmt.Sprintf("c=%s %s %s", "IN", ipv, c.Address) - if c.TTL > 0 { + if c.Address.Is4() && c.TTL > 0 { s += fmt.Sprintf("/%d", c.TTL) } if c.Count > 0 {