Improve the acceptor unlock process
diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 76dbf09..4971c9d 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -1348,21 +1348,23 @@
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
- Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
- while (inetAddresses.hasMoreElements()) {
- InetAddress inetAddress = inetAddresses.nextElement();
- if (localAddress.getAddress().getClass().isAssignableFrom(inetAddress.getClass())) {
- if (inetAddress.isLoopbackAddress()) {
- if (loopbackUnlockAddress == null) {
- loopbackUnlockAddress = inetAddress;
+ if (!networkInterface.isPointToPoint() && networkInterface.isUp()) {
+ Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
+ while (inetAddresses.hasMoreElements()) {
+ InetAddress inetAddress = inetAddresses.nextElement();
+ if (localAddress.getAddress().getClass().isAssignableFrom(inetAddress.getClass())) {
+ if (inetAddress.isLoopbackAddress()) {
+ if (loopbackUnlockAddress == null) {
+ loopbackUnlockAddress = inetAddress;
+ }
+ } else if (inetAddress.isLinkLocalAddress()) {
+ if (linkLocalUnlockAddress == null) {
+ linkLocalUnlockAddress = inetAddress;
+ }
+ } else {
+ // Use a non-link local, non-loop back address by default
+ return new InetSocketAddress(inetAddress, localAddress.getPort());
}
- } else if (inetAddress.isLinkLocalAddress()) {
- if (linkLocalUnlockAddress == null) {
- linkLocalUnlockAddress = inetAddress;
- }
- } else {
- // Use a non-link local, non-loop back address by default
- return new InetSocketAddress(inetAddress, localAddress.getPort());
}
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index cf8cbcd..50b7674 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,16 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 11.0.0-M22 (markt)" rtext="in development">
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Improve the algorithm used to identify the IP address to use to unlock
+ the acceptor thread when a Connector is listening on all local
+ addresses. Interfaces that are configured for point to point connections
+ or are not currently up are now skipped. (markt)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 11.0.0-M21 (markt)" rtext="release in progress">
<subsection name="Catalina">