diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2012-04-07 16:09:10 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2012-04-07 16:09:10 +0000 |
commit | 5ef8dee4c781181c4c257ac39dfee320bacd9d8f (patch) | |
tree | d2381aaca8ea303acd54b3b5e2fe43198ee8a708 /sys/netinet | |
parent | 8f0e8495b8487c1dc8c8c341a7a40308d2e02cef (diff) |
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@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_output.c | 17 |
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; |