[comp.protocols.tcp-ip] UDP Broadcastsing - The Answer

anderson@ncrorl.Orlando.NCR.COM (Anderson) (11/21/89)

	Thanks to Art Berggreen (art@salt.acc.com), Brendan Eich
(brendan@illyria.wpd.sci.com), and Micky Lui (micky@cunixc.cc.columbia.edu)
for responding to my question. This a brief summary of the answers for anyone
else that was curious.

Question: How does a UDP broadcast behave when a host has multiple network
	  interfaces (i.e. SLIP or multiple ethernet interfaces, etc.)?


Answer: It depends. 8-)

	In general, the broadcast will follow the restrictions placed on
it by using network/subnet broadcast addresses. If, however, a blanket
broadcast (wildcard address) is used, then only the primary interface
is used. It appears that the primary interface is selected as the first
entry found in the routing table (usually the first configured) with the
IFF_BROADCAST flag set.

	The proper way to do a broadcast so that it gets sent on all of the
network interfaces is to get a list of all of the interfaces, using ioctl()
calls for SIOGIFCONF and SIOGIFFLAGS, and send the packet down each interface
desired. I think that the proper broadcast/destination address for each
interface should also be determined this way (although I haven't tried it yet).

	RPC broadcasting does work by using these ioctl()s.

	In summary, it's up to the next level up (the user's program) to
determine the behavior of a broadcast. The UDP/IP drivers take a very simple
approach to it.

Stuart Anderson        anderson@Orlando.NCR.COM       NCR E&M Orlando, Florida
..!uunet!ncrlnk!ncrorl!anderson                       (407) 333-9250 ext. 288

      The opinions expressed here are my own and in no way reflect those
          of my employer or any one else unless specifically stated.