sunzhenguo / pacparser

Automatically exported from code.google.com/p/pacparser
GNU Lesser General Public License v3.0
0 stars 0 forks source link

myipaddress() returning IPv6 Address instead of IPv4 Address #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
IPv6 enabled on windows 7 machine with pac file using myipaddress() function 
returns the machines IPv6 address instead of IPv4 IP address

What is the expected output? What do you see instead?
IPv4 IP address

What version of the product are you using? On what operating system?
Version 1.3.0-1 on Windows 7

Please provide any additional information below.

Original issue reported on code.google.com by douglasc...@gmail.com on 20 Mar 2013 at 9:12

Attachments:

GoogleCodeExporter commented 9 years ago
The problem is that there is no way for the library to currently choose between 
multiple IP addresses that the client machine may have configured.  I think the 
only way to solve this properly is to add an API function to the library that 
allows the user to pass in a remote host to connect to to find out which client 
IP address works.  My function set_myip_from_host() in 
http://code.google.com/p/pacwget/source/browse/pacparse.c implements this, 
including allowing the user to choose if they would like only IPv4 or only IPv6 
addresses.  I would be happy to reformulate it as a pacparser library API 
function if you would like me to, Manu.

Original comment by davedyks...@gmail.com on 26 Mar 2013 at 12:07

GoogleCodeExporter commented 9 years ago
Hi Manu,

I have now reformulated the function I referred to in comment #1 as a pacparser 
library API in https://code.google.com/r/davedykstra-pacparser-iss25

Please check it out and pull it into a pacparser release.  I also added a way 
to test it from pactester, and updated pactester.1 correspondingly as well as 
adding a basic test (just to see that it doesn't fail) to testdata.  I'll let 
you run doxygen; my system has a very old version.  I didn't test it on 
Windows, but the only new function I used was getsockname, and internet 
searches seem to indicate that works fine on Windows.

I would also like this in before we integrate my pacparse.c and pacwget.

Dave

Original comment by davedyks...@gmail.com on 30 Aug 2013 at 10:02