Bug 52717

Summary: APR endpoint doesn't handle IPv6 link-local addresses well
Product: Tomcat Native Reporter: Richard Achmatowicz <rachmatowicz>
Component: LibraryAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Richard Achmatowicz 2012-02-20 19:10:35 UTC
APREndppoint has two issues with the handling of IPv6 link local addresses:

(i) if an IPv6 link local address without a zone id is specified, no default value is provided, so that initialization fails with the following error (example if from startup of JBoss AS7.1.0.Final):

11:01:29,185 ERROR [org.apache.coyote.http11.Http11AprProtocol] (MSC service thread 1-6) Error initializing endpoint: java.lang.Exception: Socket bind failed: [22] Invalid argument
	at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:578) [jbossweb-7.0.10.Final.jar:]

This is due to trying to create a socket using a link-local address while at the same time not specifying a zoneid.

(ii) APR does not rsolve a passed interface id (e.g. lo, eth0, ...) to the corresponding zone id (0, 1, 2, ...)
Comment 1 Mladen Turk 2012-02-21 13:20:11 UTC
Fixed with r1291760 by allowing to have numeric %scope_id address suffix.
Since APR does not provide API for parsing the scope/zone id from interface name, providing exact numeric id is the only possible solution at this moment.

Tested with my local link address
address="fe80::a00:27ff:fe1b:37f0%2" for http connector does not throw bind exceptions any more.