summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-10-21 08:47:01 +0000
committermpi <mpi@openbsd.org>2015-10-21 08:47:01 +0000
commita7d9f3135d88497bc215e9e733e58c65c1c5e2b8 (patch)
treef50dee8441028bb371652bd79bf9793caf75f26a
parentu_short -> unsigned int for rtableid. (diff)
downloadwireguard-openbsd-a7d9f3135d88497bc215e9e733e58c65c1c5e2b8.tar.xz
wireguard-openbsd-a7d9f3135d88497bc215e9e733e58c65c1c5e2b8.zip
Return the correct error code when a table already exists.
-rw-r--r--sys/net/rtable.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/net/rtable.c b/sys/net/rtable.c
index 90a8cc10db7..ae13f2ff0a5 100644
--- a/sys/net/rtable.c
+++ b/sys/net/rtable.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtable.c,v 1.12 2015/10/14 10:09:30 mpi Exp $ */
+/* $OpenBSD: rtable.c,v 1.13 2015/10/21 08:47:01 mpi Exp $ */
/*
* Copyright (c) 2014-2015 Martin Pieuchot
@@ -113,9 +113,12 @@ rtable_add(unsigned int id)
unsigned int off;
int i;
- if (id > RT_TABLEID_MAX || rtable_exists(id))
+ if (id > RT_TABLEID_MAX)
return (EINVAL);
+ if (rtable_exists(id))
+ return (EEXIST);
+
for (i = 0; (dp = domains[i]) != NULL; i++) {
if (dp->dom_rtoffset == 0)
continue;