Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brutella committed Oct 22, 2024
2 parents 1150e0d + ba39f3a commit 104764c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ func newMDNSConn(ifs ...string) (*mdnsConn, error) {
if err := connIPv4.SetMulticastLoopback(true); err != nil {
log.Debug.Println("IPv4 set multicast loopback:", err)
}
// Set TTL to 255 (rfc6762)
if err := connIPv4.SetTTL(255); err != nil {
log.Debug.Println("IPv4 set TTL:", err)
}
if err := connIPv4.SetMulticastTTL(255); err != nil {
log.Debug.Println("IPv4 set multicast TTL:", err)
}

for _, iface := range MulticastInterfaces(ifs...) {
if err := connIPv4.JoinGroup(iface, &net.UDPAddr{IP: IPv4LinkLocalMulticast}); err != nil {
Expand All @@ -201,7 +208,13 @@ func newMDNSConn(ifs ...string) (*mdnsConn, error) {
if err := connIPv6.SetMulticastLoopback(true); err != nil {
log.Debug.Println("IPv6 set multicast loopback:", err)
}

// Set TTL to 255 (rfc6762)
if err := connIPv6.SetHopLimit(255); err != nil {
log.Debug.Println("IPv4 set TTL:", err)
}
if err := connIPv6.SetMulticastHopLimit(255); err != nil {
log.Debug.Println("IPv4 set multicast TTL:", err)
}
for _, iface := range MulticastInterfaces(ifs...) {
if err := connIPv6.JoinGroup(iface, &net.UDPAddr{IP: IPv6LinkLocalMulticast}); err != nil {
log.Debug.Printf("Failed joining IPv6 %v: %v", iface.Name, err)
Expand Down

0 comments on commit 104764c

Please sign in to comment.