wgengine/magicsoc,net/tstun: put disco key advertisement behind a nob (#18857)
To be less spammy in stable, add a nob that disables the creation and processing of TSMPDiscoKeyAdvertisements until we have a proper rollout mechanism. Updates #12639 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
+7
-4
@@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/tailscale/wireguard-go/tun"
|
"github.com/tailscale/wireguard-go/tun"
|
||||||
"go4.org/mem"
|
"go4.org/mem"
|
||||||
"tailscale.com/disco"
|
"tailscale.com/disco"
|
||||||
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/feature/buildfeatures"
|
"tailscale.com/feature/buildfeatures"
|
||||||
"tailscale.com/net/packet"
|
"tailscale.com/net/packet"
|
||||||
"tailscale.com/net/packet/checksum"
|
"tailscale.com/net/packet/checksum"
|
||||||
@@ -1157,10 +1158,12 @@ func (t *Wrapper) filterPacketInboundFromWireGuard(p *packet.Parsed, captHook pa
|
|||||||
t.injectOutboundPong(p, pingReq)
|
t.injectOutboundPong(p, pingReq)
|
||||||
return filter.DropSilently, gro
|
return filter.DropSilently, gro
|
||||||
} else if discoKeyAdvert, ok := p.AsTSMPDiscoAdvertisement(); ok {
|
} else if discoKeyAdvert, ok := p.AsTSMPDiscoAdvertisement(); ok {
|
||||||
t.discoKeyAdvertisementPub.Publish(DiscoKeyAdvertisement{
|
if buildfeatures.HasCacheNetMap && envknob.Bool("TS_USE_CACHED_NETMAP") {
|
||||||
Src: discoKeyAdvert.Src,
|
t.discoKeyAdvertisementPub.Publish(DiscoKeyAdvertisement{
|
||||||
Key: discoKeyAdvert.Key,
|
Src: discoKeyAdvert.Src,
|
||||||
})
|
Key: discoKeyAdvert.Key,
|
||||||
|
})
|
||||||
|
}
|
||||||
return filter.DropSilently, gro
|
return filter.DropSilently, gro
|
||||||
} else if data, ok := p.AsTSMPPong(); ok {
|
} else if data, ok := p.AsTSMPPong(); ok {
|
||||||
if f := t.OnTSMPPongReceived; f != nil {
|
if f := t.OnTSMPPongReceived; f != nil {
|
||||||
|
|||||||
@@ -4309,6 +4309,10 @@ type NewDiscoKeyAvailable struct {
|
|||||||
//
|
//
|
||||||
// We do not need the Conn to be locked, but the endpoint should be.
|
// We do not need the Conn to be locked, but the endpoint should be.
|
||||||
func (c *Conn) maybeSendTSMPDiscoAdvert(de *endpoint) {
|
func (c *Conn) maybeSendTSMPDiscoAdvert(de *endpoint) {
|
||||||
|
if !buildfeatures.HasCacheNetMap || !envknob.Bool("TS_USE_CACHED_NETMAP") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
de.mu.Lock()
|
de.mu.Lock()
|
||||||
defer de.mu.Unlock()
|
defer de.mu.Unlock()
|
||||||
if !de.sentDiscoKeyAdvertisement {
|
if !de.sentDiscoKeyAdvertisement {
|
||||||
|
|||||||
Reference in New Issue
Block a user