Re: IPv4 mapped addresses and -4/-6 switches

2005-04-20 Thread Hrvoje Niksic
Mauro Tortonesi [EMAIL PROTECTED] writes:

 well, to defend myself, i have to say that nc6 handles the -4 and -6
 switches by simply setting the ai_family member of the hints struct
 to be passed to getaddrinfo to PF_INET6 and PF_INET respectively,
 instead of the PF_UNSPEC default. so, the behaviour of -4 and -6
 switches with numeric addresses in nc6 is just a byproduct of this
 simple assignement. ;-)

But so does Wget!  Take a look at the code:

if (opt.ipv4_only)
  hints.ai_family = AF_INET;
else if (opt.ipv6_only)
  hints.ai_family = AF_INET6;
else
  {
hints.ai_family = AF_UNSPEC;
hints.ai_flags |= AI_ADDRCONFIG;
  }

That's why I am surprised at the different behavior.


Re: IPv4 mapped addresses and -4/-6 switches

2005-04-20 Thread Mauro Tortonesi
On Wednesday 20 April 2005 05:12 am, Hrvoje Niksic wrote:
 Mauro Tortonesi [EMAIL PROTECTED] writes:
  well, to defend myself, i have to say that nc6 handles the -4 and -6
  switches by simply setting the ai_family member of the hints struct
  to be passed to getaddrinfo to PF_INET6 and PF_INET respectively,
  instead of the PF_UNSPEC default. so, the behaviour of -4 and -6
  switches with numeric addresses in nc6 is just a byproduct of this
  simple assignement. ;-)

 But so does Wget!  Take a look at the code:

 if (opt.ipv4_only)
   hints.ai_family = AF_INET;
 else if (opt.ipv6_only)
   hints.ai_family = AF_INET6;
 else
   {
   hints.ai_family = AF_UNSPEC;
   hints.ai_flags |= AI_ADDRCONFIG;
   }

 That's why I am surprised at the different behavior.

sorry, i forgot to tell you that when the -6 switch is used, nc6 also sets the 
IPV6_V6ONLY option for the PF_INET6 socket used in the communication. that's 
why IPv4-compatible addresses are rejected.

-- 
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi

University of Ferrara - Dept. of Eng.http://www.ing.unife.it
Institute of Human  Machine Cognition   http://www.ihmc.us
Deep Space 6 - IPv6 for Linuxhttp://www.deepspace6.net
Ferrara Linux User Group http://www.ferrara.linux.it


Re: IPv4 mapped addresses and -4/-6 switches

2005-04-20 Thread Hrvoje Niksic
Mauro Tortonesi [EMAIL PROTECTED] writes:

 sorry, i forgot to tell you that when the -6 switch is used, nc6
 also sets the IPV6_V6ONLY option for the PF_INET6 socket used in the
 communication. that's why IPv4-compatible addresses are rejected.

Should Wget do the same?  It seems to make sense to me.


IPv4 mapped addresses and -4/-6 switches

2005-04-19 Thread Hrvoje Niksic
Is this the intended behavior of the -4/-6 switches:

$ wget -4 http://\[:::127.0.0.1\]
--00:35:50--  http://[:::127.0.0.1]/
   = `index.html'
failed: Name or service not known.
$ wget -6 http://\[:::127.0.0.1\]
--00:35:54--  http://[:::127.0.0.1]/
   = `index.html'
Connecting to :::127.0.0.1:80... connected.
...

Should -4/-6 make a better attempt to deal with this, or is the
current behavior fine?  If the latter is the case, should we document
the current behavior?

nc6 rejects the second test case:

$ nc6 -4 :::127.0.0.1 80
nc6: forward host lookup failed for remote endpoint :::127.0.0.1: Name or 
service not known
$ nc6 -6 :::127.0.0.1 80
nc6: forward lookup returned no usable socket types


Re: IPv4 mapped addresses and -4/-6 switches

2005-04-19 Thread Mauro Tortonesi
On Tuesday 19 April 2005 05:55 pm, Hrvoje Niksic wrote:
 Is this the intended behavior of the -4/-6 switches:

 $ wget -4 http://\[:::127.0.0.1\]
 --00:35:50--  http://[:::127.0.0.1]/
= `index.html'
 failed: Name or service not known.
 $ wget -6 http://\[:::127.0.0.1\]
 --00:35:54--  http://[:::127.0.0.1]/
= `index.html'
 Connecting to :::127.0.0.1:80... connected.
 ...

 Should -4/-6 make a better attempt to deal with this, or is the
 current behavior fine?  If the latter is the case, should we document
 the current behavior?

 nc6 rejects the second test case:

 $ nc6 -4 :::127.0.0.1 80
 nc6: forward host lookup failed for remote endpoint :::127.0.0.1: Name
 or service not known $ nc6 -6 :::127.0.0.1 80
 nc6: forward lookup returned no usable socket types

well, this is up to us and the semantics we choose for the -4 and -6 switches.
theoretically, since an IPv6 connection to :::127.0.0.1 is semantically 
equivalent to an IPv4 connection to 127.0.0.1, it makes sense to reject 
IPv4-compatible addresses when using the -6 switch. therefore, if IPv6 
support is compiled in, i think we should accept IPv4-compatible addresses 
when using the -4 switch.

anyway, i realize that adopting this policy makes the implementation of the -4 
and -6 switches much more complex. so, i don't have any real preference. 

BTW, IMVHO this is a very low priority issue and can be left for wget 1.11 ;-)

-- 
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi

University of Ferrara - Dept. of Eng.http://www.ing.unife.it
Institute of Human  Machine Cognition   http://www.ihmc.us
Deep Space 6 - IPv6 for Linuxhttp://www.deepspace6.net
Ferrara Linux User Group http://www.ferrara.linux.it


Re: IPv4 mapped addresses and -4/-6 switches

2005-04-19 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Wed, 20 Apr 2005 00:55:42 +0200), Hrvoje 
Niksic [EMAIL PROTECTED] says:

 Is this the intended behavior of the -4/-6 switches:
 
 $ wget -4 http://\[:::127.0.0.1\]
 --00:35:50--  http://[:::127.0.0.1]/
= `index.html'
 failed: Name or service not known.
 $ wget -6 http://\[:::127.0.0.1\]
 --00:35:54--  http://[:::127.0.0.1]/
= `index.html'
 Connecting to :::127.0.0.1:80... connected.
 ...
 
 Should -4/-6 make a better attempt to deal with this, or is the
 current behavior fine?  If the latter is the case, should we document
 the current behavior?

-4/-6 make sense when and only when we use name (instead of address)
to connect host. e.g.:
wget -4 http://localhost/

(So, it is not necessary at all to do as nc6 does.)

-- 
Hideaki YOSHIFUJI @ USAGI Project [EMAIL PROTECTED]
Homepage: http://www.yoshifuji.org/~hideaki/
GPG FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA


Re: IPv4 mapped addresses and -4/-6 switches

2005-04-19 Thread Mauro Tortonesi
On Tuesday 19 April 2005 09:21 pm, YOSHIFUJI Hideaki /  wrote:
 In article [EMAIL PROTECTED] (at Wed, 20 Apr 2005 00:55:42 +0200), 
Hrvoje Niksic [EMAIL PROTECTED] says:
  Is this the intended behavior of the -4/-6 switches:
 
  $ wget -4 http://\[:::127.0.0.1\]
  --00:35:50--  http://[:::127.0.0.1]/
 = `index.html'
  failed: Name or service not known.
  $ wget -6 http://\[:::127.0.0.1\]
  --00:35:54--  http://[:::127.0.0.1]/
 = `index.html'
  Connecting to :::127.0.0.1:80... connected.
  ...
 
  Should -4/-6 make a better attempt to deal with this, or is the
  current behavior fine?  If the latter is the case, should we document
  the current behavior?

 -4/-6 make sense when and only when we use name (instead of address)
 to connect host. e.g.:
 wget -4 http://localhost/

right.

 (So, it is not necessary at all to do as nc6 does.)

well, to defend myself, i have to say that nc6 handles the -4 and -6 switches 
by simply setting the ai_family member of the hints struct to be passed to 
getaddrinfo to PF_INET6 and PF_INET respectively, instead of the PF_UNSPEC 
default. so, the behaviour of -4 and -6 switches with numeric addresses in 
nc6 is just a byproduct of this simple assignement. ;-)

-- 
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi

University of Ferrara - Dept. of Eng.http://www.ing.unife.it
Institute of Human  Machine Cognition   http://www.ihmc.us
Deep Space 6 - IPv6 for Linuxhttp://www.deepspace6.net
Ferrara Linux User Group http://www.ferrara.linux.it