Skip to content

Instantly share code, notes, and snippets.

@malash
Last active August 9, 2025 02:52
Show Gist options
  • Save malash/e6fd273623c25535ec19e1b6e5fae6e9 to your computer and use it in GitHub Desktop.
Save malash/e6fd273623c25535ec19e1b6e5fae6e9 to your computer and use it in GitHub Desktop.
Build Chromium with IPv6 disabled
# Set build arguments here. See `gn help buildargs`.
is_debug = false
is_component_build = false
symbol_level = 0
cc_wrapper="env CCACHE_SLOPPINESS=time_macros ccache"
google_api_key="AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM"
#!/usr/bin/env bash
set -e
CWD="$(pwd)"
echo "Setting up build environment..."
DEPOT_TOOLS_DIR="$(realpath ~/Projects)/depot_tools"
if [ -d "$DEPOT_TOOLS_DIR" ]; then
echo "Updating depot_tools..."
cd "$DEPOT_TOOLS_DIR"
git pull origin main
else
echo "Cloning depot_tools..."
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "$DEPOT_TOOLS_DIR"
fi
export PATH="$DEPOT_TOOLS_DIR:$PATH"
echo "Setting up Chromium source..."
CHROMIUM_DIR="$(realpath ~/Projects)/chromium"
if [ -d "$CHROMIUM_DIR" ]; then
echo "Updating Chromium source..."
cd "$CHROMIUM_DIR"
gclient sync
else
echo "Cloning Chromium source..."
mkdir -p "$CHROMIUM_DIR"
cd "$CHROMIUM_DIR"
caffeinate fetch chromium
fi
echo "Entering Chromium source directory..."
CHROMIUM_SRC_DIR="$CHROMIUM_DIR/src"
cd "$CHROMIUM_SRC_DIR"
echo "Setting up Git configuration..."
git update-index --test-untracked-cache
git config core.untrackedCache true
git config core.fsmonitor true
echo "Generating build files..."
gn gen out/Default
cp "$CWD/args.gn" out/Default/args.gn
echo "Applying patch..."
git apply "$CWD/chromium-disable-ipv6.patch" || echo "Failed to apply patch"
echo "Building Chromium..."
autoninja -C out/Default chrome
diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc
index e23ea3fe9883a..086afe9fa4c2f 100644
--- a/net/dns/host_resolver_manager.cc
+++ b/net/dns/host_resolver_manager.cc
@@ -789,8 +789,8 @@ void HostResolverManager::InitializeJobKeyAndIPAddress(
// resolution based on a probe. Prior logic ensures that this is an automatic
// query, so the code requesting the resolution should be amenable to
// receiving an IPv6 resolution.
- if (!use_local_ipv6 && !is_ip && !last_ipv6_probe_result_ &&
- !ipv6_reachability_override_) {
+ if ((!use_local_ipv6 && !is_ip && !last_ipv6_probe_result_ &&
+ !ipv6_reachability_override_) || 1) {
out_job_key.flags |= HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
effective_types.Remove(DnsQueryType::AAAA);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment