diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-01 11:26:45 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-01 11:26:45 +0000 |
commit | 0a8d63d82dc6fe5c612a58f1eed8c56a032da2c0 (patch) | |
tree | 2ec9aedff157c5e96b5da8cfe788a181826ef802 | |
parent | df42fc7e0108e205cf9e226e3c0a905dc07b190f (diff) |
Move the RTF_LOCAL check that only makes sense for userland to
route_output().
ok claudio@
-rw-r--r-- | sys/net/route.c | 13 | ||||
-rw-r--r-- | sys/net/rtsock.c | 13 |
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; |