summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2012-04-07 16:09:09 +0000
committerclaudio <claudio@openbsd.org>2012-04-07 16:09:09 +0000
commit114ad9693c94bede89d4b8951ae806e8c258f2e7 (patch)
tree9e5533cfafad5dac519f57381a8ae39d6c982168
parentremove superfluous return, ok mikeb (diff)
downloadwireguard-openbsd-114ad9693c94bede89d4b8951ae806e8c258f2e7.tar.xz
wireguard-openbsd-114ad9693c94bede89d4b8951ae806e8c258f2e7.zip
Bring the rtable sockopt code in line with the setrtable() implementation.
While there change IP_RTABLE to SO_RTABLE. IP_RTABLE will die soon. With and OK guenther@
-rw-r--r--sys/netinet/ip_output.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 1d2e5862675..279f77cce4b 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.227 2012/03/30 11:12:46 markus Exp $ */
+/* $OpenBSD: ip_output.c,v 1.228 2012/04/07 16:09:09 claudio Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1388,21 +1388,22 @@ ip_ctloutput(op, so, level, optname, mp)
}
#endif
break;
- case IP_RTABLE:
+ case SO_RTABLE:
if (m == NULL || m->m_len < sizeof(u_int)) {
error = EINVAL;
break;
}
rtid = *mtod(m, u_int *);
- /* table must exist */
- if (!rtable_exists(rtid)) {
- error = EINVAL;
+ if (inp->inp_rtableid == rtid)
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;
+ p->p_p->ps_rtableid != 0 &&
+ (error = suser(p, 0)) != 0)
+ break;
+ /* table must exist */
+ if (!rtable_exists(rtid)) {
+ error = EINVAL;
break;
}
inp->inp_rtableid = rtid;