summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-09-01 11:26:44 +0000
committermpi <mpi@openbsd.org>2016-09-01 11:26:44 +0000
commitca7b45206c0d8f447cc97e55e9d12ac31f93c814 (patch)
tree108e71f036ce8569ae314ca623e13cf35e71241a
parentstruct client starts to become the kitchen sink. Move fastcgi data to (diff)
downloadwireguard-openbsd-ca7b45206c0d8f447cc97e55e9d12ac31f93c814.tar.xz
wireguard-openbsd-ca7b45206c0d8f447cc97e55e9d12ac31f93c814.zip
Move the RTF_LOCAL check that only makes sense for userland to
route_output(). ok claudio@
-rw-r--r--sys/net/route.c13
-rw-r--r--sys/net/rtsock.c13
2 files changed, 13 insertions, 13 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index e02600bd040..a02bb9dcf51 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.319 2016/08/31 08:13:17 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.320 2016/09/01 11:26:44 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -910,17 +910,6 @@ rtrequest_delete(struct rt_addrinfo *info, u_int8_t prio, struct ifnet *ifp,
}
#endif
- /*
- * Since RTP_LOCAL cannot be set by userland, make
- * sure that local routes are only modified by the
- * kernel.
- */
- if ((rt->rt_flags & (RTF_LOCAL|RTF_BROADCAST)) &&
- (prio & RTP_MASK) != RTP_LOCAL) {
- rtfree(rt);
- return (EINVAL);
- }
-
error = rtable_delete(tableid, info->rti_info[RTAX_DST],
info->rti_info[RTAX_NETMASK], rt);
if (error != 0) {
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;