diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-12-19 18:57:18 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-12-19 18:57:18 +0000 |
commit | 54309686695cb771bdda488e5e113ef42905657e (patch) | |
tree | 80636af8daae92619ead0e2ba62f4c9b7b69743b | |
parent | b8d60590925ff4d90f40cabc1e46d870ec01e28e (diff) |
Do not report an EDQUOT "Disk quota exceeded" error from the routing
code. Instead generate an ENOBUFS "No buffer space available" error
at the malloc(9) failure in rt_setgate(9) and propagate it.
OK mpi@
-rw-r--r-- | share/man/man9/route.9 | 11 | ||||
-rw-r--r-- | sys/net/route.c | 10 | ||||
-rw-r--r-- | sys/net/rtsock.c | 8 |
3 files changed, 16 insertions, 13 deletions
diff --git a/share/man/man9/route.9 b/share/man/man9/route.9 index 51d11a84184..e68b099e6d4 100644 --- a/share/man/man9/route.9 +++ b/share/man/man9/route.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: route.9,v 1.13 2014/11/01 21:45:54 mpi Exp $ +.\" $OpenBSD: route.9,v 1.14 2014/12/19 18:57:17 bluhm Exp $ .\" .\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org> .\" All rights reserved. @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 1 2014 $ +.Dd $Mdocdate: December 19 2014 $ .Dt ROUTE 9 .Os .Sh NAME @@ -81,7 +81,12 @@ sockets. .El .Sh RETURN VALUES .Fn rt_setgate -returns non-0 if it cannot allocate memory. +may fail with: +.Pp +.Bl -tag -width Er -compact +.It Bq Er ENOBUFS +Memory could not be allocated for the gateway. +.El .Pp .Fn rtdeletemsg may fail with: diff --git a/sys/net/route.c b/sys/net/route.c index b933dd0ed8f..d6b616be00d 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.194 2014/12/08 10:46:14 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.195 2014/12/19 18:57:17 bluhm Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -834,10 +834,10 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, prio = ifa->ifa_ifp->if_priority + RTP_STATIC; rt->rt_priority = prio; /* init routing priority */ LIST_INIT(&rt->rt_timer); - if (rt_setgate(rt, info->rti_info[RTAX_DST], - info->rti_info[RTAX_GATEWAY], tableid)) { + if ((error = rt_setgate(rt, info->rti_info[RTAX_DST], + info->rti_info[RTAX_GATEWAY], tableid))) { pool_put(&rtentry_pool, rt); - senderr(ENOBUFS); + senderr(error); } ndst = rt_key(rt); if (info->rti_info[RTAX_NETMASK] != NULL) { @@ -997,7 +997,7 @@ rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate, old = (caddr_t)rt_key(rt); new = malloc(dlen + glen, M_RTABLE, M_NOWAIT); if (new == NULL) - return 1; + return (ENOBUFS); rt->rt_nodes->rn_key = new; } else { new = rt->rt_nodes->rn_key; diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 52f2ac36eb5..80c53bc2ff7 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.154 2014/12/11 08:55:10 mpi Exp $ */ +/* $OpenBSD: rtsock.c,v 1.155 2014/12/19 18:57:17 bluhm Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -750,11 +750,9 @@ report: newgate = 1; } if (info.rti_info[RTAX_GATEWAY] != NULL && - rt_setgate(rt, rt_key(rt), - info.rti_info[RTAX_GATEWAY], tableid)) { - error = EDQUOT; + (error = rt_setgate(rt, rt_key(rt), + info.rti_info[RTAX_GATEWAY], tableid))) goto flush; - } /* * new gateway could require new ifaddr, ifp; * flags may also be different; ifp may be specified |