[
https://issues.apache.org/jira/browse/HADOOP-7510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13094815#comment-13094815
]
Daryn Sharp commented on HADOOP-7510:
-------------------------------------
{quote}
> URI uri = hasScheme ? URI.create(target) : URI.create("host://"+target);
If hasScheme is false, the host is used as a scheme? Is it a typo?
{quote}
The scheme "host" (not a variable) is used as a dummy scheme to allow the
authority to subsequently be parsed out.
{quote}
> NetUtils#makeSocketAddr
InetSocketAddress#getHostName javadoc states that hostname part of the address
is returned. How can we assume that an IP address will be returned even if it
is resolved?
{quote}
{{InetSocketAddress#getHostName}} returns the hostname within the embedded
{{InetAddress}}. If instantiated with an ip, the {{InetAddress}} has a null
hostname which causes the ip to be resolved when the hostname is requested. We
don't want this behavior. If {{InetSocketAddress}} is instantiated with an ip,
then the ip must be returned so the reconnect uses the ip and not the host from
a reverse lookup.
The trick is to instantiate an {{InetAddress}} with an exact hostname (whether
ip or host) and it's ip -- this prevents any dns lookups when {{getHostName}}
is invoked. Then instantiate an {{InetSocketAddress}} with that
{{InetAddress}}. Now {{getHostName}} is locked down to return the given
hostname (whether ip or host).
Here is the relevant code:
{code}
iaddr = InetAddress.getByAddress(hostname, iaddr.getAddress());
socketAddr = new InetSocketAddress(iaddr, port);
{code}
{quote}
> DistributedFileSystem.java
Please don't remove the deprecated method. I think deprecated methods should be
removed only in major releases.
{quote}
No problem, I'll add it back.
> Tokens should use original hostname provided instead of ip
> ----------------------------------------------------------
>
> Key: HADOOP-7510
> URL: https://issues.apache.org/jira/browse/HADOOP-7510
> Project: Hadoop Common
> Issue Type: Improvement
> Components: security
> Reporter: Daryn Sharp
> Assignee: Daryn Sharp
> Fix For: 0.20.205.0
>
> Attachments: HADOOP-7510.patch
>
>
> Tokens currently store the ip:port of the remote server. This precludes
> tokens from being used after a host's ip is changed. Tokens should store the
> hostname used to make the RPC connection. This will enable new processes to
> use their existing tokens.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira