------- Comment #2 from BenGardiner at nanometrics dot ca  2007-10-29 20:43 
-------
Created an attachment (id=14436)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14436&action=view)
a patch for libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc to use the
given NetworkInterface* in the IP_ADD_MEMBERSHIP sockopt call. 

Created for gcc 4.0.1's libjava; noticed that the file in trunk still has the
FIXME. 

The change affects how multicast join/leave is implemented: if the
NetworkInterface* passed in the arguments is null, then the behaviour is the
same as the previous. That is, put the INADDR_ANY value into the ip_mreq
structure and pass it to the kernel (on linux 2.4.24 this ends up always
referring to the default gateway interface); otherwise, create a ip_mreq
structure for each address owned by the NetworkInterface and pass it to the
kernel. 

For linux it is a little overkill to do an IP_ADD_MEMBERSHIP call for each
address owned by the network interface, since they will each get mapped back
into the interface inside the kernel. It seemed that since the ip_mreq (mostly
standard) structure contained no field for a specific interface, the mostly
standard thing to do would be to do an _ADD_ for each address. If this is not
needed to accomodate all unices (something Im not qualified to decide) the
method could always do what is done in the openJDK: do an _ADD_ for the first
interface address owned by the NetworkInterface.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13288

Reply via email to