Subject: Re: bind(2) ordering constraint

From: Hideaki YOSHIFUJI <[email-masked]>
Date: Thu, 03 Aug 2000 11:31:11 +0900

In article <200008021951.e72JpWW02883@ starfruit.itojun.org> (at Thu, 03 Aug 2000 04:51:32 +0900), Jun-ichiro itojun Hagino <[email-masked]> says:

> 	implementers, please run the attached program, and send the result to
> 	me, or to the list, with clear indication of
> 	- platform (like "NetBSD")
> 	- version (like "1.5_ALPHA")
> 	- comments, and some background info/reasoning for your behavior
> 	sample result is attached.

Platform: Linux
Version: 2.2.16
Comment: Debian GNU/Linux 2.2 (aka potato), tested on cerberus.
Tester: Hideaki YOSHIFUJI <[email-masked]>

starting tests, socktype = SOCK_DGRAM
wild4 then wild4
	bind socket for 0.0.0.0/12345
	bind socket for 0.0.0.0/12345
	failed bind for 0.0.0.0/12345, Address already in use
wild4 then wild6
	bind socket for 0.0.0.0/12345
	bind socket for ::/12345
	failed bind for ::/12345, Address already in use
wild4 then loop4
	bind socket for 0.0.0.0/12345
	bind socket for 127.0.0.1/12345
	failed bind for 127.0.0.1/12345, Address already in use
wild4 then loop6
	bind socket for 0.0.0.0/12345
	bind socket for ::1/12345
	failed bind for ::1/12345, Address already in use
wild4 then one4
	bind socket for 0.0.0.0/12345
	bind socket for 0.0.0.1/12345
	failed bind for 0.0.0.1/12345, Address already in use
wild4 then map4
	bind socket for 0.0.0.0/12345
	bind socket for ::ffff:127.0.0.1/12345
	failed bind for ::ffff:127.0.0.1/12345, Address already in use
wild6 then wild4
	bind socket for ::/12345
	bind socket for 0.0.0.0/12345
	failed bind for 0.0.0.0/12345, Address already in use
wild6 then wild6
	bind socket for ::/12345
	bind socket for ::/12345
	failed bind for ::/12345, Address already in use
wild6 then loop4
	bind socket for ::/12345
	bind socket for 127.0.0.1/12345
	failed bind for 127.0.0.1/12345, Address already in use
wild6 then loop6
	bind socket for ::/12345
	bind socket for ::1/12345
	failed bind for ::1/12345, Address already in use
wild6 then one4
	bind socket for ::/12345
	bind socket for 0.0.0.1/12345
	failed bind for 0.0.0.1/12345, Address already in use
wild6 then map4
	bind socket for ::/12345
	bind socket for ::ffff:127.0.0.1/12345
	failed bind for ::ffff:127.0.0.1/12345, Address already in use
loop4 then wild4
	bind socket for 127.0.0.1/12345
	bind socket for 0.0.0.0/12345
	failed bind for 0.0.0.0/12345, Address already in use
loop4 then wild6
	bind socket for 127.0.0.1/12345
	bind socket for ::/12345
	failed bind for ::/12345, Address already in use
loop4 then loop4
	bind socket for 127.0.0.1/12345
	bind socket for 127.0.0.1/12345
	failed bind for 127.0.0.1/12345, Address already in use
loop4 then loop6
	bind socket for 127.0.0.1/12345
	bind socket for ::1/12345
loop4 then one4
	bind socket for 127.0.0.1/12345
	bind socket for 0.0.0.1/12345
loop4 then map4
	bind socket for 127.0.0.1/12345
	bind socket for ::ffff:127.0.0.1/12345
loop6 then wild4
	bind socket for ::1/12345
	bind socket for 0.0.0.0/12345
	failed bind for 0.0.0.0/12345, Address already in use
loop6 then wild6
	bind socket for ::1/12345
	bind socket for ::/12345
	failed bind for ::/12345, Address already in use
loop6 then loop4
	bind socket for ::1/12345
	bind socket for 127.0.0.1/12345
loop6 then loop6
	bind socket for ::1/12345
	bind socket for ::1/12345
	failed bind for ::1/12345, Address already in use
loop6 then one4
	bind socket for ::1/12345
	bind socket for 0.0.0.1/12345
loop6 then map4
	bind socket for ::1/12345
	bind socket for ::ffff:127.0.0.1/12345
one4 then wild4
	bind socket for 0.0.0.1/12345
	bind socket for 0.0.0.0/12345
	failed bind for 0.0.0.0/12345, Address already in use
one4 then wild6
	bind socket for 0.0.0.1/12345
	bind socket for ::/12345
	failed bind for ::/12345, Address already in use
one4 then loop4
	bind socket for 0.0.0.1/12345
	bind socket for 127.0.0.1/12345
one4 then loop6
	bind socket for 0.0.0.1/12345
	bind socket for ::1/12345
one4 then one4
	bind socket for 0.0.0.1/12345
	bind socket for 0.0.0.1/12345
	failed bind for 0.0.0.1/12345, Address already in use
one4 then map4
	bind socket for 0.0.0.1/12345
	bind socket for ::ffff:127.0.0.1/12345
map4 then wild4
	bind socket for ::ffff:127.0.0.1/12345
	bind socket for 0.0.0.0/12345
	failed bind for 0.0.0.0/12345, Address already in use
map4 then wild6
	bind socket for ::ffff:127.0.0.1/12345
	bind socket for ::/12345
	failed bind for ::/12345, Address already in use
map4 then loop4
	bind socket for ::ffff:127.0.0.1/12345
	bind socket for 127.0.0.1/12345
	failed bind for 127.0.0.1/12345, Address already in use
map4 then loop6
	bind socket for ::ffff:127.0.0.1/12345
	bind socket for ::1/12345
map4 then one4
	bind socket for ::ffff:127.0.0.1/12345
	bind socket for 0.0.0.1/12345
map4 then map4
	bind socket for ::ffff:127.0.0.1/12345
	bind socket for ::ffff:127.0.0.1/12345
	failed bind for ::ffff:127.0.0.1/12345, Address already in use

-- 
Hideaki YOSHIFUJI @ USAGI Project  <[email-masked]>
Web Page: http://www.ecei.tohoku.ac.jp/%7Eyoshfuji/
PGP5i FP: F731 6599 5EB2 BBA7 1515  1323 1806 A96F 5700 6B25 
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------

---

From: Stig Ven�s <[email-masked]>
Date: Thu, 3 Aug 2000 15:47:40 +0200

This is about what I expected, what I didn't like though was:

> 	failed bind for 127.0.0.1/12345, Address already in use

I think the first one should fail as well. Anyone disagree?

Stig

-- 
Stig Venaas
UNINETT

---

From: Hideaki YOSHIFUJI (吉藤英明) <[email-masked]>
Date: Fri, 04 Aug 2000 00:59:57 +0900

> I think the first one should fail as well. Anyone disagree?

This seems a bug in bind checking code (ipv4->::ffff.ipv4 case)).
I'm trying to fix this.

-- 
Hideaki YOSHIFUJI <[email-masked]>