Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to tune the TTL? #31

Closed
mharbison72 opened this issue May 9, 2023 · 4 comments · Fixed by #39
Closed

Add ability to tune the TTL? #31

mharbison72 opened this issue May 9, 2023 · 4 comments · Fixed by #39

Comments

@mharbison72
Copy link

I don't see any way to set the TTL on the connection from outside of this module. The spec[1] says the default value should be 2 for everything except M-SEARCH response, but I don't see SetTTL() from ipv4.PacketConn called at all.

[1] https://openconnectivity.org/upnp-specs/UPnP-arch-DeviceArchitecture-v2.0-20200417.pdf

@koron
Copy link
Owner

koron commented Oct 17, 2023

for future implementation: https://pkg.go.dev/golang.org/x/net/ipv4#PacketConn.SetTTL

from https://openconnectivity.org/upnp-specs/UPnP-arch-DeviceArchitecture-v2.0-20200417.pdf

To limit network congestion, the time-to-live (TTL) of each IP packet for each multicast
message should default to 2 and should be configurable.

  • pp.20 - 1 Discovery

The TTL for the IP packet should default to 2 and should be configurable.

  • pp.27 - 1.2.2 Device available - NOTIFY with ssdp:alive
  • pp.31 - 1.2.3 Device unavailable -- NOTIFY with ssdp:byebye
  • pp.33 - 1.2.4 Device Update – NOTIFY with ssdp:update
  • pp.35 - 1.3.2 Search request with M-SEARCH

No need to limit TTL for the IP packet in response to a search request.

  • pp.40 - 1.3.3 Search response

Lastly, like SSDP, to limit network congestion, the time-to-live (TTL) of each IP packet for each multicast message should default to 2 and should be configurable. This should be the same value as that used in SSDP. When the TTL is greater than 1, it is possible for multicast messages to traverse multiple routers; therefore control points and devices using non-AutoIP addresses shall send an IGMP Join message so that routers will forward multicast messages to them (this is not necessary when using an Auto-IP address since packets with Auto-IP addresses will not be forwarded by routers).

  • pp.99 - 4.2 Multicast Eventing

@koron
Copy link
Owner

koron commented Oct 17, 2023

TTL is not mentioned in https://datatracker.ietf.org/doc/html/draft-cai-ssdp-v1-03 which this package referenced.

@koron
Copy link
Owner

koron commented Oct 17, 2023

It looks like reasonable that make default TTL is 2 and configurable.

@koron
Copy link
Owner

koron commented Oct 21, 2023

func TTL(ttl int) Option can be used for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants