summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-11-14 15:40:40 +0000
committermpi <mpi@openbsd.org>2015-11-14 15:40:40 +0000
commit8126bee84140f3435c6b210cdb7a48b49f549bf3 (patch)
treecf4058c7df4743674e9287288ab2ec5d580bc589
parentno need for a mirror-maker(7) mlink; (diff)
downloadwireguard-openbsd-8126bee84140f3435c6b210cdb7a48b49f549bf3.tar.xz
wireguard-openbsd-8126bee84140f3435c6b210cdb7a48b49f549bf3.zip
Grab the KERNEL_LOCK around ip_mforward(), in preparation for unlocking
ip_input(). Note that ipmforwarding is not enabled by default. ok deraadt@, phessler@
-rw-r--r--sys/netinet/ip_input.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 4c426549d84..62e3ff98cc7 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.260 2015/10/27 12:06:37 mpi Exp $ */
+/* $OpenBSD: ip_input.c,v 1.261 2015/11/14 15:40:40 mpi Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -352,6 +352,8 @@ ipv4_input(struct mbuf *m)
#ifdef MROUTING
if (ipmforwarding && ip_mrouter) {
+ int rv;
+
if (m->m_flags & M_EXT) {
if ((m = m_pullup(m, hlen)) == NULL) {
ipstat.ips_toosmall++;
@@ -371,7 +373,10 @@ ipv4_input(struct mbuf *m)
* as expected when ip_mforward() is called from
* ip_output().)
*/
- if (ip_mforward(m, ifp) != 0) {
+ KERNEL_LOCK();
+ rv = ip_mforward(m, ifp);
+ KERNEL_UNLOCK();
+ if (rv != 0) {
ipstat.ips_cantforward++;
goto bad;
}