summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-09-01 11:26:45 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-09-01 11:26:45 +0000
commit0a8d63d82dc6fe5c612a58f1eed8c56a032da2c0 (patch)
tree2ec9aedff157c5e96b5da8cfe788a181826ef802 /sys/net/rtsock.c
parentdf42fc7e0108e205cf9e226e3c0a905dc07b190f (diff)
Move the RTF_LOCAL check that only makes sense for userland to
route_output(). ok claudio@
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 9037a0e3c6a..83d45d93479 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.198 2016/09/01 09:35:28 mpi Exp $ */
+/* $OpenBSD: rtsock.c,v 1.199 2016/09/01 11:26:44 mpi Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -657,6 +657,17 @@ route_output(struct mbuf *m, ...)
route_cleargateway, rt);
goto report;
}
+
+ /*
+ * Make sure that local routes are only modified by the
+ * kernel.
+ */
+ if ((rt != NULL) &&
+ ISSET(rt->rt_flags, RTF_LOCAL|RTF_BROADCAST)) {
+ error = EINVAL;
+ goto report;
+ }
+
rtfree(rt);
rt = NULL;