You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "binlijin (JIRA)" <ji...@apache.org> on 2012/09/06 10:05:07 UTC

[jira] [Created] (HADOOP-8773) Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress

binlijin created HADOOP-8773:
--------------------------------

             Summary: Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress 
                 Key: HADOOP-8773
                 URL: https://issues.apache.org/jira/browse/HADOOP-8773
             Project: Hadoop Common
          Issue Type: Improvement
            Reporter: binlijin
            Priority: Minor




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (HADOOP-8773) Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress

Posted by "binlijin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-8773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13450243#comment-13450243 ] 

binlijin commented on HADOOP-8773:
----------------------------------

@Steve Loughran, 
it Server.getRemoteAddress() not getRemoteIp(), can you recheck it ?

                
> Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress 
> ---------------------------------------------------------------------------
>
>                 Key: HADOOP-8773
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8773
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: binlijin
>            Priority: Minor
>         Attachments: HADOOP-8773.patch
>
>
> Connection :
> {code}
>     public String getHostAddress() {
>       return hostAddress;
>     }
> {code}
> Inet4Address :
> {code}
>     public String getHostAddress() {
> 	return numericToTextFormat(getAddress());
>     }
>     public byte[] getAddress() {
> 	byte[] addr = new byte[INADDRSZ];
> 	addr[0] = (byte) ((address >>> 24) & 0xFF);
> 	addr[1] = (byte) ((address >>> 16) & 0xFF);
> 	addr[2] = (byte) ((address >>> 8) & 0xFF);
> 	addr[3] = (byte) (address & 0xFF);
> 	return addr;
>     }
>     static String numericToTextFormat(byte[] src)
>     {
> 	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (HADOOP-8773) Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress

Posted by "binlijin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

binlijin updated HADOOP-8773:
-----------------------------

    Description: 
Connection :
{code}
    public String getHostAddress() {
      return hostAddress;
    }
{code}

Inet4Address :
{code}
    public String getHostAddress() {
	return numericToTextFormat(getAddress());
    }
    public byte[] getAddress() {
	byte[] addr = new byte[INADDRSZ];

	addr[0] = (byte) ((address >>> 24) & 0xFF);
	addr[1] = (byte) ((address >>> 16) & 0xFF);
	addr[2] = (byte) ((address >>> 8) & 0xFF);
	addr[3] = (byte) (address & 0xFF);
	return addr;
    }
    static String numericToTextFormat(byte[] src)
    {
	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
    }
{code}

  was:
Connection :
    public String getHostAddress() {
      return hostAddress;
    }

Inet4Address :
    public String getHostAddress() {
	return numericToTextFormat(getAddress());
    }
    public byte[] getAddress() {
	byte[] addr = new byte[INADDRSZ];

	addr[0] = (byte) ((address >>> 24) & 0xFF);
	addr[1] = (byte) ((address >>> 16) & 0xFF);
	addr[2] = (byte) ((address >>> 8) & 0xFF);
	addr[3] = (byte) (address & 0xFF);
	return addr;
    }
    static String numericToTextFormat(byte[] src)
    {
	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
    }

    
> Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress 
> ---------------------------------------------------------------------------
>
>                 Key: HADOOP-8773
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8773
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: binlijin
>            Priority: Minor
>
> Connection :
> {code}
>     public String getHostAddress() {
>       return hostAddress;
>     }
> {code}
> Inet4Address :
> {code}
>     public String getHostAddress() {
> 	return numericToTextFormat(getAddress());
>     }
>     public byte[] getAddress() {
> 	byte[] addr = new byte[INADDRSZ];
> 	addr[0] = (byte) ((address >>> 24) & 0xFF);
> 	addr[1] = (byte) ((address >>> 16) & 0xFF);
> 	addr[2] = (byte) ((address >>> 8) & 0xFF);
> 	addr[3] = (byte) (address & 0xFF);
> 	return addr;
>     }
>     static String numericToTextFormat(byte[] src)
>     {
> 	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (HADOOP-8773) Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress

Posted by "binlijin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

binlijin updated HADOOP-8773:
-----------------------------

    Description: 
Connection :
    public String getHostAddress() {
      return hostAddress;
    }

Inet4Address :
    public String getHostAddress() {
	return numericToTextFormat(getAddress());
    }
    public byte[] getAddress() {
	byte[] addr = new byte[INADDRSZ];

	addr[0] = (byte) ((address >>> 24) & 0xFF);
	addr[1] = (byte) ((address >>> 16) & 0xFF);
	addr[2] = (byte) ((address >>> 8) & 0xFF);
	addr[3] = (byte) (address & 0xFF);
	return addr;
    }
    static String numericToTextFormat(byte[] src)
    {
	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
    }
    
> Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress 
> ---------------------------------------------------------------------------
>
>                 Key: HADOOP-8773
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8773
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: binlijin
>            Priority: Minor
>
> Connection :
>     public String getHostAddress() {
>       return hostAddress;
>     }
> Inet4Address :
>     public String getHostAddress() {
> 	return numericToTextFormat(getAddress());
>     }
>     public byte[] getAddress() {
> 	byte[] addr = new byte[INADDRSZ];
> 	addr[0] = (byte) ((address >>> 24) & 0xFF);
> 	addr[1] = (byte) ((address >>> 16) & 0xFF);
> 	addr[2] = (byte) ((address >>> 8) & 0xFF);
> 	addr[3] = (byte) (address & 0xFF);
> 	return addr;
>     }
>     static String numericToTextFormat(byte[] src)
>     {
> 	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (HADOOP-8773) Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress

Posted by "binlijin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

binlijin updated HADOOP-8773:
-----------------------------

    Attachment: HADOOP-8773.patch
    
> Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress 
> ---------------------------------------------------------------------------
>
>                 Key: HADOOP-8773
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8773
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: binlijin
>            Priority: Minor
>         Attachments: HADOOP-8773.patch
>
>
> Connection :
> {code}
>     public String getHostAddress() {
>       return hostAddress;
>     }
> {code}
> Inet4Address :
> {code}
>     public String getHostAddress() {
> 	return numericToTextFormat(getAddress());
>     }
>     public byte[] getAddress() {
> 	byte[] addr = new byte[INADDRSZ];
> 	addr[0] = (byte) ((address >>> 24) & 0xFF);
> 	addr[1] = (byte) ((address >>> 16) & 0xFF);
> 	addr[2] = (byte) ((address >>> 8) & 0xFF);
> 	addr[3] = (byte) (address & 0xFF);
> 	return addr;
>     }
>     static String numericToTextFormat(byte[] src)
>     {
> 	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (HADOOP-8773) Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress

Posted by "Steve Loughran (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-8773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449579#comment-13449579 ] 

Steve Loughran commented on HADOOP-8773:
----------------------------------------

branch 1+ does exactly that
{code}
  public static InetAddress getRemoteIp() {
    Call call = CurCall.get();
    if (call != null) {
      return call.connection.socket.getInetAddress();
    }
    return null;
  }
{code}

What version have you been working with? If it is <1.0.3, please move to a later version of Hadoop and see if the patch is still needed
                
> Improve Server#getRemoteAddress by utilizing Server.Connection.hostAddress 
> ---------------------------------------------------------------------------
>
>                 Key: HADOOP-8773
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8773
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: binlijin
>            Priority: Minor
>         Attachments: HADOOP-8773.patch
>
>
> Connection :
> {code}
>     public String getHostAddress() {
>       return hostAddress;
>     }
> {code}
> Inet4Address :
> {code}
>     public String getHostAddress() {
> 	return numericToTextFormat(getAddress());
>     }
>     public byte[] getAddress() {
> 	byte[] addr = new byte[INADDRSZ];
> 	addr[0] = (byte) ((address >>> 24) & 0xFF);
> 	addr[1] = (byte) ((address >>> 16) & 0xFF);
> 	addr[2] = (byte) ((address >>> 8) & 0xFF);
> 	addr[3] = (byte) (address & 0xFF);
> 	return addr;
>     }
>     static String numericToTextFormat(byte[] src)
>     {
> 	return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira