mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
wgengine/tstun: reply to MagicDNS pings
Fixes #849
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 917307a90c
)
This commit is contained in:
parent
90c249cf26
commit
31f2cd9e45
@ -215,7 +215,17 @@ func (t *TUN) poll() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var magicDNSIPPort = netaddr.MustParseIPPort("100.100.100.100:0")
|
||||||
|
|
||||||
func (t *TUN) filterOut(p *packet.Parsed) filter.Response {
|
func (t *TUN) filterOut(p *packet.Parsed) filter.Response {
|
||||||
|
// Fake ICMP echo responses to MagicDNS (100.100.100.100).
|
||||||
|
if p.IsEchoRequest() && p.Dst == magicDNSIPPort {
|
||||||
|
header := p.ICMP4Header()
|
||||||
|
header.ToResponse()
|
||||||
|
outp := packet.Generate(&header, p.Payload())
|
||||||
|
t.InjectInboundCopy(outp)
|
||||||
|
return filter.DropSilently // don't pass on to OS; already handled
|
||||||
|
}
|
||||||
|
|
||||||
if t.PreFilterOut != nil {
|
if t.PreFilterOut != nil {
|
||||||
if res := t.PreFilterOut(p, t); res.IsDrop() {
|
if res := t.PreFilterOut(p, t); res.IsDrop() {
|
||||||
|
Loading…
Reference in New Issue
Block a user