commit fa32a75741dba59c89d92757937ef9039129dea1
parent 96a874b067dad9a5704171d9c63a5594b6d42e3d
Author: Jacob Hitchins <44385069+jacobhitchins@users.noreply.github.com>
Date: Sun, 11 Aug 2024 13:46:08 +1000
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.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sdp/sdp.go b/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 {