There doesn't appear to be a way to read multicast packets not destined for the local host when using net.PacketConn.
I'm trying to use x/net/ipv6
as follows:
var c net.PacketConn
c, err = net.ListenPacket("ip6:ipv6-icmp", ifaceIP.String())
...
p := ipv6.NewPacketConn(c)
err = p.SetControlMessage(ipv6.FlagSrc|ipv6.FlagDst, true)
...
var f ipv6.ICMPFilter
f.SetAll(true)
f.Accept(ipv6.ICMPTypeNeighborSolicitation)
f.Accept(ipv6.ICMPTypeNeighborAdvertisement)
err = p.SetICMPFilter(&f)
...
payload := make([]byte, snaplen)
i, rcm, src, err := p.ReadFrom(payload)
...
I would like to read, for example, IPv6 neighbor solicitations where the destination solicited-node multicast address does not belong to the local host.
Can this be done with the standard lib (i.e. not using pcap library)?