Skip to content

Commit

Permalink
net/dns/resolver: don't forward DNS-SD queries
Browse files Browse the repository at this point in the history
Updates #2442
Fixes tailscale/corp#2820

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
  • Loading branch information
bradfitz committed Oct 7, 2021
1 parent 47044f3 commit 297d1b7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions net/dns/resolver/forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,21 @@ func (f *forwarder) forward(query packet) error {
return err
}

// Drop DNS service discovery spam, primarily for battery life
// on mobile. This is scoped to only Apple platforms, as
// that's where we see it. Things like Spotify on iOS
// generate this traffic, when browsing for LAN devices. But
// even when filtering this out, playing on Sonos still works.
//
// TODO(bradfitz): maybe after 1.16 is out, do it more broadly?
switch runtime.GOOS {
case "ios", "darwin":
if hasRDNSBonjourPrefix(domain) {
f.logf("[v1] dropping %q", domain)
return nil
}
}

clampEDNSSize(query.bs, maxResponseBytes)

resolvers := f.resolvers(domain)
Expand Down

0 comments on commit 297d1b7

Please sign in to comment.