visible_hostname defaults to hostname of first http_port IP, not get_hostname()

Bug #1098641 reported by James Troup
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
squid (Ubuntu)
New
Undecided
Unassigned
squid3 (Ubuntu)
New
Medium
Unassigned

Bug Description

| # TAG: visible_hostname
| # If you want to present a special hostname in error messages, etc,
| # define this. Otherwise, the return value of gethostname()
| # will be used. If you have multiple caches in a cluster and
| # get errors about IP-forwarding you must set them to have individual
| # names with this setting.
| #Default:
| # visible_hostname localhost

This isn't actually true, at least the part about gethostname().
It'll first do a reverse DNS lookup on the IP of the first http_port
entry (getMyHostname() in src/tools.cc) and only use get_hostname().

Our first http_port is 127.0.0.1 in a lot of places, so
visible_hostname is now localhost for those squids. This caused bogus
forward loop detection to kick in when our office squid tried to talk
to the squid that runs the Ubuntu Forums.

I'm not necessarily arguging that the current behaviour is wrong, but
it would be nice if the code and the docs could be consistent.

Revision history for this message
James Troup (elmo) wrote :

Sorry, this is squid3 3.1.19-1ubuntu3.12.04.1 on Ubuntu 12.04 LTS, FWIW.

Robie Basak (racb)
Changed in squid3 (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Robert Collins (lifeless) wrote :

Please open this upstream - using 127.0.0.1 as the visible hostname would never be sensible IMO.

Revision history for this message
Robert Collins (lifeless) wrote :

(Though I think 3.3.3 may be fixed).

tags: added: precise
no longer affects: squid
Revision history for this message
Amos Jeffries (yadi) wrote :

This behaviour is a result of the upstream fix for upstream bug 2997. It is still present in all Squid-3 (will be fixed in Squid-4). When Squid is assigned an explicit listening IP and that IP has reverse-DNS it is used instead of halting startup.

Only the first http_port or https_port is checked in the affected versions. To prevent localhost being used, do not configure it as the primary listening address for Squid.

Revision history for this message
Amos Jeffries (yadi) wrote :

Oops, sorry 3.3.3 and later are checking for '.' present in the domin name. So yes they should be fixed in regards to this.

Revision history for this message
Robie Basak (racb) wrote :

Thanks Amos. So does this need a bug opening upstream?

tags: added: needs-upstream-report
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.