Closed Bug 629666 Opened 13 years ago Closed 12 years ago

PAC: myIpAddress() returns ::1 if IPv6 is enabled

Categories

(Core :: Networking, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 347307

People

(Reporter: okrasz_news, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0b10) Gecko/20100101 Firefox/4.0b10
Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0b10) Gecko/20100101 Firefox/4.0b10

If you have IPv6 stack enabled, the myIpAddress() is returning ::1, which is IPv6 loopback address (equivalent of 127.0.0.1). This bug made me disable IPv6, since I can still live without it. 

Checked on Windows XP and Win7, Firefox 4.0 and 3.6.

Reproducible: Always

Steps to Reproduce:
1. Add IPv6 protocol to an network adapter
2. Write proxy configuration script with alert(myIpAddress())
3. Check error console for the result
Actual Results:  
::1 - IPv6 loopback

Expected Results:  
IPv4 or IPv6 address that is used for communication with other systems, not loopback.



Actually there should be a list of IPs or at least option to choose if IPv4 or IPv6 to be used. See bug 558253.
see also bug 559664
and bug 336589 could be related as well
I cannot test it, but a workaround may be to remove any extra lines starting with "::1" from your hosts file, i.e. on Linux: /etc/hosts or on Windows e.g.
C:\Windows\System32\drivers\etc\hosts
See also http://ubuntuforums.org/showthread.php?t=826495
Tested and confirmed on Firefox 10.0 beta running under Windows 7 Pro SP1 32-bit. 
("Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0")

IPv6 disabled on the NIC, and using alert("IP Address " + myIpAddress());  
returns "PAC-alert: IP Address ::1"

IE 8 works with the same PAC.

Note also that the "set network.dns.disableIPv6 to true" workaround is successful, but undesirable.

see also <a href="show_bug.cgi?id=559664" title="Pac file function myIpAddress() returns Link local IPv6 address instead of correct IPv6 address">bug 559664</a>

and for proposed myIpAddressEx and dnsResolveEx enhancements, see <a href="show_bug.cgi?id=558253" title="Proxy Auto Config (PAC) Extended functions for multi-resolution and ipv6">bug 558253</a>
(In reply to Scott Stowers from comment #4)

(sorry about mucking up the embedded html code.)

Also forgot to mention, David von Oheimb's suggestion from the ubuntuforums.org thread did not apply in this case, as the etc/hosts file is empty.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.