From 0226690a9b95ddafc72225f9c74cded1d72f12f5 Mon Sep 17 00:00:00 2001 From: Daniel Kucera Date: Wed, 18 Aug 2021 07:56:39 +0200 Subject: [PATCH] net: Listen on specified multicast address Fixes #34728 --- src/net/sock_posix.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/net/sock_posix.go b/src/net/sock_posix.go index 9b1e7880aed..64645c4ac7c 100644 --- a/src/net/sock_posix.go +++ b/src/net/sock_posix.go @@ -208,25 +208,10 @@ func (fd *netFD) listenStream(laddr sockaddr, backlog int, ctrlFn func(string, s func (fd *netFD) listenDatagram(laddr sockaddr, ctrlFn func(string, string, syscall.RawConn) error) error { switch addr := laddr.(type) { case *UDPAddr: - // We provide a socket that listens to a wildcard - // address with reusable UDP port when the given laddr - // is an appropriate UDP multicast address prefix. - // This makes it possible for a single UDP listener to - // join multiple different group addresses, for - // multiple UDP listeners that listen on the same UDP - // port to join the same group address. if addr.IP != nil && addr.IP.IsMulticast() { if err := setDefaultMulticastSockopts(fd.pfd.Sysfd); err != nil { return err } - addr := *addr - switch fd.family { - case syscall.AF_INET: - addr.IP = IPv4zero - case syscall.AF_INET6: - addr.IP = IPv6unspecified - } - laddr = &addr } } var err error