From 95f4ec52a40ad1e8d3d1c72d80dd50dbbb8553ce Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 3 May 2020 05:06:59 -0500 Subject: [PATCH] save only the link-local addresses for multicast --- src/multicast/multicast.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/multicast/multicast.go b/src/multicast/multicast.go index aaa21151..fc7b1373 100644 --- a/src/multicast/multicast.go +++ b/src/multicast/multicast.go @@ -292,15 +292,15 @@ func (m *Multicast) _updateInterfaces() { aInfo.addrs, _ = iface.Addrs() aInfo.time = time.Now() } - hasLLAddr := false + lladdrs := aInfo.addrs[:0] for _, addr := range aInfo.addrs { addrIP, _, _ := net.ParseCIDR(addr.String()) if addrIP.To4() == nil && addrIP.IsLinkLocalUnicast() { - hasLLAddr = true - break + lladdrs = append(lladdrs, addr) } } - if !hasLLAddr { + aInfo.addrs = lladdrs + if len(lladdrs) == 0 { // Ignore interfaces without link-local addresses continue }