Revert the optimization from r304436

r304436 attempted to optimize the handling of incoming UDP packet by only
making an expensive call to in_broadcast() if the mbuf was marked as an
broadcast packet.  Unfortunately, this cannot work in the case of point-to-
point L2 protocols like PPP, which have no notion of "broadcast".  The
optimization has been disabled for several months now with no progress
towards fixing it, so it needs to go.
This commit is contained in:
Ryan Stone 2017-04-05 16:57:13 +00:00
parent 65b9599a76
commit 4af540d197
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316527

View File

@ -123,12 +123,6 @@ SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_VNET | CTLFLAG_RW,
&VNET_NAME(udp_blackhole), 0,
"Do not send port unreachables for refused connects");
static VNET_DEFINE(int, udp_require_l2_bcast) = 0;
#define V_udp_require_l2_bcast VNET(udp_require_l2_bcast)
SYSCTL_INT(_net_inet_udp, OID_AUTO, require_l2_bcast, CTLFLAG_VNET | CTLFLAG_RW,
&VNET_NAME(udp_require_l2_bcast), 0,
"Only treat packets sent to an L2 broadcast address as broadcast packets");
u_long udp_sendspace = 9216; /* really max datagram size */
SYSCTL_ULONG(_net_inet_udp, UDPCTL_MAXDGRAM, maxdgram, CTLFLAG_RW,
&udp_sendspace, 0, "Maximum outgoing UDP datagram size");
@ -529,8 +523,7 @@ udp_input(struct mbuf **mp, int *offp, int proto)
pcbinfo = udp_get_inpcbinfo(proto);
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
((!V_udp_require_l2_bcast || m->m_flags & M_BCAST) &&
in_broadcast(ip->ip_dst, ifp))) {
in_broadcast(ip->ip_dst, ifp)) {
struct inpcb *last;
struct inpcbhead *pcblist;
struct ip_moptions *imo;