firefox wpad.dat report incorrect myIpAddress()

Bug #228850 reported by Ashwin
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: firefox

I have a wpad.dat that tries to detect the network based on the myAddress() javascript API specified by wpad standards. It works in windows firefox (and even in IE!). It does not do so in Ubuntu.
The problem is that /etc/hosts lists mymachine.domain.com as 127.0.1.1 and firefox picks up the address from there for myAddress() calls.
I am connected over eth0 and the address is configured correctly. I can access local websites (the internet if I manually configure the proxy)

Test wpad.dat:
function FindProxyForURL(url, host)

{

     alert("address:" + myAddress()); // expect 157.254.x.y but got 127.0.1.1
    // Direct access

    if (
isPlainHostName(host) ||

        shExpMatch(host, "157.254.*") )

    {

        alert(host + ":DIRECT");

        return "DIRECT";

    }

    // Are we inside the jail?????

    if (isInNet(myIpAddress(), "157.254.120.0", "255.255.255.0") ) {

        alert(host + ":PRIN");

        return "PROXY thebadproxy.domain.com:80";

    }

    // we are in the free world!

    alert(host + ":FREE");

    return "DIRECT";

}

I understand that the /etc/hosts entry is needed (if network is down etc).

Firefox must pick the address from the interface used in the default route and not by trying to look up mymachine.domain.com. Even if it looks up mymachine.domain.com, it should be a DNS lookup and not from /etc/hosts.

Hope to see this pushed upstream and eventually fixed. There several reports from people not able to access the internet by using automatic proxy configuration. It is because of this.

Tags: patch
Revision history for this message
Ivar Abrahamsen (flurdy) wrote :

Affects automatic proxies and any call myIpAddress()

Changed in firefox:
status: New → Confirmed
Revision history for this message
Franck78 (fbourdonnec) wrote :

Hello,
This bug made me lost 2 hours.

If you (we) want Ubuntu spread in office environement, it is more important to fix it before

bugs such "How to play stream on www.hit967.com"

I started with a student classroom (30 pc) for example and this kind of bug is a full stop (bloquant). No workaround to select proxy based on client location.

Please fix!

Franck

Revision history for this message
Jan Gutter (ubuntu-jangutter) wrote :

This bug still affects Lucid Lynx.

I presume the Ubuntu developers are not even interested in passing the bug (or buck) upstream?

Revision history for this message
Matthieu Patou (mat-matws) wrote :

I would like to add a me too to this bug !

The problem seems very nasty now with 10.10 as network manager insists on adding an entry with the hostname of the machine and 127.0.0.1 so everytime you use the myIpAddress function you have always 127.0.0.1 !

The test.html file attached allow to show the problem more clearly as the original myIpAddress of firefox return the first element of o.getNextAddrAsString() which is, as the test reveal, 127.0.0.1 !
I made a small patch to correct the behavior of firefox, in the 3.6 series you can apply it simply.

In the 4.0 series you have to first locate the omni.jar file, then copy it to omni.zip, make a sub folder, unzip it in the subfolder, apply my patch, recreate a zip file (rm ../omni.zip; zip ../omni.zip -r .) and rename it to omni.jar.

It works for me quite well !
Enjoy !

Revision history for this message
Matthieu Patou (mat-matws) wrote :

The idea of the patch is to skip the 127.0.0.1 ip address.

Another solution might be to return not 1 address with myIpAddress but an array of addresses.

tags: added: patch
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks, but this needs to be sent upstream really...

Revision history for this message
Matthieu Patou (mat-matws) wrote :

Reported to upstream too, more exactly it's already reported since a couple of years for firefox but it seems that mozilla was not moving a lot on this subject

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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