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

Fix client multicast sending on Windows #81

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,21 @@ func (c *client) sendQuery(msg *dns.Msg) error {
return err
}
if c.ipv4conn != nil {
var wcm ipv4.ControlMessage
for ifi := range c.ifaces {
wcm.IfIndex = c.ifaces[ifi].Index
c.ipv4conn.WriteTo(buf, &wcm, ipv4Addr)
if err := c.ipv4conn.SetMulticastInterface(&c.ifaces[ifi]); err != nil {
// log.Printf("[WARN] mdns: Failed to set multicast interface: %v", err)
continue
}
c.ipv4conn.WriteTo(buf, nil, ipv4Addr)
}
}
if c.ipv6conn != nil {
var wcm ipv6.ControlMessage
for ifi := range c.ifaces {
wcm.IfIndex = c.ifaces[ifi].Index
c.ipv6conn.WriteTo(buf, &wcm, ipv6Addr)
if err := c.ipv6conn.SetMulticastInterface(&c.ifaces[ifi]); err != nil {
// log.Printf("[WARN] mdns: Failed to set multicast interface: %v", err)
continue
}
c.ipv6conn.WriteTo(buf, nil, ipv6Addr)
}
}
return nil
Expand Down