On Sat, Apr 23, 2011 at 08:58:12PM +0000, Stuart Henderson wrote:
> On 2011-04-23, Henning Brauer <[email protected]> wrote:
> > * Stuart Henderson <[email protected]> [2011-04-23 14:41]:
> >> Should we do this or should we rethink allowing sockets to be
> >> bound to broadcast IP addresses?
> >
> > i have no idea. and that seems to be common for all of us. i really
> > dunno. anybody?
> >
> 
> Unless there are objections I'll commit my samba diff tomorrow,
> it can always come out again if anything else changes.

What is this socket used for? You can not send a packet out of that
socket. I guess it is a UDP socket that should pickup the broadcast hellos
that flood windows infested networks.

Our network stack will deliver broadcast datagram to all IP RAW and all
UDP dgram sockets that match and are bound to 0.0.0.0 or ::.

/*
 * Deliver a multicast or broadcast datagram to *all* sockets
 * for which the local and remote addresses and ports match
 * those of the incoming datagram.  This allows more than
 * one process to receive multi/broadcasts on the same port.

Now there is this bit of code in the loop as well:
if (inp->inp_laddr.s_addr != INADDR_ANY) {
        if (inp->inp_laddr.s_addr != ip->ip_dst.s_addr)
                continue;
}

So it may make sense to bind to a specific broadcast addr for SOCK_DGRAM
and SOCK_RAW AF_INET socks. In that case you only receive packets that are
sent to the network specific broadcast (this does not work for
packets sent to 255.255.255.255 on that LAN segment)

-- 
:wq Claudio

Reply via email to