From 3d345d37487c8fe141ffbb473ef50cc46b46f491 Mon Sep 17 00:00:00 2001 From: cthuang Date: Tue, 20 Sep 2022 09:01:35 +0100 Subject: [PATCH] TUN-6595: Enable datagramv2 and icmp proxy by default --- cmd/cloudflared/tunnel/configuration.go | 2 +- supervisor/supervisor.go | 26 ++++++------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/cmd/cloudflared/tunnel/configuration.go b/cmd/cloudflared/tunnel/configuration.go index f8930357..ef9a7e28 100644 --- a/cmd/cloudflared/tunnel/configuration.go +++ b/cmd/cloudflared/tunnel/configuration.go @@ -44,7 +44,7 @@ var ( LogFieldHostname = "hostname" secretFlags = [2]*altsrc.StringFlag{credentialsContentsFlag, tunnelTokenFlag} - defaultFeatures = []string{supervisor.FeatureAllowRemoteConfig, supervisor.FeatureSerializedHeaders} + defaultFeatures = []string{supervisor.FeatureAllowRemoteConfig, supervisor.FeatureSerializedHeaders, supervisor.FeatureDatagramV2} configFlags = []string{"autoupdate-freq", "no-autoupdate", "retries", "protocol", "loglevel", "transport-loglevel", "origincert", "metrics", "metrics-update-freq", "edge-ip-version"} ) diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go index 252a532c..04f5536e 100644 --- a/supervisor/supervisor.go +++ b/supervisor/supervisor.go @@ -116,14 +116,12 @@ func NewSupervisor(config *TunnelConfig, orchestrator *orchestration.Orchestrato gracefulShutdownC: gracefulShutdownC, connAwareLogger: log, } - if useDatagramV2(config) { - // TODO: TUN-6701: Decouple upgrade of datagram v2 and using icmp proxy - icmpRouter, err := ingress.NewICMPRouter(config.Log) - if err != nil { - log.Logger().Warn().Err(err).Msg("Failed to create icmp router, will continue to use datagram v1") - } else { - edgeTunnelServer.icmpRouter = icmpRouter - } + + icmpRouter, err := ingress.NewICMPRouter(config.Log) + if err != nil { + log.Logger().Warn().Err(err).Msg("Failed to create icmp router, ICMP proxy feature is disabled") + } else { + edgeTunnelServer.icmpRouter = icmpRouter } useReconnectToken := false @@ -435,15 +433,3 @@ func (s *Supervisor) authenticate(ctx context.Context, numPreviousAttempts int) registrationOptions.NumPreviousAttempts = uint8(numPreviousAttempts) return rpcClient.Authenticate(ctx, s.config.ClassicTunnel, registrationOptions) } - -func useDatagramV2(config *TunnelConfig) bool { - if config.NamedTunnel == nil { - return false - } - for _, feature := range config.NamedTunnel.Client.Features { - if feature == FeatureDatagramV2 { - return true - } - } - return false -}