Skip to content

Commit

Permalink
[ISSUE apache#8607] Exclude loopback addresses when iterating over lo…
Browse files Browse the repository at this point in the history
…cal network interfaces
  • Loading branch information
chi3316 authored Aug 30, 2024
1 parent 18c30cb commit b9d9b3f
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public static InetAddress getLocalInetAddress() {
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 {
Expand Down

0 comments on commit b9d9b3f

Please sign in to comment.