Hello!
According to UNPv1 SO_REUSEPORT on UDP sockets can be used to bind more than
one socket to the same port (even with same source ip address). But quick
look on /sys/netinet/udp_usrreq.c function udp_input() shows that this will
work as expected (data stream duplicate) only on multicast/broadcast local
addresses. Please pay attention to the following code fragment comments:
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) {
struct inpcb *last;
/*
* 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.
* (This really ought to be done for unicast datagrams as
* well, but that would cause problems with existing
* applications that open both address-specific sockets and
* a wildcard socket listening to the same port -- they would
* end up receiving duplicates of every unicast datagram.
* Those applications open the multiple sockets to overcome an
* inadequacy of the UDP socket interface, but for backwards
* compatibility we avoid the problem here rather than
* fixing the interface. Maybe 4.5BSD will remedy this?)
*/
Is there still any real need in such backward compatibility? Can such
functionality be added (fixed) with possibility to switch it off using sysctl
or kernel-build option?
I find such possibility realy useful at least for NetFlow data processing and
believe that it would be useful for many UDP-based protocols.
--
Regards,
Vladimir.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message