You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ra...@apache.org on 2026/09/15 01:14:06 UTC

(dubbo) branch 3.3 updated: fix: preserve loopback addresses for QUIC connections (#16463)

This is an automated email from the ASF dual-hosted git repository.

RainYuY pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.3 by this push:
     new bc662cdebb fix: preserve loopback addresses for QUIC connections (#16463)
bc662cdebb is described below

commit bc662cdebbae65820bda3f3731c83bc783411160
Author: Yukina <ra...@apache.org>
AuthorDate: Tue Sep 15 09:13:58 2026 +0800

    fix: preserve loopback addresses for QUIC connections (#16463)
---
 .../transport/netty4/NettyHttp3ConnectionClient.java   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3ConnectionClient.java b/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3ConnectionClient.java
index d3fbca570b..1caa59ade8 100644
--- a/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3ConnectionClient.java
+++ b/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3ConnectionClient.java
@@ -17,11 +17,13 @@
 package org.apache.dubbo.remoting.transport.netty4;
 
 import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.utils.NetUtils;
 import org.apache.dubbo.remoting.ChannelHandler;
 import org.apache.dubbo.remoting.Constants;
 import org.apache.dubbo.remoting.RemotingException;
 import org.apache.dubbo.remoting.http3.Http3SslContexts;
 
+import java.net.InetSocketAddress;
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
@@ -116,6 +118,22 @@ public final class NettyHttp3ConnectionClient extends AbstractNettyConnectionCli
         return promise;
     }
 
+    /**
+     * Override this method to preserve the configured loopback address.
+     * The superclass implementation may rewrite it to a non-loopback local IP,
+     * potentially causing a peer-address mismatch on multi-homed hosts.
+     * QUIC requires the peer's IP address to remain stable until the handshake
+     * is confirmed.
+     */
+    @Override
+    public InetSocketAddress getConnectAddress() {
+        String host = getUrl().getHost();
+        if (NetUtils.isLocalHost(host)) {
+            return getUrl().toInetSocketAddress();
+        }
+        return super.getConnectAddress();
+    }
+
     @Override
     protected void performClose() {
         super.performClose();