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

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new b9d9b3fcae [ISSUE #8607] Exclude loopback addresses when iterating 
over local network interfaces
b9d9b3fcae is described below

commit b9d9b3fcae6ecdf421fba246721bd3ab984edbc3
Author: 小陈 <[email protected]>
AuthorDate: Fri Aug 30 09:20:45 2024 +0800

    [ISSUE #8607] Exclude loopback addresses when iterating over local network 
interfaces
---
 .../src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java 
b/common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java
index a7a9a7c796..2dc2a890e7 100644
--- a/common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java
+++ b/common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java
@@ -129,6 +129,10 @@ public class NetworkUtil {
             ArrayList<InetAddress> ipv6Result = new ArrayList<>();
             List<InetAddress> localInetAddressList = getLocalInetAddressList();
             for (InetAddress inetAddress : localInetAddressList) {
+                // Skip loopback addresses
+                if (inetAddress.isLoopbackAddress()) {
+                    continue;
+                }
                 if (inetAddress instanceof Inet6Address) {
                     ipv6Result.add(inetAddress);
                 } else {

Reply via email to