Page MenuHomePhabricator

IPv6 address not recognised
Closed, ResolvedPublic

Description

When attempting to access a MediaWiki installation via IPv6 (using the IP address 2001:5c0:1400:a::df), I get the following error:

Unable to determine IP

Backtrace:

#0 /var/www/helpmebot.org.uk/w/includes/User.php(1517): wfGetIP()
#1 /var/www/helpmebot.org.uk/w/includes/db/Database.php(676): User->getName()
#2 /var/www/helpmebot.org.uk/w/includes/db/Database.php(1046): DatabaseBase->query('SELECT lc_valu...', 'LCStore_DB::get')
#3 /var/www/helpmebot.org.uk/w/includes/db/Database.php(1130): DatabaseBase->select('l10n_cache', Array, Array, 'LCStore_DB::get', Array, Array)
#4 /var/www/helpmebot.org.uk/w/includes/LocalisationCache.php(764): DatabaseBase->selectRow('l10n_cache', Array, Array, 'LCStore_DB::get')
#5 /var/www/helpmebot.org.uk/w/includes/LocalisationCache.php(318): LCStore_DB->get('en', 'deps')
#6 /var/www/helpmebot.org.uk/w/includes/LocalisationCache.php(347): LocalisationCache->isExpired('en')
#7 /var/www/helpmebot.org.uk/w/includes/LocalisationCache.php(259): LocalisationCache->initLanguage('en')
#8 /var/www/helpmebot.org.uk/w/includes/LocalisationCache.php(205): LocalisationCache->loadItem('en', 'defaultUserOpti...')
#9 /var/www/helpmebot.org.uk/w/languages/Language.php(473): LocalisationCache->getItem('en', 'defaultUserOpti...')
#10 /var/www/helpmebot.org.uk/w/includes/User.php(1059): Language->getDefaultUserOptionOverrides()
#11 /var/www/helpmebot.org.uk/w/includes/User.php(1967): User::getDefaultOptions()
#12 /var/www/helpmebot.org.uk/w/includes/parser/ParserOptions.php(207): User->getOption('numberheadings')
#13 /var/www/helpmebot.org.uk/w/includes/parser/ParserOptions.php(159): ParserOptions->initialiseFromUser(Object(User))
#14 /var/www/helpmebot.org.uk/w/includes/Article.php(4403): ParserOptions->__construct(Object(User))
#15 /var/www/helpmebot.org.uk/w/includes/Article.php(839): Article->getParserOptions()
#16 /var/www/helpmebot.org.uk/w/includes/Wiki.php(477): Article->view()
#17 /var/www/helpmebot.org.uk/w/includes/Wiki.php(69): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#18 /var/www/helpmebot.org.uk/w/index.php(104): MediaWiki->performRequestForTitle(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#19 {main}

Adding a few echos seems to reveal that the line:
$ip = IP::canonicalize( $_SERVER['REMOTE_ADDR'] );
returns nothing.

This is currently running r82006.


Version: 1.18.x
Severity: blocker
OS: Linux
URL: http://ipv6.helpmebot.org.uk/w/

Details

Reference
bz27353

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:13 PM
bzimport set Reference to bz27353.

What webserver are you running.

This (mostly) works for me on apache. (otoh, when accessing any special page using ipv6 locally I get white screen of death, which i need to investigate futher)

Apache/2.2.14 (Ubuntu) - http://ipv6.helpmebot.org.uk/~stwalkerster/info.php

Might this be related to the fact IPv6 connectivity is being provided via a tunnel from Hurricane Electric?

This (mostly) works for me on apache. (otoh, when accessing any special page
using ipv6 locally I get white screen of death, which i need to investigate
futher)

Just to clarify, I discovered my comment about special pages not working was due to the redirect bug (bug 14977). Its unrelated to your issue.

Can you double-check what $_SERVER['REMOTE_ADDR'] returns? Sounds like we have a couple possibilities:

  1. REMOTE_ADDR data provided by the web server is missing or bogus
  2. REMOTE_ADDR is fine, but for some reason that value doesn't get normalized correctly by IP::canonicalize()

I created a new script in a different directory which just contained the following code:

echo ">" . $_SERVER['REMOTE_ADDR'] . "<";

The output of this is (http://ipv6.helpmebot.org.uk/~stwalkerster/remoteaddr.php):

2001:5c0:1400:a::df<

I hope this is what you wanted.

(The > < is something I commonly use to check for leading and trailing whitespace)

Regression in r77067: prior to that, IP::isValid('2001:5c0:1400:a::df') returned true.