summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-05-02 13:48:39 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-05-02 13:48:39 +0000
commit16f4a4e2fc0289ea00379fbe31df1aae90903841 (patch)
tree77bd290a3d1a78b3179469cd39aa684ba668c042 /sys
parent927653333b09f8088a9327effc4daa5f35a34bc9 (diff)
recognize SO_RTABLE socket option at the SOL_SOCKET level;
discussed with and ok claudio
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_socket.c29
-rw-r--r--sys/netinet/in.h4
-rw-r--r--sys/netinet/ip_output.c4
-rw-r--r--sys/netinet6/in6.h4
4 files changed, 36 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index ccb598dde3d..e06ce48339f 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.91 2011/04/19 22:33:08 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.92 2011/05/02 13:48:38 mikeb Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1436,6 +1436,19 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m0)
break;
}
+ case SO_RTABLE:
+ if (so->so_proto && so->so_proto->pr_domain &&
+ so->so_proto->pr_domain->dom_protosw &&
+ so->so_proto->pr_ctloutput) {
+ struct domain *dom = so->so_proto->pr_domain;
+
+ level = dom->dom_protosw->pr_protocol;
+ return ((*so->so_proto->pr_ctloutput)
+ (PRCO_SETOPT, so, level, optname, &m0));
+ }
+ error = ENOPROTOOPT;
+ break;
+
#ifdef SOCKET_SPLICE
case SO_SPLICE:
if (m == NULL) {
@@ -1545,6 +1558,20 @@ sogetopt(struct socket *so, int level, int optname, struct mbuf **mp)
break;
}
+ case SO_RTABLE:
+ (void)m_free(m);
+ if (so->so_proto && so->so_proto->pr_domain &&
+ so->so_proto->pr_domain->dom_protosw &&
+ so->so_proto->pr_ctloutput) {
+ struct domain *dom = so->so_proto->pr_domain;
+
+ level = dom->dom_protosw->pr_protocol;
+ return ((*so->so_proto->pr_ctloutput)
+ (PRCO_GETOPT, so, level, optname, mp));
+ }
+ return (ENOPROTOOPT);
+ break;
+
#ifdef SOCKET_SPLICE
case SO_SPLICE:
{
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index 9ee7987a31e..f204cbb3dc8 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.h,v 1.87 2011/04/28 09:56:27 claudio Exp $ */
+/* $OpenBSD: in.h,v 1.88 2011/05/02 13:48:38 mikeb Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
@@ -282,6 +282,8 @@ struct ip_opts {
#define IP_RECVDSTPORT 33 /* bool; receive IP dst port w/dgram */
#define IP_PIPEX 34 /* bool; using PIPEX */
+#define IP_RTABLE 0x1021 /* int; routing table, see SO_RTABLE */
+
/*
* Security levels - IPsec, not IPSO
*/
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 6c5a3d0c9ca..f8ae21f0cc3 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.219 2011/04/28 09:56:27 claudio Exp $ */
+/* $OpenBSD: ip_output.c,v 1.220 2011/05/02 13:48:38 mikeb Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1383,7 +1383,7 @@ ip_ctloutput(op, so, level, optname, mp)
}
#endif
break;
- case SO_RTABLE:
+ case IP_RTABLE:
if (m == NULL || m->m_len < sizeof(u_int)) {
error = EINVAL;
break;
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 79e3d236a3b..d4cef9a013b 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.52 2010/09/23 04:45:15 yasuoka Exp $ */
+/* $OpenBSD: in6.h,v 1.53 2011/05/02 13:48:38 mikeb Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -479,6 +479,8 @@ struct route_in6 {
#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */
#define IPV6_PIPEX 63 /* bool; using PIPEX */
+#define IPV6_RTABLE 0x1021 /* int; routing table, see SO_RTABLE */
+
/* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */