Bug 52717 - APR endpoint doesn't handle IPv6 link-local addresses well
Summary: APR endpoint doesn't handle IPv6 link-local addresses well
Status: RESOLVED FIXED
Alias: None
Product: Tomcat Native
Classification: Unclassified
Component: Library (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-20 19:10 UTC by Richard Achmatowicz
Modified: 2012-02-21 13:20 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.