From 9da85a912dfc0d00fc73b1f94cf3c97d576f85a2 Mon Sep 17 00:00:00 2001 From: Marko Zec Date: Sat, 20 Aug 2016 22:12:26 +0000 Subject: [PATCH] Permit disabling net.inet.udp.require_l2_bcast in VIMAGE kernels. The default value of the tunable introduced in r304436 couldn't be effectively overrided on VIMAGE kernels, because instead of being accessed via the appropriate VNET() accessor macro, it was accessed via the VNET_NAME() macro, which resolves to the (should-be) read-only master template of initial values of per-VNET data. Hence, while the value of udp_require_l2_bcast could be altered on per-VNET basis, the code in udp_input() would ignore it as it would always read the default value (one) from the VNET master template. Silence from: rstone --- sys/netinet/udp_usrreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index f0837cfe8ca..e53eb31ff96 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -127,6 +127,7 @@ SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_VNET | CTLFLAG_RW, "Do not send port unreachables for refused connects"); static VNET_DEFINE(int, udp_require_l2_bcast) = 1; +#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"); @@ -528,7 +529,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) pcbinfo = udp_get_inpcbinfo(proto); if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || - ((!VNET_NAME(udp_require_l2_bcast) || m->m_flags & M_BCAST) && + ((!V_udp_require_l2_bcast || m->m_flags & M_BCAST) && in_broadcast(ip->ip_dst, ifp))) { struct inpcb *last; struct inpcbhead *pcblist;