You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/07/11 19:51:03 UTC

DO NOT REPLY [Bug 51497] New: Use canonical IPv6 text representation in logs

https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

             Bug #: 51497
           Summary: Use canonical IPv6 text representation in logs
           Product: Tomcat 7
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: ognjen.d.blagojevic@gmail.com
    Classification: Unclassified


In AccessLogValve and on other places where IPv6 address is logged or printed,
it would bi good if Tomcat would use canonical IPv6 format as described in RFC
5952 [1] (especially note section "3.2.2. Logging"), e.g:

1. instead of logging 2001:4000:0:5:0:0:0:66, it should log 2001:4000:0:5::66,
2. instead of logging 0:0:0:0:0:0:0:1, it should log ::1.


Class Inet6Address method getHostAddress confirms to RFC recommendations, in
everything except in zero groups handling. It simply prints full form with all
zeroes. In Java API I don't see any method to convert it to canonical form.

[1] http://tools.ietf.org/html/rfc5952

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

Ognjen Blagojevic <og...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29924|0                           |1
        is obsolete|                            |

--- Comment #11 from Ognjen Blagojevic <og...@gmail.com> ---
Created attachment 31300
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31300&action=edit
Patch to enable canonical IPv6

Most of the AccessLogValve logic is moved to AbstractAccessLogValve class.
Updated patch to reflect those changes.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

Ognjen Blagojevic <og...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29921|0                           |1
        is obsolete|                            |

--- Comment #10 from Ognjen Blagojevic <og...@gmail.com> ---
Created attachment 29924
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29924&action=edit
AccessLogValve patch

(In reply to comment #9)
> Trunk uses junit4-style tests. 
> Checkstyle there is configured that junit3 ones will not pass validation.

I ran the checkstyle and corrected all errors: trailing spaces and JUnit
version.

Thank you both for reviewing the patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #5 from Sebb <se...@apache.org> ---
(In reply to comment #4)
> The private method mayBeIPv6Address counts colons, but fails to check the
> value.

Which means that abcdef:80 is treated as an IPv6 address, and results in a call
to DNS to resolve the host name.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

Ognjen Blagojevic <og...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #27312|0                           |1
        is obsolete|                            |

--- Comment #8 from Ognjen Blagojevic <og...@gmail.com> ---
Created attachment 29921
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29921&action=edit
AccessLogValve patch

(In reply to comment #3)
> It would be better to use "assertEquals(expected, result)"

Fixed.


(In reply to comment #4)
> The private method mayBeIPv6Address counts colons, 
> but fails to check the value.

Fixed.


(In reply to comment #5)
> Which means that abcdef:80 is treated as an IPv6 address, 
> and results in a call to DNS to resolve the host name.

Fixed, it is not treated as IPv6 address anymore. I changed method
mayBeIPv6Address visibility to "protected", and added JUnit test cases.


(In reply to comment #6)
> Also mayBeIPv6Address does not recognise IPv6 scoped addresses 
> (%scope) or IPv4 mapped addresses (e.g. ::FFFF:d.d.d.d).

Fixed. Both mayBeIPv6Address and canonize(String) support zone ID (%1,
%eth0...), and IPv4-in-IPv6 (::FFFF:d.d.d.d, ::d.d.d.d, etc).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> 2011-07-11 19:32:48 UTC ---
Discussion on dev@, 2011-07-11:
http://tomcat.markmail.org/thread/jwysfldcsmulkytb
http://marc.info/?t=131040340100002&r=1&w=2

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #6 from Sebb <se...@apache.org> ---
Also mayBeIPv6Address does not recognise IPv6 scoped addresses (%scope) or IPv4
mapped addresses (e.g. ::FFFF:d.d.d.d).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #9 from Konstantin Kolinko <kn...@gmail.com> ---
> IPv6UtilsTest extends TestCase

Trunk uses junit4-style tests. 
Checkstyle there is configured that junit3 ones will not pass validation.

(Enabling checkstyle is documented in BUILDING.txt)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #4 from Sebb <se...@apache.org> ---
The private method mayBeIPv6Address counts colons, but fails to check the
value.

Also, there's no need to continue checking characters once an invalid char has
been found.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #2 from Ognjen Blagojevic <og...@gmail.com> 2011-07-25 14:11:54 UTC ---
Created attachment 27312
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27312
Adds RFC 5952 canonical IPv6 representation to AccessLogValve.

Here is the proposed patch:

- Added IPv6Utils.java to org.apache.tomcat.util.net
- Added IPv6UtilsTest.java to org.apache.tomcat.util.net
- Added parameter 'canonical' to  AccessLogValve, and changed logic for
parameters %a (remote addr), %A (local addr), %h (remote host name), and %v
(local host name)
- Updated AccessLogValve docs

AccessLogValve parameter 'canonical' is set to true by default. Not sure if
this shoud be the case, but since Apache httpd, Linux and Windows all use
canonical representation, I believe it is reasonable assumption.

Other than that, in order to access 'canonical' parameter, I needed to remove
static modifier from LocalServerNameElement and LocalAddressElement inner class
declarations, and to replace static initialization of LocalServerNameElement
with lazy initialization. Will this be an issue?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

Ognjen Blagojevic <og...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Catalina                    |Catalina
            Product|Tomcat 7                    |Tomcat 8
   Target Milestone|---                         |----

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #3 from Sebb <se...@apache.org> ---
Minor nit: the tests use "assertTrue(result.equals(expected))" throughout.
This will detect errors, but won't show what any detail if anything goes wrong.

It would be better to use "assertEquals(expected, result)" as that shows the
actual result if it differs from expected. For checking against null, use
assertNull().

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 51497] Use canonical IPv6 text representation in logs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51497

--- Comment #7 from Ognjen Blagojevic <og...@gmail.com> ---
Sebb,

I will fix problems you noticed, and upload new patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org