summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2010-09-30 09:18:19 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2010-09-30 09:18:19 +0000
commitef9672fbf9685591b32465490df9d499a29f45f6 (patch)
tree6ec72fd2372126a6c2eeb5ff0f3aab832635cc80
parent34078964494710548be572cc5a1727fc4095a172 (diff)
If a caller is requesting to be set to the same rtable that they
currently have, let the call succeede. Mirrors the same behaviour as setrtable() OK claudio@
-rw-r--r--sys/netinet/ip_output.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 506e1381465..801a363d616 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.213 2010/09/23 04:45:15 yasuoka Exp $ */
+/* $OpenBSD: ip_output.c,v 1.214 2010/09/30 09:18:18 phessler Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1417,16 +1417,17 @@ ip_ctloutput(op, so, level, optname, mp)
break;
}
rtid = *mtod(m, u_int *);
- /* needs priviledges to switch when already set */
- if (p->p_p->ps_rtableid != 0 && suser(p, 0) != 0) {
- error = EACCES;
- break;
- }
/* table must exist */
if (!rtable_exists(rtid)) {
error = EINVAL;
break;
}
+ /* needs priviledges to switch when already set */
+ if (p->p_p->ps_rtableid != rtid &&
+ p->p_p->ps_rtableid != 0 && suser(p, 0) != 0) {
+ error = EACCES;
+ break;
+ }
inp->inp_rtableid = rtid;
break;
case IP_PIPEX: