OSDN Git Service

Fixes for socket options on multicast sockets.
authorLorenzo Colitti <lorenzo@google.com>
Wed, 30 Sep 2009 22:49:22 +0000 (15:49 -0700)
committerLorenzo Colitti <lorenzo@google.com>
Wed, 30 Sep 2009 23:29:48 +0000 (16:29 -0700)
commitd6a4cc340b98980f292168a34458015344ee6646
tree9f6bf94af3ee9e8a3fd1cc3c846848587104edff
parent7f51bfee5fc5fb34fe89f3d74f7fd40d834c0fc2
Fixes for socket options on multicast sockets.

1. Properly pass get/setsockopt the pointer to the socket option instead of the
   pointer to the pointer to the option. This was not caught at compile time
   because it's a void *.
2. Handle IPv4 multicast addresses on IPv6 sockets. This is important because
   current devices create IPv6 sockets by default.
3. Use the proper options for IPv6 multicast (i.e., IPV6_{ADD,DROP}_MEMBERSHIP
   instead of IP_{ADD,DROP}_MEMBERSHIP)
4. Use integers instead of bytes when getting or setting the multicast TTL
   because that's what the Linux kernel uses.

These fix 10 of the 11 MulticastSocketTest failures. Also, minor changes:

1. Add ifdefd-out logging functions for get/setsockopt.
2. Change all instances of IPPROTO_{IP,IPv6} to SOL_{IP,IPV6} in get/setsockopt
   calls. Even though the values are the same (so the code worked), this way is
   more correct.

Change-Id: Iea75a523d7e71f0b361a42c0e39d3ef075dc7ff4
libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp