Bug 59931 - Misleading port after overriding client address
Summary: Misleading port after overriding client address
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_remoteip (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2016-08-02 20:30 UTC by Hank Ibell
Modified: 2020-04-16 16:08 UTC (History)
2 users (show)



Attachments
Potential patch (492 bytes, patch)
2016-08-02 20:31 UTC, Hank Ibell
Details | Diff
Potential patch - 2 (449 bytes, patch)
2016-08-02 23:17 UTC, Hank Ibell
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Ibell 2016-08-02 20:30:11 UTC
After overriding the client IP address, the port of the useragent address is invalid. The originating useragent port cannot be determined and should be set to zero so that it is not misleading.

Something else to consider is that mod_log_config currently prints out the useragent port when the %{remote}p is specified. If the useragent IP is overrided, this will cause the logs to print the zeroed port. Should we also update mod_log_config to handle this?

A few thoughts on what we could do:
1. Modify mod_log_config to print out the client port if the useragent port is zero.
2. Add another option for %{}p (e.g. %{client}p) so that users can still get the port if needed.

Any thoughts are appreciated.
Comment 1 Hank Ibell 2016-08-02 20:31:41 UTC
Created attachment 34095 [details]
Potential patch
Comment 2 Hank Ibell 2016-08-02 23:17:33 UTC
Created attachment 34096 [details]
Potential patch - 2

Moved where the port is zeroed out.
Comment 3 Eric Covener 2016-12-29 18:27:45 UTC
Thanks for the report & patch, committed in r1776458.
Comment 4 Yann Ylavic 2018-06-06 11:01:15 UTC
Backported to upcoming 2.4.34 in r1833007.