--- sys/netinet/udp_usrreq.c Tue Jul 16 20:13:09 2002 +++ sys/netinet/udp_usrreq.c Tue Jul 16 20:31:36 2002 @@ -98,6 +98,10 @@ SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_RW, &blackhole, 0, "Do not send port unreachables for refused connects"); +static int wide_broadcast = 1; +SYSCTL_INT(_net_inet_udp, OID_AUTO, wide_broadcast, CTLFLAG_RW, + &wide_broadcast, 0, "Deliver broadcast packets to sockets listening on a non-broadcast address"); + struct inpcbhead udb; /* from udp_var.h */ #define udb6 udb /* for KAME src sync over BSD*'s */ struct inpcbinfo udbinfo; @@ -277,7 +281,7 @@ #endif if (inp->inp_lport != uh->uh_dport) continue; - if (inp->inp_laddr.s_addr != INADDR_ANY) { + if (!wide_broadcast && (inp->inp_laddr.s_addr != INADDR_ANY)) { if (inp->inp_laddr.s_addr != ip->ip_dst.s_addr) continue; @@ -313,7 +317,7 @@ * port. It * assumes that an application will never * clear these options after setting them. */ - if ((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR)) == 0) + if (!wide_broadcast && ((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR)) == 0)) break; }