net/tstun,wgengine/{.,netstack}: handle UDP magicDNS traffic in netstack

This change wires netstack with a hook for traffic coming from the host
into the tun, allowing interception and handling of traffic to quad-100.

With this hook wired, magicDNS queries over UDP are now handled within
netstack. The existing logic in wgengine to handle magicDNS remains for now,
but its hook operates after the netstack hook so the netstack implementation
takes precedence. This is done in case we need to support platforms with
netstack longer than expected.

Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
Tom DNetto
2022-04-14 15:17:26 -07:00
committed by Tom
parent dc71d3559f
commit 9e77660931
5 changed files with 156 additions and 29 deletions

View File

@ -39,12 +39,12 @@ func TestInjectInboundLeak(t *testing.T) {
if !ok {
t.Fatal("not an InternalsGetter")
}
tunWrap, magicSock, ok := ig.GetInternals()
tunWrap, magicSock, d, ok := ig.GetInternals()
if !ok {
t.Fatal("failed to get internals")
}
ns, err := Create(logf, tunWrap, eng, magicSock, dialer)
ns, err := Create(logf, tunWrap, eng, magicSock, dialer, d)
if err != nil {
t.Fatal(err)
}