Skip to content

Commit

Permalink
mobile: resolving how forcev6 works on mobile platforms
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk committed Oct 22, 2024
1 parent f6a84d8 commit 9f714f5
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 124 deletions.
6 changes: 0 additions & 6 deletions mobile/library/cc/engine_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,6 @@ EngineBuilder& EngineBuilder::setNumTimeoutsToTriggerPortMigration(int num_timeo
return *this;
}

EngineBuilder& EngineBuilder::setForceAlwaysUsev6(bool value) {
always_use_v6_ = value;
return *this;
}

EngineBuilder& EngineBuilder::enableInterfaceBinding(bool interface_binding_on) {
enable_interface_binding_ = interface_binding_on;
return *this;
Expand Down Expand Up @@ -862,7 +857,6 @@ std::unique_ptr<envoy::config::bootstrap::v3::Bootstrap> EngineBuilder::generate
(*reloadable_features.mutable_fields())[guard_and_value.first].set_bool_value(
guard_and_value.second);
}
(*reloadable_features.mutable_fields())["always_use_v6"].set_bool_value(always_use_v6_);
(*reloadable_features.mutable_fields())["prefer_quic_client_udp_gro"].set_bool_value(
use_gro_if_available_);
ProtobufWkt::Struct& restart_features =
Expand Down
2 changes: 0 additions & 2 deletions mobile/library/cc/engine_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class EngineBuilder {
EngineBuilder& enablePlatformCertificatesValidation(bool platform_certificates_validation_on);

EngineBuilder& enableDnsCache(bool dns_cache_on, int save_interval_seconds = 1);
EngineBuilder& setForceAlwaysUsev6(bool value);
// Adds the hostnames that should be pre-resolved by DNS prior to the first request issued for
// that host. When invoked, any previous preresolve hostname entries get cleared and only the ones
// provided in the hostnames argument get set.
Expand Down Expand Up @@ -184,7 +183,6 @@ class EngineBuilder {
std::vector<std::pair<std::string, int>> quic_hints_;
std::vector<std::string> quic_suffixes_;
int num_timeouts_to_trigger_port_migration_ = 0;
bool always_use_v6_ = false;
#if defined(__APPLE__)
// TODO(abeyad): once stable, consider setting the default to true.
bool respect_system_proxy_settings_ = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public enum TrustChainVerification {
public final boolean enableHttp3;
public final boolean useCares;
public final List<Pair<String, String>> caresFallbackResolvers;
public final boolean forceV6;
public final boolean useGro;
public final String http3ConnectionOptions;
public final String http3ClientConnectionOptions;
Expand Down Expand Up @@ -93,7 +92,6 @@ public enum TrustChainVerification {
* @param enableHttp3 whether to enable experimental support for
* HTTP/3 (QUIC).
* @param useCares whether to use the c_ares library for DNS
* @param forceV6 whether to map v4 address to v6
* @param useGro whether to use UDP GRO on upstream QUIC
* connections, if available.
* @param http3ConnectionOptions connection options to be used in HTTP/3.
Expand Down Expand Up @@ -140,14 +138,14 @@ public EnvoyConfiguration(
int dnsFailureRefreshSecondsMax, int dnsQueryTimeoutSeconds, int dnsMinRefreshSeconds,
List<String> dnsPreresolveHostnames, boolean enableDNSCache, int dnsCacheSaveIntervalSeconds,
int dnsNumRetries, boolean enableDrainPostDnsRefresh, boolean enableHttp3, boolean useCares,
boolean forceV6, boolean useGro, String http3ConnectionOptions,
String http3ClientConnectionOptions, Map<String, Integer> quicHints,
List<String> quicCanonicalSuffixes, boolean enableGzipDecompression,
boolean enableBrotliDecompression, int numTimeoutsToTriggerPortMigration,
boolean enableSocketTagging, boolean enableInterfaceBinding,
int h2ConnectionKeepaliveIdleIntervalMilliseconds, int h2ConnectionKeepaliveTimeoutSeconds,
int maxConnectionsPerHost, int streamIdleTimeoutSeconds, int perTryIdleTimeoutSeconds,
String appVersion, String appId, TrustChainVerification trustChainVerification,
boolean useGro, String http3ConnectionOptions, String http3ClientConnectionOptions,
Map<String, Integer> quicHints, List<String> quicCanonicalSuffixes,
boolean enableGzipDecompression, boolean enableBrotliDecompression,
int numTimeoutsToTriggerPortMigration, boolean enableSocketTagging,
boolean enableInterfaceBinding, int h2ConnectionKeepaliveIdleIntervalMilliseconds,
int h2ConnectionKeepaliveTimeoutSeconds, int maxConnectionsPerHost,
int streamIdleTimeoutSeconds, int perTryIdleTimeoutSeconds, String appVersion, String appId,
TrustChainVerification trustChainVerification,
List<EnvoyNativeFilterConfig> nativeFilterChain,
List<EnvoyHTTPFilterFactory> httpPlatformFilterFactories,
Map<String, EnvoyStringAccessor> stringAccessors,
Expand All @@ -174,7 +172,6 @@ public EnvoyConfiguration(
this.caresFallbackResolvers.add(
new Pair<String, String>(hostAndPort.first, String.valueOf(hostAndPort.second)));
}
this.forceV6 = forceV6;
this.useGro = useGro;
this.http3ConnectionOptions = http3ConnectionOptions;
this.http3ClientConnectionOptions = http3ClientConnectionOptions;
Expand Down Expand Up @@ -239,13 +236,13 @@ public long createBootstrap() {
connectTimeoutSeconds, dnsRefreshSeconds, dnsFailureRefreshSecondsBase,
dnsFailureRefreshSecondsMax, dnsQueryTimeoutSeconds, dnsMinRefreshSeconds, dnsPreresolve,
enableDNSCache, dnsCacheSaveIntervalSeconds, dnsNumRetries, enableDrainPostDnsRefresh,
enableHttp3, useCares, forceV6, useGro, http3ConnectionOptions,
http3ClientConnectionOptions, quicHints, quicSuffixes, enableGzipDecompression,
enableBrotliDecompression, numTimeoutsToTriggerPortMigration, enableSocketTagging,
enableInterfaceBinding, h2ConnectionKeepaliveIdleIntervalMilliseconds,
h2ConnectionKeepaliveTimeoutSeconds, maxConnectionsPerHost, streamIdleTimeoutSeconds,
perTryIdleTimeoutSeconds, appVersion, appId, enforceTrustChainVerification, filterChain,
enablePlatformCertificatesValidation, upstreamTlsSni, runtimeGuards, caresFallbackResolvers,
enableHttp3, useCares, useGro, http3ConnectionOptions, http3ClientConnectionOptions,
quicHints, quicSuffixes, enableGzipDecompression, enableBrotliDecompression,
numTimeoutsToTriggerPortMigration, enableSocketTagging, enableInterfaceBinding,
h2ConnectionKeepaliveIdleIntervalMilliseconds, h2ConnectionKeepaliveTimeoutSeconds,
maxConnectionsPerHost, streamIdleTimeoutSeconds, perTryIdleTimeoutSeconds, appVersion,
appId, enforceTrustChainVerification, filterChain, enablePlatformCertificatesValidation,
upstreamTlsSni, runtimeGuards, caresFallbackResolvers,
h3ConnectionKeepaliveInitialIntervalMilliseconds);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,13 @@ public static native long createBootstrap(
long dnsFailureRefreshSecondsMax, long dnsQueryTimeoutSeconds, long dnsMinRefreshSeconds,
byte[][] dnsPreresolveHostnames, boolean enableDNSCache, long dnsCacheSaveIntervalSeconds,
int dnsNumRetries, boolean enableDrainPostDnsRefresh, boolean enableHttp3, boolean useCares,
boolean forceV6, boolean useGro, String http3ConnectionOptions,
String http3ClientConnectionOptions, byte[][] quicHints, byte[][] quicCanonicalSuffixes,
boolean enableGzipDecompression, boolean enableBrotliDecompression,
int numTimeoutsToTriggerPortMigration, boolean enableSocketTagging,
boolean enableInterfaceBinding, long h2ConnectionKeepaliveIdleIntervalMilliseconds,
long h2ConnectionKeepaliveTimeoutSeconds, long maxConnectionsPerHost,
long streamIdleTimeoutSeconds, long perTryIdleTimeoutSeconds, String appVersion, String appId,
boolean trustChainVerification, byte[][] filterChain,
boolean useGro, String http3ConnectionOptions, String http3ClientConnectionOptions,
byte[][] quicHints, byte[][] quicCanonicalSuffixes, boolean enableGzipDecompression,
boolean enableBrotliDecompression, int numTimeoutsToTriggerPortMigration,
boolean enableSocketTagging, boolean enableInterfaceBinding,
long h2ConnectionKeepaliveIdleIntervalMilliseconds, long h2ConnectionKeepaliveTimeoutSeconds,
long maxConnectionsPerHost, long streamIdleTimeoutSeconds, long perTryIdleTimeoutSeconds,
String appVersion, String appId, boolean trustChainVerification, byte[][] filterChain,
boolean enablePlatformCertificatesValidation, String upstreamTlsSni, byte[][] runtimeGuards,
byte[][] cares_fallback_resolvers, long h3ConnectionKeepaliveInitialIntervalMilliseconds);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public class NativeCronvoyEngineBuilderImpl extends CronvoyEngineBuilderImpl {
private final boolean mEnableDnsFilterUnroutableFamilies = true;
private boolean mUseCares = false;
private final List<Pair<String, Integer>> mCaresFallbackResolvers = new ArrayList<>();
private boolean mForceV6 = true;
private boolean mUseGro = false;
private boolean mEnableDrainPostDnsRefresh = false;
private final boolean mEnableGzipDecompression = true;
Expand Down Expand Up @@ -112,16 +111,6 @@ public NativeCronvoyEngineBuilderImpl addCaresFallbackResolver(String host, int
return this;
}

/**
* Set whether to map v4 address to v6.
*
* @param enable If true, map v4 address to v6.
*/
public NativeCronvoyEngineBuilderImpl setForceV6(boolean enable) {
mForceV6 = enable;
return this;
}

/**
* Specify whether to use UDP GRO for upstream QUIC/HTTP3 sockets, if GRO is available on the
* system.
Expand Down Expand Up @@ -301,8 +290,8 @@ private EnvoyConfiguration createEnvoyConfiguration() {
mConnectTimeoutSeconds, mDnsRefreshSeconds, mDnsFailureRefreshSecondsBase,
mDnsFailureRefreshSecondsMax, mDnsQueryTimeoutSeconds, mDnsMinRefreshSeconds,
mDnsPreresolveHostnames, mEnableDNSCache, mDnsCacheSaveIntervalSeconds,
mDnsNumRetries.orElse(-1), mEnableDrainPostDnsRefresh, quicEnabled(), mUseCares, mForceV6,
mUseGro, quicConnectionOptions(), quicClientConnectionOptions(), quicHints(),
mDnsNumRetries.orElse(-1), mEnableDrainPostDnsRefresh, quicEnabled(), mUseCares, mUseGro,
quicConnectionOptions(), quicClientConnectionOptions(), quicHints(),
quicCanonicalSuffixes(), mEnableGzipDecompression, brotliEnabled(),
numTimeoutsToTriggerPortMigration(), mEnableSocketTag, mEnableInterfaceBinding,
mH2ConnectionKeepaliveIdleIntervalMilliseconds, mH2ConnectionKeepaliveTimeoutSeconds,
Expand Down
28 changes: 12 additions & 16 deletions mobile/library/jni/jni_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1218,11 +1218,10 @@ void configureBuilder(Envoy::JNI::JniHelper& jni_helper, jlong connect_timeout_s
jlong dns_min_refresh_seconds, jobjectArray dns_preresolve_hostnames,
jboolean enable_dns_cache, jlong dns_cache_save_interval_seconds,
jint dns_num_retries, jboolean enable_drain_post_dns_refresh,
jboolean enable_http3, jboolean use_cares, jboolean force_v6,
jboolean use_gro, jstring http3_connection_options,
jstring http3_client_connection_options, jobjectArray quic_hints,
jobjectArray quic_canonical_suffixes, jboolean enable_gzip_decompression,
jboolean enable_brotli_decompression,
jboolean enable_http3, jboolean use_cares, jboolean use_gro,
jstring http3_connection_options, jstring http3_client_connection_options,
jobjectArray quic_hints, jobjectArray quic_canonical_suffixes,
jboolean enable_gzip_decompression, jboolean enable_brotli_decompression,
jlong num_timeouts_to_trigger_port_migration, jboolean enable_socket_tagging,
jboolean enable_interface_binding,
jlong h2_connection_keepalive_idle_interval_milliseconds,
Expand Down Expand Up @@ -1286,7 +1285,6 @@ void configureBuilder(Envoy::JNI::JniHelper& jni_helper, jlong connect_timeout_s
builder.enforceTrustChainVerification(trust_chain_verification == JNI_TRUE);
builder.enablePlatformCertificatesValidation(enable_platform_certificates_validation == JNI_TRUE);
builder.setUpstreamTlsSni(Envoy::JNI::javaStringToCppString(jni_helper, upstream_tls_sni));
builder.setForceAlwaysUsev6(force_v6 == JNI_TRUE);
builder.setKeepAliveInitialIntervalMilliseconds(
(h3_connection_keepalive_initial_interval_milliseconds));

Expand Down Expand Up @@ -1327,12 +1325,11 @@ extern "C" JNIEXPORT jlong JNICALL Java_io_envoyproxy_envoymobile_engine_JniLibr
jobjectArray dns_preresolve_hostnames, jboolean enable_dns_cache,
jlong dns_cache_save_interval_seconds, jint dns_num_retries,
jboolean enable_drain_post_dns_refresh, jboolean enable_http3, jboolean use_cares,
jboolean force_v6, jboolean use_gro, jstring http3_connection_options,
jstring http3_client_connection_options, jobjectArray quic_hints,
jobjectArray quic_canonical_suffixes, jboolean enable_gzip_decompression,
jboolean enable_brotli_decompression, jlong num_timeouts_to_trigger_port_migration,
jboolean enable_socket_tagging, jboolean enable_interface_binding,
jlong h2_connection_keepalive_idle_interval_milliseconds,
jboolean use_gro, jstring http3_connection_options, jstring http3_client_connection_options,
jobjectArray quic_hints, jobjectArray quic_canonical_suffixes,
jboolean enable_gzip_decompression, jboolean enable_brotli_decompression,
jlong num_timeouts_to_trigger_port_migration, jboolean enable_socket_tagging,
jboolean enable_interface_binding, jlong h2_connection_keepalive_idle_interval_milliseconds,
jlong h2_connection_keepalive_timeout_seconds, jlong max_connections_per_host,
jlong stream_idle_timeout_seconds, jlong per_try_idle_timeout_seconds, jstring app_version,
jstring app_id, jboolean trust_chain_verification, jobjectArray filter_chain,
Expand All @@ -1346,16 +1343,15 @@ extern "C" JNIEXPORT jlong JNICALL Java_io_envoyproxy_envoymobile_engine_JniLibr
jni_helper, connect_timeout_seconds, dns_refresh_seconds, dns_failure_refresh_seconds_base,
dns_failure_refresh_seconds_max, dns_query_timeout_seconds, dns_min_refresh_seconds,
dns_preresolve_hostnames, enable_dns_cache, dns_cache_save_interval_seconds, dns_num_retries,
enable_drain_post_dns_refresh, enable_http3, use_cares, force_v6, use_gro,
http3_connection_options, http3_client_connection_options, quic_hints,
quic_canonical_suffixes, enable_gzip_decompression, enable_brotli_decompression,
enable_drain_post_dns_refresh, enable_http3, use_cares, use_gro, http3_connection_options,
http3_client_connection_options, quic_hints, quic_canonical_suffixes,
enable_gzip_decompression, enable_brotli_decompression,
num_timeouts_to_trigger_port_migration, enable_socket_tagging, enable_interface_binding,
h2_connection_keepalive_idle_interval_milliseconds, h2_connection_keepalive_timeout_seconds,
max_connections_per_host, stream_idle_timeout_seconds, per_try_idle_timeout_seconds,
app_version, app_id, trust_chain_verification, filter_chain,
enable_platform_certificates_validation, upstream_tls_sni, runtime_guards,
cares_fallback_resolvers, h3_connection_keepalive_initial_interval_milliseconds, builder);

return reinterpret_cast<intptr_t>(builder.generateBootstrap().release());
}

Expand Down
13 changes: 0 additions & 13 deletions mobile/library/kotlin/io/envoyproxy/envoymobile/EngineBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ open class EngineBuilder() {
internal var enableHttp3 = true
internal var useCares = false
internal var caresFallbackResolvers = mutableListOf<Pair<String, Int>>()
internal var forceV6 = true
private var useGro = false
private var http3ConnectionOptions = ""
private var http3ClientConnectionOptions = ""
Expand Down Expand Up @@ -234,17 +233,6 @@ open class EngineBuilder() {
return this
}

/**
* Specify whether local ipv4 addresses should be mapped to ipv6. Defaults to true.
*
* @param forceV6 whether or not to translate v4 to v6.
* @return This builder.
*/
fun forceV6(forceV6: Boolean): EngineBuilder {
this.forceV6 = forceV6
return this
}

/**
* Specify whether to use UDP GRO for upstream QUIC/HTTP3 sockets, if GRO is available on the
* system.
Expand Down Expand Up @@ -577,7 +565,6 @@ open class EngineBuilder() {
enableDrainPostDnsRefresh,
enableHttp3,
useCares,
forceV6,
useGro,
http3ConnectionOptions,
http3ClientConnectionOptions,
Expand Down
2 changes: 0 additions & 2 deletions mobile/library/objective-c/EnvoyConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL enableInterfaceBinding;
@property (nonatomic, assign) BOOL enableDrainPostDnsRefresh;
@property (nonatomic, assign) BOOL enforceTrustChainVerification;
@property (nonatomic, assign) BOOL forceIPv6;
@property (nonatomic, assign) BOOL enablePlatformCertificateValidation;
@property (nonatomic, strong, nullable) NSString *upstreamTlsSni;
@property (nonatomic, assign) BOOL respectSystemProxySettings;
Expand Down Expand Up @@ -70,7 +69,6 @@ NS_ASSUME_NONNULL_BEGIN
enableInterfaceBinding:(BOOL)enableInterfaceBinding
enableDrainPostDnsRefresh:(BOOL)enableDrainPostDnsRefresh
enforceTrustChainVerification:(BOOL)enforceTrustChainVerification
forceIPv6:(BOOL)forceIPv6
enablePlatformCertificateValidation:(BOOL)enablePlatformCertificateValidation
upstreamTlsSni:(nullable NSString *)upstreamTlsSni
respectSystemProxySettings:(BOOL)respectSystemProxySettings
Expand Down
3 changes: 0 additions & 3 deletions mobile/library/objective-c/EnvoyConfiguration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ - (instancetype)initWithConnectTimeoutSeconds:(UInt32)connectTimeoutSeconds
enableInterfaceBinding:(BOOL)enableInterfaceBinding
enableDrainPostDnsRefresh:(BOOL)enableDrainPostDnsRefresh
enforceTrustChainVerification:(BOOL)enforceTrustChainVerification
forceIPv6:(BOOL)forceIPv6
enablePlatformCertificateValidation:(BOOL)enablePlatformCertificateValidation
upstreamTlsSni:(nullable NSString *)upstreamTlsSni
respectSystemProxySettings:(BOOL)respectSystemProxySettings
Expand Down Expand Up @@ -132,7 +131,6 @@ - (instancetype)initWithConnectTimeoutSeconds:(UInt32)connectTimeoutSeconds
self.enableInterfaceBinding = enableInterfaceBinding;
self.enableDrainPostDnsRefresh = enableDrainPostDnsRefresh;
self.enforceTrustChainVerification = enforceTrustChainVerification;
self.forceIPv6 = forceIPv6;
self.enablePlatformCertificateValidation = enablePlatformCertificateValidation;
self.upstreamTlsSni = upstreamTlsSni;
self.respectSystemProxySettings = respectSystemProxySettings;
Expand Down Expand Up @@ -203,7 +201,6 @@ - (instancetype)initWithConnectTimeoutSeconds:(UInt32)connectTimeoutSeconds
builder.enableDrainPostDnsRefresh(self.enableDrainPostDnsRefresh);
builder.enableInterfaceBinding(self.enableInterfaceBinding);
builder.enforceTrustChainVerification(self.enforceTrustChainVerification);
builder.setForceAlwaysUsev6(self.forceIPv6);
builder.addH2ConnectionKeepaliveIdleIntervalMilliseconds(
self.h2ConnectionKeepaliveIdleIntervalMilliseconds);
builder.addH2ConnectionKeepaliveTimeoutSeconds(self.h2ConnectionKeepaliveTimeoutSeconds);
Expand Down
Loading

0 comments on commit 9f714f5

Please sign in to comment.