[haiku-bugs] Re: [Haiku] #5716: [RFC][PATCH][gsoc2010] Enhancements in networking code

  • From: "atis.elsts" <trac@xxxxxxxxxxxx>
  • Date: Mon, 12 Apr 2010 11:31:24 -0000

#5716: [RFC][PATCH][gsoc2010] Enhancements in networking code
--------------------------------+-------------------------------------------
 Reporter:  atis.elsts          |       Owner:  nobody   
     Type:  enhancement         |      Status:  new      
 Priority:  normal              |   Milestone:  R1       
Component:  Network & Internet  |     Version:  R1/alpha1
 Keywords:                      |   Blockedby:           
 Platform:  All                 |    Blocking:           
--------------------------------+-------------------------------------------

Comment(by atis.elsts):

 Tests:

 The two test files attached, test_client.cpp and test_server.cpp,
 implement a server and client functionality respectively. I used behaviour
 on Linux as the reference behaviour for testing. Test results on Haiku are
 given after applying the patch.

 1. Test TCP connection to localhost with zero address as connect()
 parameter.

 IPv4:

 ./test_server tcp 4

 ./test_client tcp 4 4

 IPv6 (on Linux only ATM):

 ./test_server tcp 6

 ./test_client tcp 6 6

 Result: success.

 2. Test UDP connection to localhost with zero address as connect()
 parameter.

 IPv4:

 ./test_server udp 4

 ./test_client udp 4 4

 IPv6 (on Linux only ATM):

 ./test_server udp 6

 ./test_client udp 6 6

 Result: success.

 3. Check the behaviour of bind() with AF_INET6 address family on AF_INET
 socket.

 TCP:

 ./test_server tcp 4 ::1

 UDP:

 ./test_server udp 4 ::1

 Result on Linux: Was expecting this to fail on Linux. But it did not fail!
 Probably because of the layout of sockaddr_in and sockaddr_in6. This seems
 rather strange behaviour of Linux, if not a bug then at least an unexected
 "feature". Strange things like this also work:

 ./test_server udp 4 0:0:1234:5678:9abc::def

 so it's obvious that only the first 32 bits are used of the address passed
 from user. Probably a backwards compatibility feature? But then again, the
 applications that use (and rely on) something like this must be REALLY
 broken. It's probably safe to ignore this case.

 Result on Haiku: bind() fails with "Address family not supported by
 protocol family" messages.

 4. Check the behaviour of connect() with AF_INET6 address family on
 AF_INET socket.

 TCP:

 ./test_client tcp 4 6

 UDP:

 ./test_client udp 4 6

 Result on Linux: connect() fails with "Address family not supported by
 protocol" message.

 Result on Haiku: connect() fails with "Address family not supported by
 protocol family" message.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/5716#comment:2>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: